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_GPU_GPU_MAIN_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_MAIN_H_ |
6 #define SERVICES_UI_GPU_GPU_MAIN_H_ | 6 #define SERVICES_UI_GPU_GPU_MAIN_H_ |
7 | 7 |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "gpu/ipc/in_process_command_buffer.h" | 9 #include "gpu/ipc/in_process_command_buffer.h" |
10 #include "gpu/ipc/service/gpu_init.h" | 10 #include "gpu/ipc/service/gpu_init.h" |
11 #include "services/ui/gpu/interfaces/gpu_main.mojom.h" | 11 #include "services/ui/gpu/interfaces/gpu_main.mojom.h" |
12 #include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h" | 12 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
13 #include "services/ui/surfaces/display_compositor.h" | 13 #include "services/ui/surfaces/display_compositor.h" |
14 | 14 |
15 namespace gpu { | 15 namespace gpu { |
16 class GpuMemoryBufferFactory; | 16 class GpuMemoryBufferFactory; |
17 class ImageFactory; | 17 class ImageFactory; |
18 } | 18 } |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 class GpuServiceInternal; | 22 class GpuService; |
23 | 23 |
24 class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain { | 24 class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain { |
25 public: | 25 public: |
26 explicit GpuMain(mojom::GpuMainRequest request); | 26 explicit GpuMain(mojom::GpuMainRequest request); |
27 ~GpuMain() override; | 27 ~GpuMain() override; |
28 | 28 |
29 // mojom::GpuMain implementation: | 29 // mojom::GpuMain implementation: |
30 void CreateGpuService(mojom::GpuServiceInternalRequest request, | 30 void CreateGpuService(mojom::GpuServiceRequest request, |
31 mojom::GpuServiceHostPtr gpu_host) override; | 31 mojom::GpuHostPtr gpu_host) override; |
32 void CreateDisplayCompositor( | 32 void CreateDisplayCompositor( |
33 cc::mojom::DisplayCompositorRequest request, | 33 cc::mojom::DisplayCompositorRequest request, |
34 cc::mojom::DisplayCompositorClientPtr client) override; | 34 cc::mojom::DisplayCompositorClientPtr client) override; |
35 | 35 |
36 void OnStart(); | 36 void OnStart(); |
37 | 37 |
38 GpuServiceInternal* gpu_service() { return gpu_service_internal_.get(); } | 38 GpuService* gpu_service() { return gpu_service_.get(); } |
39 | 39 |
40 private: | 40 private: |
41 void InitOnGpuThread( | 41 void InitOnGpuThread( |
42 scoped_refptr<base::SingleThreadTaskRunner> io_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> io_runner, |
43 scoped_refptr<base::SingleThreadTaskRunner> compositor_runner); | 43 scoped_refptr<base::SingleThreadTaskRunner> compositor_runner); |
44 | 44 |
45 void CreateDisplayCompositorInternal( | 45 void CreateDisplayCompositorInternal( |
46 cc::mojom::DisplayCompositorRequest request, | 46 cc::mojom::DisplayCompositorRequest request, |
47 cc::mojom::DisplayCompositorClientPtrInfo client_info); | 47 cc::mojom::DisplayCompositorClientPtrInfo client_info); |
48 void CreateDisplayCompositorOnCompositorThread( | 48 void CreateDisplayCompositorOnCompositorThread( |
49 gpu::ImageFactory* image_factory, | 49 gpu::ImageFactory* image_factory, |
50 mojom::GpuServiceInternalPtrInfo gpu_service_info, | 50 mojom::GpuServicePtrInfo gpu_service_info, |
51 cc::mojom::DisplayCompositorRequest request, | 51 cc::mojom::DisplayCompositorRequest request, |
52 cc::mojom::DisplayCompositorClientPtrInfo client_info); | 52 cc::mojom::DisplayCompositorClientPtrInfo client_info); |
53 void CreateGpuServiceOnGpuThread(mojom::GpuServiceInternalRequest request, | 53 void CreateGpuServiceOnGpuThread(mojom::GpuServiceRequest request, |
54 mojom::GpuServiceHostPtrInfo gpu_host_info); | 54 mojom::GpuHostPtrInfo gpu_host_info); |
55 void BindGpuInternalOnGpuThread(mojom::GpuServiceInternalRequest request); | 55 void BindGpuInternalOnGpuThread(mojom::GpuServiceRequest request); |
56 | 56 |
57 void TearDownOnCompositorThread(); | 57 void TearDownOnCompositorThread(); |
58 void TearDownOnGpuThread(); | 58 void TearDownOnGpuThread(); |
59 | 59 |
60 // gpu::GpuSandboxHelper: | 60 // gpu::GpuSandboxHelper: |
61 void PreSandboxStartup() override; | 61 void PreSandboxStartup() override; |
62 bool EnsureSandboxInitialized( | 62 bool EnsureSandboxInitialized( |
63 gpu::GpuWatchdogThread* watchdog_thread) override; | 63 gpu::GpuWatchdogThread* watchdog_thread) override; |
64 | 64 |
65 std::unique_ptr<gpu::GpuInit> gpu_init_; | 65 std::unique_ptr<gpu::GpuInit> gpu_init_; |
66 std::unique_ptr<GpuServiceInternal> gpu_service_internal_; | 66 std::unique_ptr<GpuService> gpu_service_; |
67 | 67 |
68 // The message-pipe used by the DisplayCompositor to request gpu memory | 68 // The message-pipe used by the DisplayCompositor to request gpu memory |
69 // buffers. | 69 // buffers. |
70 mojom::GpuServiceInternalPtr gpu_internal_; | 70 mojom::GpuServicePtr gpu_internal_; |
71 | 71 |
72 // The InCommandCommandBuffer::Service used by the display compositor. | 72 // The InCommandCommandBuffer::Service used by the display compositor. |
73 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_; | 73 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_; |
74 | 74 |
75 // If the gpu service is not yet ready then we stash pending MessagePipes in | 75 // If the gpu service is not yet ready then we stash pending MessagePipes in |
76 // these member variables. | 76 // these member variables. |
77 cc::mojom::DisplayCompositorRequest pending_display_compositor_request_; | 77 cc::mojom::DisplayCompositorRequest pending_display_compositor_request_; |
78 cc::mojom::DisplayCompositorClientPtrInfo | 78 cc::mojom::DisplayCompositorClientPtrInfo |
79 pending_display_compositor_client_info_; | 79 pending_display_compositor_client_info_; |
80 | 80 |
(...skipping 15 matching lines...) Expand all Loading... |
96 base::Thread compositor_thread_; | 96 base::Thread compositor_thread_; |
97 | 97 |
98 mojo::Binding<mojom::GpuMain> binding_; | 98 mojo::Binding<mojom::GpuMain> binding_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(GpuMain); | 100 DISALLOW_COPY_AND_ASSIGN(GpuMain); |
101 }; | 101 }; |
102 | 102 |
103 } // namespace ui | 103 } // namespace ui |
104 | 104 |
105 #endif // SERVICES_UI_GPU_GPU_MAIN_H_ | 105 #endif // SERVICES_UI_GPU_GPU_MAIN_H_ |
OLD | NEW |