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_SERVICE_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_H_ |
6 #define SERVICES_UI_GPU_GPU_SERVICE_H_ | 6 #define SERVICES_UI_GPU_GPU_SERVICE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 class GpuMain; | 40 class GpuMain; |
41 | 41 |
42 // This runs in the GPU process, and communicates with the gpu host (which is | 42 // This runs in the GPU process, and communicates with the gpu host (which is |
43 // the window server) over the mojom APIs. This is responsible for setting up | 43 // the window server) over the mojom APIs. This is responsible for setting up |
44 // the connection to clients, allocating/free'ing gpu memory etc. | 44 // the connection to clients, allocating/free'ing gpu memory etc. |
45 class GpuService : public gpu::GpuChannelManagerDelegate, | 45 class GpuService : public gpu::GpuChannelManagerDelegate, |
46 public mojom::GpuService { | 46 public mojom::GpuService { |
47 public: | 47 public: |
48 GpuService(const gpu::GPUInfo& gpu_info, | 48 GpuService(const gpu::GPUInfo& gpu_info, |
49 std::unique_ptr<gpu::GpuWatchdogThread> watchdog, | 49 std::unique_ptr<gpu::GpuWatchdogThread> watchdog, |
50 gpu::GpuMemoryBufferFactory* memory_buffer_factory, | |
51 scoped_refptr<base::SingleThreadTaskRunner> io_runner, | 50 scoped_refptr<base::SingleThreadTaskRunner> io_runner, |
52 const gpu::GpuFeatureInfo& gpu_feature_info); | 51 const gpu::GpuFeatureInfo& gpu_feature_info); |
53 | 52 |
54 ~GpuService() override; | 53 ~GpuService() override; |
55 | 54 |
56 void UpdateGPUInfoFromPreferences(const gpu::GpuPreferences& preferences); | 55 void UpdateGPUInfoFromPreferences(const gpu::GpuPreferences& preferences); |
57 | 56 |
58 void InitializeWithHost(mojom::GpuHostPtr gpu_host, | 57 void InitializeWithHost(mojom::GpuHostPtr gpu_host, |
59 gpu::GpuProcessActivityFlags activity_flags, | 58 gpu::GpuProcessActivityFlags activity_flags, |
60 gpu::SyncPointManager* sync_point_manager = nullptr, | 59 gpu::SyncPointManager* sync_point_manager = nullptr, |
61 base::WaitableEvent* shutdown_event = nullptr); | 60 base::WaitableEvent* shutdown_event = nullptr); |
62 void Bind(mojom::GpuServiceRequest request); | 61 void Bind(mojom::GpuServiceRequest request); |
63 | 62 |
64 media::MediaGpuChannelManager* media_gpu_channel_manager() { | 63 media::MediaGpuChannelManager* media_gpu_channel_manager() { |
65 return media_gpu_channel_manager_.get(); | 64 return media_gpu_channel_manager_.get(); |
66 } | 65 } |
67 | 66 |
68 gpu::GpuChannelManager* gpu_channel_manager() { | 67 gpu::GpuChannelManager* gpu_channel_manager() { |
69 return gpu_channel_manager_.get(); | 68 return gpu_channel_manager_.get(); |
70 } | 69 } |
71 | 70 |
| 71 gpu::ImageFactory* gpu_image_factory(); |
| 72 |
72 gpu::GpuWatchdogThread* watchdog_thread() { return watchdog_thread_.get(); } | 73 gpu::GpuWatchdogThread* watchdog_thread() { return watchdog_thread_.get(); } |
73 | 74 |
74 const gpu::GpuFeatureInfo& gpu_feature_info() const { | 75 const gpu::GpuFeatureInfo& gpu_feature_info() const { |
75 return gpu_feature_info_; | 76 return gpu_feature_info_; |
76 } | 77 } |
77 | 78 |
78 void set_in_host_process(bool in_host_process) { | 79 void set_in_host_process(bool in_host_process) { |
79 in_host_process_ = in_host_process; | 80 in_host_process_ = in_host_process; |
80 } | 81 } |
81 | 82 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void Crash() override; | 152 void Crash() override; |
152 void Hang() override; | 153 void Hang() override; |
153 void ThrowJavaException() override; | 154 void ThrowJavaException() override; |
154 void Stop(const StopCallback& callback) override; | 155 void Stop(const StopCallback& callback) override; |
155 | 156 |
156 scoped_refptr<base::SingleThreadTaskRunner> main_runner_; | 157 scoped_refptr<base::SingleThreadTaskRunner> main_runner_; |
157 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; | 158 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; |
158 | 159 |
159 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; | 160 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; |
160 | 161 |
161 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; | 162 std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_; |
162 | 163 |
163 gpu::GpuPreferences gpu_preferences_; | 164 gpu::GpuPreferences gpu_preferences_; |
164 | 165 |
165 // Information about the GPU, such as device and vendor ID. | 166 // Information about the GPU, such as device and vendor ID. |
166 gpu::GPUInfo gpu_info_; | 167 gpu::GPUInfo gpu_info_; |
167 | 168 |
168 // Information about general chrome feature support for the GPU. | 169 // Information about general chrome feature support for the GPU. |
169 gpu::GpuFeatureInfo gpu_feature_info_; | 170 gpu::GpuFeatureInfo gpu_feature_info_; |
170 | 171 |
171 scoped_refptr<mojom::ThreadSafeGpuHostPtr> gpu_host_; | 172 scoped_refptr<mojom::ThreadSafeGpuHostPtr> gpu_host_; |
(...skipping 18 matching lines...) Expand all Loading... |
190 | 191 |
191 base::WeakPtr<GpuService> weak_ptr_; | 192 base::WeakPtr<GpuService> weak_ptr_; |
192 base::WeakPtrFactory<GpuService> weak_ptr_factory_; | 193 base::WeakPtrFactory<GpuService> weak_ptr_factory_; |
193 | 194 |
194 DISALLOW_COPY_AND_ASSIGN(GpuService); | 195 DISALLOW_COPY_AND_ASSIGN(GpuService); |
195 }; | 196 }; |
196 | 197 |
197 } // namespace ui | 198 } // namespace ui |
198 | 199 |
199 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ | 200 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ |
OLD | NEW |