1 // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef GPU_IPC_SERVICE_WEBGPU_COMMAND_BUFFER_STUB_H_ 6 #define GPU_IPC_SERVICE_WEBGPU_COMMAND_BUFFER_STUB_H_ 7 8 #include "gpu/ipc/service/command_buffer_stub.h" 9 10 namespace gpu { 11 12 class GPU_IPC_SERVICE_EXPORT WebGPUCommandBufferStub 13 : public CommandBufferStub { 14 public: 15 WebGPUCommandBufferStub(GpuChannel* channel, 16 const GPUCreateCommandBufferConfig& init_params, 17 CommandBufferId command_buffer_id, 18 SequenceId sequence_id, 19 int32_t stream_id, 20 int32_t route_id); 21 ~WebGPUCommandBufferStub() override; 22 23 // This must leave the GL context associated with the newly-created 24 // CommandBufferStub current, so the GpuChannel can initialize 25 // the gpu::Capabilities. 26 gpu::ContextResult Initialize( 27 CommandBufferStub* share_group, 28 const GPUCreateCommandBufferConfig& init_params, 29 base::UnsafeSharedMemoryRegion shared_state_shm) override; 30 MemoryTracker* GetMemoryTracker() const override; 31 32 private: 33 bool HandleMessage(const IPC::Message& message) override; 34 void OnSwapBuffers(uint64_t swap_id, uint32_t flags) override; 35 36 std::unique_ptr<MemoryTracker> memory_tracker_; 37 38 DISALLOW_COPY_AND_ASSIGN(WebGPUCommandBufferStub); 39 }; 40 41 } // namespace gpu 42 43 #endif // GPU_IPC_SERVICE_WEBGPU_COMMAND_BUFFER_STUB_H_ 44