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