OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 SERVICES_UI_WS_GPU_CLIENT_H_ |
| 6 #define SERVICES_UI_WS_GPU_CLIENT_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "gpu/config/gpu_info.h" |
| 10 #include "services/ui/public/interfaces/gpu.mojom.h" |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 namespace mojom { |
| 15 class GpuService; |
| 16 } // namespace mojom |
| 17 |
| 18 class ServerGpuMemoryBufferManager; |
| 19 |
| 20 namespace ws { |
| 21 |
| 22 namespace test { |
| 23 class GpuHostTest; |
| 24 } // namespace test |
| 25 |
| 26 // The implementation that relays requests from clients to the real |
| 27 // service implementation in the GPU process over mojom.GpuService. |
| 28 class GpuClient : public mojom::Gpu { |
| 29 public: |
| 30 GpuClient(int client_id, |
| 31 gpu::GPUInfo* gpu_info, |
| 32 ServerGpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 33 mojom::GpuService* gpu_service); |
| 34 ~GpuClient() override; |
| 35 |
| 36 private: |
| 37 friend class test::GpuHostTest; |
| 38 |
| 39 // EstablishGpuChannelCallback: |
| 40 void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback, |
| 41 mojo::ScopedMessagePipeHandle channel_handle); |
| 42 // mojom::Gpu overrides: |
| 43 void EstablishGpuChannel( |
| 44 const EstablishGpuChannelCallback& callback) override; |
| 45 void CreateGpuMemoryBuffer( |
| 46 gfx::GpuMemoryBufferId id, |
| 47 const gfx::Size& size, |
| 48 gfx::BufferFormat format, |
| 49 gfx::BufferUsage usage, |
| 50 const mojom::Gpu::CreateGpuMemoryBufferCallback& callback) override; |
| 51 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
| 52 const gpu::SyncToken& sync_token) override; |
| 53 |
| 54 const int client_id_; |
| 55 |
| 56 // The objects these pointers refer to are owned by the GpuHost object. |
| 57 const gpu::GPUInfo* gpu_info_; |
| 58 ServerGpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 59 mojom::GpuService* gpu_service_; |
| 60 |
| 61 base::WeakPtrFactory<GpuClient> weak_factory_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(GpuClient); |
| 64 }; |
| 65 |
| 66 } // namespace ws |
| 67 } // namespace ui |
| 68 |
| 69 #endif // SERVICES_UI_WS_GPU_CLIENT_H_ |
OLD | NEW |