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 { | |
21 class GpuChannelHost; | |
22 } | |
23 | |
24 namespace ui { | 20 namespace ui { |
25 | 21 |
26 class GpuServiceInternal; | 22 class GpuServiceInternal; |
23 class MusGpuMemoryBufferManager; | |
27 | 24 |
28 namespace ws { | 25 namespace ws { |
29 | 26 |
30 class GpuServiceProxyDelegate; | 27 class GpuServiceProxyDelegate; |
31 class MusGpuMemoryBufferManager; | |
32 | 28 |
33 // The proxy implementation that relays requests from clients to the real | 29 // The proxy implementation that relays requests from clients to the real |
34 // service implementation in the GPU process over mojom.GpuServiceInternal. | 30 // service implementation in the GPU process over mojom.GpuServiceInternal. |
35 class GpuServiceProxy : public mojom::GpuService, | 31 class GpuServiceProxy : public mojom::GpuService { |
36 public gpu::GpuChannelHostFactory { | |
37 public: | 32 public: |
38 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate); | 33 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate); |
39 ~GpuServiceProxy() override; | 34 ~GpuServiceProxy() override; |
40 | 35 |
41 void Add(mojom::GpuServiceRequest request); | 36 void Add(mojom::GpuServiceRequest request); |
42 | 37 |
38 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request, | |
rjkroege
2016/11/21 23:05:36
method docs?
Fady Samuel
2016/11/22 01:02:23
Done.
| |
39 cc::mojom::DisplayCompositorClientPtr client); | |
40 | |
43 private: | 41 private: |
44 void OnInitialized(const gpu::GPUInfo& gpu_info); | 42 void OnInitialized(const gpu::GPUInfo& gpu_info); |
45 void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback, | 43 void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback, |
46 int32_t client_id, | 44 int32_t client_id, |
47 mojo::ScopedMessagePipeHandle channel_handle); | 45 mojo::ScopedMessagePipeHandle channel_handle); |
48 void OnInternalGpuChannelEstablished( | |
49 mojo::ScopedMessagePipeHandle channel_handle); | |
50 | 46 |
51 // mojom::GpuService overrides: | 47 // mojom::GpuService overrides: |
52 void EstablishGpuChannel( | 48 void EstablishGpuChannel( |
53 const EstablishGpuChannelCallback& callback) override; | 49 const EstablishGpuChannelCallback& callback) override; |
54 void CreateGpuMemoryBuffer( | 50 void CreateGpuMemoryBuffer( |
55 gfx::GpuMemoryBufferId id, | 51 gfx::GpuMemoryBufferId id, |
56 const gfx::Size& size, | 52 const gfx::Size& size, |
57 gfx::BufferFormat format, | 53 gfx::BufferFormat format, |
58 gfx::BufferUsage usage, | 54 gfx::BufferUsage usage, |
59 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) | 55 const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) |
60 override; | 56 override; |
61 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 57 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
62 const gpu::SyncToken& sync_token) override; | 58 const gpu::SyncToken& sync_token) override; |
63 | 59 |
64 // gpu::GpuChannelHostFactory overrides: | 60 GpuServiceProxyDelegate* const delegate_; |
65 bool IsMainThread() override; | |
66 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; | |
67 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | |
68 size_t size) override; | |
69 | |
70 GpuServiceProxyDelegate* delegate_; | |
71 int32_t next_client_id_; | 61 int32_t next_client_id_; |
72 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 62 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
73 mojom::GpuServiceInternalPtr gpu_service_; | 63 mojom::GpuServiceInternalPtr gpu_service_; |
74 mojo::BindingSet<mojom::GpuService> bindings_; | 64 mojo::BindingSet<mojom::GpuService> bindings_; |
75 gpu::GPUInfo gpu_info_; | 65 gpu::GPUInfo gpu_info_; |
76 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; | |
77 base::WaitableEvent shutdown_event_; | |
78 std::unique_ptr<base::Thread> io_thread_; | |
79 std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_; | |
80 GpuMain gpu_main_; | 66 GpuMain gpu_main_; |
81 | 67 |
82 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy); | 68 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy); |
83 }; | 69 }; |
84 | 70 |
85 } // namespace ws | 71 } // namespace ws |
86 } // namespace ui | 72 } // namespace ui |
87 | 73 |
88 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ | 74 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ |
OLD | NEW |