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/power_monitor/power_monitor.h" | 8 #include "base/power_monitor/power_monitor.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "gpu/ipc/in_process_command_buffer.h" | 10 #include "gpu/ipc/in_process_command_buffer.h" |
11 #include "gpu/ipc/service/gpu_init.h" | 11 #include "gpu/ipc/service/gpu_init.h" |
| 12 #include "mojo/public/cpp/bindings/binding.h" |
12 #include "services/ui/gpu/interfaces/gpu_main.mojom.h" | 13 #include "services/ui/gpu/interfaces/gpu_main.mojom.h" |
13 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" | 14 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
14 #include "services/ui/surfaces/display_provider.h" | |
15 #include "services/ui/surfaces/mojo_frame_sink_manager.h" | |
16 | 15 |
17 namespace gpu { | 16 namespace gpu { |
18 class GpuMemoryBufferFactory; | 17 class GpuMemoryBufferFactory; |
19 class ImageFactory; | 18 class ImageFactory; |
20 } | 19 } |
21 | 20 |
| 21 namespace viz { |
| 22 class DisplayProvider; |
| 23 class MojoFrameSinkManager; |
| 24 } |
| 25 |
22 namespace ui { | 26 namespace ui { |
23 | 27 |
24 class GpuService; | 28 class GpuService; |
25 | 29 |
26 class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain { | 30 class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain { |
27 public: | 31 public: |
28 explicit GpuMain(mojom::GpuMainRequest request); | 32 explicit GpuMain(mojom::GpuMainRequest request); |
29 ~GpuMain() override; | 33 ~GpuMain() override; |
30 | 34 |
31 // mojom::GpuMain implementation: | 35 // mojom::GpuMain implementation: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // The InCommandCommandBuffer::Service used by the frame sink manager. | 82 // The InCommandCommandBuffer::Service used by the frame sink manager. |
79 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_; | 83 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_; |
80 | 84 |
81 // If the gpu service is not yet ready then we stash pending MessagePipes in | 85 // If the gpu service is not yet ready then we stash pending MessagePipes in |
82 // these member variables. | 86 // these member variables. |
83 cc::mojom::FrameSinkManagerRequest pending_frame_sink_manager_request_; | 87 cc::mojom::FrameSinkManagerRequest pending_frame_sink_manager_request_; |
84 cc::mojom::FrameSinkManagerClientPtrInfo | 88 cc::mojom::FrameSinkManagerClientPtrInfo |
85 pending_frame_sink_manager_client_info_; | 89 pending_frame_sink_manager_client_info_; |
86 | 90 |
87 // Provides mojo interfaces for creating and managing FrameSinks. | 91 // Provides mojo interfaces for creating and managing FrameSinks. |
88 std::unique_ptr<MojoFrameSinkManager> frame_sink_manager_; | 92 std::unique_ptr<viz::MojoFrameSinkManager> frame_sink_manager_; |
89 std::unique_ptr<DisplayProvider> display_provider_; | 93 std::unique_ptr<viz::DisplayProvider> display_provider_; |
90 | 94 |
91 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; | 95 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
92 | 96 |
93 // The main thread for Gpu. | 97 // The main thread for Gpu. |
94 base::Thread gpu_thread_; | 98 base::Thread gpu_thread_; |
95 scoped_refptr<base::SingleThreadTaskRunner> gpu_thread_task_runner_; | 99 scoped_refptr<base::SingleThreadTaskRunner> gpu_thread_task_runner_; |
96 | 100 |
97 // The thread that handles IO events for Gpu. | 101 // The thread that handles IO events for Gpu. |
98 base::Thread io_thread_; | 102 base::Thread io_thread_; |
99 | 103 |
100 // The frame sink manager gets its own thread in mus-gpu. The gpu service, | 104 // The frame sink manager gets its own thread in mus-gpu. The gpu service, |
101 // where GL commands are processed resides on its own thread. Various | 105 // where GL commands are processed resides on its own thread. Various |
102 // components of the frame sink manager such as Display, ResourceProvider, | 106 // components of the frame sink manager such as Display, ResourceProvider, |
103 // and GLRenderer block on sync tokens from other command buffers. Thus, | 107 // and GLRenderer block on sync tokens from other command buffers. Thus, |
104 // the gpu service must live on a separate thread. | 108 // the gpu service must live on a separate thread. |
105 base::Thread compositor_thread_; | 109 base::Thread compositor_thread_; |
106 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner_; | 110 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner_; |
107 | 111 |
108 base::PowerMonitor power_monitor_; | 112 base::PowerMonitor power_monitor_; |
109 mojo::Binding<mojom::GpuMain> binding_; | 113 mojo::Binding<mojom::GpuMain> binding_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(GpuMain); | 115 DISALLOW_COPY_AND_ASSIGN(GpuMain); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace ui | 118 } // namespace ui |
115 | 119 |
116 #endif // SERVICES_UI_GPU_GPU_MAIN_H_ | 120 #endif // SERVICES_UI_GPU_GPU_MAIN_H_ |
OLD | NEW |