| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 public base::NonThreadSafe { | 46 public base::NonThreadSafe { |
| 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, | 50 gpu::GpuMemoryBufferFactory* memory_buffer_factory, |
| 51 scoped_refptr<base::SingleThreadTaskRunner> io_runner); | 51 scoped_refptr<base::SingleThreadTaskRunner> io_runner); |
| 52 | 52 |
| 53 ~GpuService() override; | 53 ~GpuService() override; |
| 54 | 54 |
| 55 void InitializeWithHost(mojom::GpuHostPtr gpu_host, | 55 void InitializeWithHost(mojom::GpuHostPtr gpu_host, |
| 56 const gpu::GpuPreferences& preferences); | 56 const gpu::GpuPreferences& preferences, |
| 57 gpu::SyncPointManager* sync_point_manager = nullptr, |
| 58 base::WaitableEvent* shutdown_event = nullptr); |
| 57 void Bind(mojom::GpuServiceRequest request); | 59 void Bind(mojom::GpuServiceRequest request); |
| 58 | 60 |
| 59 media::MediaGpuChannelManager* media_gpu_channel_manager() { | 61 media::MediaGpuChannelManager* media_gpu_channel_manager() { |
| 60 return media_gpu_channel_manager_.get(); | 62 return media_gpu_channel_manager_.get(); |
| 61 } | 63 } |
| 62 | 64 |
| 63 gpu::GpuChannelManager* gpu_channel_manager() { | 65 gpu::GpuChannelManager* gpu_channel_manager() { |
| 64 return gpu_channel_manager_.get(); | 66 return gpu_channel_manager_.get(); |
| 65 } | 67 } |
| 66 | 68 |
| 69 gpu::GpuWatchdogThread* watchdog_thread() { return watchdog_thread_.get(); } |
| 70 |
| 67 private: | 71 private: |
| 68 friend class GpuMain; | 72 friend class GpuMain; |
| 69 | 73 |
| 70 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( | 74 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( |
| 71 gfx::GpuMemoryBufferHandle buffer_handle, | 75 gfx::GpuMemoryBufferHandle buffer_handle, |
| 72 gfx::GpuMemoryBufferId id, | 76 gfx::GpuMemoryBufferId id, |
| 73 const gfx::Size& size, | 77 const gfx::Size& size, |
| 74 gfx::BufferFormat format, | 78 gfx::BufferFormat format, |
| 75 int client_id); | 79 int client_id); |
| 76 | 80 |
| 77 gpu::SyncPointManager* sync_point_manager() { | 81 gpu::SyncPointManager* sync_point_manager() { return sync_point_manager_; } |
| 78 return owned_sync_point_manager_.get(); | |
| 79 } | |
| 80 | 82 |
| 81 gpu::gles2::MailboxManager* mailbox_manager() { | 83 gpu::gles2::MailboxManager* mailbox_manager() { |
| 82 return gpu_channel_manager_->mailbox_manager(); | 84 return gpu_channel_manager_->mailbox_manager(); |
| 83 } | 85 } |
| 84 | 86 |
| 85 gl::GLShareGroup* share_group() { | 87 gl::GLShareGroup* share_group() { |
| 86 return gpu_channel_manager_->share_group(); | 88 return gpu_channel_manager_->share_group(); |
| 87 } | 89 } |
| 88 | 90 |
| 89 const gpu::GPUInfo& gpu_info() const { return gpu_info_; } | 91 const gpu::GPUInfo& gpu_info() const { return gpu_info_; } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; | 133 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; |
| 132 | 134 |
| 133 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; | 135 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; |
| 134 | 136 |
| 135 gpu::GpuPreferences gpu_preferences_; | 137 gpu::GpuPreferences gpu_preferences_; |
| 136 | 138 |
| 137 // Information about the GPU, such as device and vendor ID. | 139 // Information about the GPU, such as device and vendor ID. |
| 138 gpu::GPUInfo gpu_info_; | 140 gpu::GPUInfo gpu_info_; |
| 139 | 141 |
| 140 mojom::GpuHostPtr gpu_host_; | 142 mojom::GpuHostPtr gpu_host_; |
| 141 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; | |
| 142 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; | 143 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; |
| 143 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; | 144 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; |
| 145 |
| 146 // On some platforms (e.g. android webview), the SyncPointManager comes from |
| 147 // external sources. |
| 148 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
| 149 gpu::SyncPointManager* sync_point_manager_ = nullptr; |
| 150 |
| 144 mojo::BindingSet<mojom::GpuService> bindings_; | 151 mojo::BindingSet<mojom::GpuService> bindings_; |
| 145 | 152 |
| 146 DISALLOW_COPY_AND_ASSIGN(GpuService); | 153 DISALLOW_COPY_AND_ASSIGN(GpuService); |
| 147 }; | 154 }; |
| 148 | 155 |
| 149 } // namespace ui | 156 } // namespace ui |
| 150 | 157 |
| 151 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ | 158 #endif // SERVICES_UI_GPU_GPU_SERVICE_H_ |
| OLD | NEW |