| 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 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace ui { | 38 namespace ui { |
| 39 | 39 |
| 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 base::NonThreadSafe { | |
| 48 public: | 47 public: |
| 49 GpuService(const gpu::GPUInfo& gpu_info, | 48 GpuService(const gpu::GPUInfo& gpu_info, |
| 50 std::unique_ptr<gpu::GpuWatchdogThread> watchdog, | 49 std::unique_ptr<gpu::GpuWatchdogThread> watchdog, |
| 51 gpu::GpuMemoryBufferFactory* memory_buffer_factory, | 50 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); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void DestroyingVideoSurface( | 145 void DestroyingVideoSurface( |
| 147 int32_t surface_id, | 146 int32_t surface_id, |
| 148 const DestroyingVideoSurfaceCallback& callback) override; | 147 const DestroyingVideoSurfaceCallback& callback) override; |
| 149 void WakeUpGpu() override; | 148 void WakeUpGpu() override; |
| 150 void DestroyAllChannels() override; | 149 void DestroyAllChannels() override; |
| 151 void Crash() override; | 150 void Crash() override; |
| 152 void Hang() override; | 151 void Hang() override; |
| 153 void ThrowJavaException() override; | 152 void ThrowJavaException() override; |
| 154 void Stop(const StopCallback& callback) override; | 153 void Stop(const StopCallback& callback) override; |
| 155 | 154 |
| 155 scoped_refptr<base::SingleThreadTaskRunner> main_runner_; |
| 156 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; | 156 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; |
| 157 | 157 |
| 158 // An event that will be signalled when we shutdown. | 158 // An event that will be signalled when we shutdown. |
| 159 base::WaitableEvent shutdown_event_; | 159 base::WaitableEvent shutdown_event_; |
| 160 | 160 |
| 161 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; | 161 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; |
| 162 | 162 |
| 163 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; | 163 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; |
| 164 | 164 |
| 165 gpu::GpuPreferences gpu_preferences_; | 165 gpu::GpuPreferences gpu_preferences_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 178 // external sources. | 178 // external sources. |
| 179 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; | 179 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
| 180 gpu::SyncPointManager* sync_point_manager_ = nullptr; | 180 gpu::SyncPointManager* sync_point_manager_ = nullptr; |
| 181 | 181 |
| 182 // Whether this is running in the same process as the gpu host. | 182 // Whether this is running in the same process as the gpu host. |
| 183 bool in_host_process_ = false; | 183 bool in_host_process_ = false; |
| 184 base::Time start_time_; | 184 base::Time start_time_; |
| 185 | 185 |
| 186 mojo::BindingSet<mojom::GpuService> bindings_; | 186 mojo::BindingSet<mojom::GpuService> bindings_; |
| 187 | 187 |
| 188 base::WeakPtr<GpuService> weak_ptr_; |
| 189 base::WeakPtrFactory<GpuService> weak_ptr_factory_; |
| 190 |
| 188 DISALLOW_COPY_AND_ASSIGN(GpuService); | 191 DISALLOW_COPY_AND_ASSIGN(GpuService); |
| 189 }; | 192 }; |
| 190 | 193 |
| 191 } // namespace ui | 194 } // namespace ui |
| 192 | 195 |
| 193 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ | 196 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ |
| OLD | NEW |