OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SERVICE_PROXY_H_ | 5 #ifndef SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ |
6 #define SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ | 6 #define SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ |
7 | 7 |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
11 #include "gpu/config/gpu_info.h" | 11 #include "gpu/config/gpu_info.h" |
12 #include "gpu/ipc/client/gpu_channel_host.h" | 12 #include "gpu/ipc/client/gpu_channel_host.h" |
13 #include "mojo/public/cpp/bindings/binding_set.h" | 13 #include "mojo/public/cpp/bindings/binding_set.h" |
14 #include "mojo/public/cpp/bindings/interface_request.h" | 14 #include "mojo/public/cpp/bindings/interface_request.h" |
15 #include "services/ui/gpu/gpu_main.h" | 15 #include "services/ui/gpu/gpu_main.h" |
16 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" | 16 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" |
17 #include "services/ui/public/interfaces/gpu_memory_buffer.mojom.h" | 17 #include "services/ui/public/interfaces/gpu_memory_buffer.mojom.h" |
18 #include "services/ui/public/interfaces/gpu_service.mojom.h" | 18 #include "services/ui/public/interfaces/gpu_service.mojom.h" |
19 | 19 |
20 namespace gpu { | 20 namespace gpu { |
21 class GpuChannelHost; | 21 class GpuChannelHost; |
22 } | 22 } |
23 | 23 |
24 namespace ui { | 24 namespace ui { |
25 | 25 |
26 class GpuServiceInternal; | 26 class GpuServiceInternal; |
27 class MusGpuMemoryBufferManager; | |
27 | 28 |
28 namespace ws { | 29 namespace ws { |
29 | 30 |
30 class GpuServiceProxyDelegate; | 31 class GpuServiceProxyDelegate; |
31 class MusGpuMemoryBufferManager; | |
32 | 32 |
33 // The proxy implementation that relays requests from clients to the real | 33 // The proxy implementation that relays requests from clients to the real |
34 // service implementation in the GPU process over mojom.GpuServiceInternal. | 34 // service implementation in the GPU process over mojom.GpuServiceInternal. |
35 class GpuServiceProxy : public mojom::GpuService, | 35 class GpuServiceProxy : public mojom::GpuService, |
36 public gpu::GpuChannelHostFactory { | 36 public gpu::GpuChannelHostFactory { |
37 public: | 37 public: |
38 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate); | 38 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate); |
39 ~GpuServiceProxy() override; | 39 ~GpuServiceProxy() override; |
40 | 40 |
41 void Add(mojom::GpuServiceRequest request); | 41 void Add(mojom::GpuServiceRequest request); |
42 | 42 |
43 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request, | |
44 cc::mojom::DisplayCompositorClientPtr client); | |
45 | |
43 private: | 46 private: |
44 void OnInitialized(const gpu::GPUInfo& gpu_info); | 47 void OnInitialized(const gpu::GPUInfo& gpu_info); |
45 void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback, | 48 void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback, |
46 int32_t client_id, | 49 int32_t client_id, |
47 mojo::ScopedMessagePipeHandle channel_handle); | 50 mojo::ScopedMessagePipeHandle channel_handle); |
48 void OnInternalGpuChannelEstablished( | |
49 mojo::ScopedMessagePipeHandle channel_handle); | |
50 | 51 |
51 // mojom::GpuService overrides: | 52 // mojom::GpuService overrides: |
52 void EstablishGpuChannel( | 53 void EstablishGpuChannel( |
53 const EstablishGpuChannelCallback& callback) override; | 54 const EstablishGpuChannelCallback& callback) override; |
54 void CreateGpuMemoryBuffer( | 55 void CreateGpuMemoryBuffer( |
55 gfx::GpuMemoryBufferId id, | 56 gfx::GpuMemoryBufferId id, |
56 const gfx::Size& size, | 57 const gfx::Size& size, |
57 gfx::BufferFormat format, | 58 gfx::BufferFormat format, |
58 gfx::BufferUsage usage, | 59 gfx::BufferUsage usage, |
59 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) | 60 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) |
60 override; | 61 override; |
61 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 62 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
62 const gpu::SyncToken& sync_token) override; | 63 const gpu::SyncToken& sync_token) override; |
63 | 64 |
64 // gpu::GpuChannelHostFactory overrides: | 65 // gpu::GpuChannelHostFactory overrides: |
65 bool IsMainThread() override; | 66 bool IsMainThread() override; |
66 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; | 67 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; |
67 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | 68 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
68 size_t size) override; | 69 size_t size) override; |
69 | 70 |
70 GpuServiceProxyDelegate* delegate_; | 71 GpuServiceProxyDelegate* const delegate_; |
71 int32_t next_client_id_; | 72 int32_t next_client_id_; |
72 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 73 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
73 mojom::GpuServiceInternalPtr gpu_service_; | 74 mojom::GpuServiceInternalPtr gpu_service_; |
74 mojo::BindingSet<mojom::GpuService> bindings_; | 75 mojo::BindingSet<mojom::GpuService> bindings_; |
75 gpu::GPUInfo gpu_info_; | 76 gpu::GPUInfo gpu_info_; |
76 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; | 77 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
sadrul
2016/11/21 17:23:49
Remove this? Since you are not creating it anymore
Fady Samuel
2016/11/21 20:40:41
Done.
| |
77 base::WaitableEvent shutdown_event_; | 78 base::WaitableEvent shutdown_event_; |
78 std::unique_ptr<base::Thread> io_thread_; | 79 std::unique_ptr<base::Thread> io_thread_; |
79 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_; | |
80 GpuMain gpu_main_; | 80 GpuMain gpu_main_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy); | 82 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace ws | 85 } // namespace ws |
86 } // namespace ui | 86 } // namespace ui |
87 | 87 |
88 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ | 88 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ |
OLD | NEW |