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