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_HOST_H_ |
6 #define SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ | 6 #define SERVICES_UI_WS_GPU_HOST_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_host.mojom.h" | 16 #include "services/ui/gpu/interfaces/gpu_host.mojom.h" |
17 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" | 17 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
18 #include "services/ui/public/interfaces/gpu.mojom.h" | 18 #include "services/ui/public/interfaces/gpu.mojom.h" |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 class ServerGpuMemoryBufferManager; | 22 class ServerGpuMemoryBufferManager; |
23 | 23 |
24 namespace ws { | 24 namespace ws { |
25 | 25 |
26 class GpuServiceProxyDelegate; | 26 class GpuHostDelegate; |
27 | 27 |
28 // Sets up connection from clients to the real service implementation in the GPU | 28 // Sets up connection from clients to the real service implementation in the GPU |
29 // process. | 29 // process. |
30 class GpuServiceProxy : public mojom::GpuServiceHost { | 30 class GpuHost : public mojom::GpuHost { |
31 public: | 31 public: |
32 explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate); | 32 explicit GpuHost(GpuHostDelegate* delegate); |
33 ~GpuServiceProxy() override; | 33 ~GpuHost() override; |
34 | 34 |
35 void Add(mojom::GpuRequest request); | 35 void Add(mojom::GpuRequest request); |
36 | 36 |
37 // Requests a cc::mojom::DisplayCompositor interface from mus-gpu. | 37 // Requests a cc::mojom::DisplayCompositor interface from mus-gpu. |
38 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request, | 38 void CreateDisplayCompositor(cc::mojom::DisplayCompositorRequest request, |
39 cc::mojom::DisplayCompositorClientPtr client); | 39 cc::mojom::DisplayCompositorClientPtr client); |
40 | 40 |
41 private: | 41 private: |
42 // mojom::GpuServiceHost: | 42 // mojom::GpuHost: |
43 void DidInitialize(const gpu::GPUInfo& gpu_info) override; | 43 void DidInitialize(const gpu::GPUInfo& gpu_info) override; |
44 void DidCreateOffscreenContext(const GURL& url) override; | 44 void DidCreateOffscreenContext(const GURL& url) override; |
45 void DidDestroyOffscreenContext(const GURL& url) override; | 45 void DidDestroyOffscreenContext(const GURL& url) override; |
46 void DidDestroyChannel(int32_t client_id) override; | 46 void DidDestroyChannel(int32_t client_id) override; |
47 void DidLoseContext(bool offscreen, | 47 void DidLoseContext(bool offscreen, |
48 gpu::error::ContextLostReason reason, | 48 gpu::error::ContextLostReason reason, |
49 const GURL& active_url) override; | 49 const GURL& active_url) override; |
50 void StoreShaderToDisk(int32_t client_id, | 50 void StoreShaderToDisk(int32_t client_id, |
51 const std::string& key, | 51 const std::string& key, |
52 const std::string& shader) override; | 52 const std::string& shader) override; |
53 | 53 |
54 GpuServiceProxyDelegate* const delegate_; | 54 GpuHostDelegate* const delegate_; |
55 int32_t next_client_id_; | 55 int32_t next_client_id_; |
56 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 56 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
57 mojom::GpuServiceInternalPtr gpu_service_; | 57 mojom::GpuServicePtr gpu_service_; |
58 mojo::Binding<mojom::GpuServiceHost> gpu_host_binding_; | 58 mojo::Binding<mojom::GpuHost> gpu_host_binding_; |
59 gpu::GPUInfo gpu_info_; | 59 gpu::GPUInfo gpu_info_; |
60 std::unique_ptr<ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 60 std::unique_ptr<ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
61 | 61 |
62 mojom::GpuMainPtr gpu_main_; | 62 mojom::GpuMainPtr gpu_main_; |
63 | 63 |
64 // TODO(fsamuel): GpuServiceProxy should not be holding onto |gpu_main_impl| | 64 // TODO(fsamuel): GpuHost should not be holding onto |gpu_main_impl| |
65 // because that will live in another process soon. | 65 // because that will live in another process soon. |
66 std::unique_ptr<GpuMain> gpu_main_impl_; | 66 std::unique_ptr<GpuMain> gpu_main_impl_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy); | 68 DISALLOW_COPY_AND_ASSIGN(GpuHost); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace ws | 71 } // namespace ws |
72 } // namespace ui | 72 } // namespace ui |
73 | 73 |
74 #endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_ | 74 #endif // SERVICES_UI_WS_GPU_HOST_H_ |
OLD | NEW |