| 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_INTERNAL_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ |
| 6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ | 6 #define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 GpuServiceInternal : public gpu::GpuChannelManagerDelegate, | 45 class GpuServiceInternal : public gpu::GpuChannelManagerDelegate, |
| 46 public mojom::GpuServiceInternal, | 46 public mojom::GpuServiceInternal, |
| 47 public base::NonThreadSafe { | 47 public base::NonThreadSafe { |
| 48 public: | 48 public: |
| 49 ~GpuServiceInternal() override; | 49 ~GpuServiceInternal() override; |
| 50 | 50 |
| 51 void Add(mojom::GpuServiceInternalRequest request); | 51 void Add(mojom::GpuServiceInternalRequest request); |
| 52 | 52 |
| 53 void DestroyDisplayCompositor(); |
| 54 |
| 53 private: | 55 private: |
| 54 friend class GpuMain; | 56 friend class GpuMain; |
| 55 | 57 |
| 56 GpuServiceInternal(const gpu::GPUInfo& gpu_info, | 58 GpuServiceInternal( |
| 57 std::unique_ptr<gpu::GpuWatchdogThread> watchdog, | 59 const gpu::GPUInfo& gpu_info, |
| 58 gpu::GpuMemoryBufferFactory* memory_buffer_factory, | 60 std::unique_ptr<gpu::GpuWatchdogThread> watchdog, |
| 59 scoped_refptr<base::SingleThreadTaskRunner> io_runner); | 61 gpu::GpuMemoryBufferFactory* memory_buffer_factory, |
| 62 scoped_refptr<base::SingleThreadTaskRunner> io_runner, |
| 63 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner); |
| 60 | 64 |
| 61 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( | 65 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle( |
| 62 gfx::GpuMemoryBufferHandle buffer_handle, | 66 gfx::GpuMemoryBufferHandle buffer_handle, |
| 63 gfx::GpuMemoryBufferId id, | 67 gfx::GpuMemoryBufferId id, |
| 64 const gfx::Size& size, | 68 const gfx::Size& size, |
| 65 gfx::BufferFormat format, | 69 gfx::BufferFormat format, |
| 66 int client_id); | 70 int client_id); |
| 67 | 71 |
| 68 // gpu::GpuChannelManagerDelegate: | 72 // gpu::GpuChannelManagerDelegate: |
| 69 void DidCreateOffscreenContext(const GURL& active_url) override; | 73 void DidCreateOffscreenContext(const GURL& active_url) override; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 const gpu::SyncToken& sync_token) override; | 106 const gpu::SyncToken& sync_token) override; |
| 103 void CreateDisplayCompositor( | 107 void CreateDisplayCompositor( |
| 104 cc::mojom::DisplayCompositorRequest request, | 108 cc::mojom::DisplayCompositorRequest request, |
| 105 cc::mojom::DisplayCompositorClientPtr client) override; | 109 cc::mojom::DisplayCompositorClientPtr client) override; |
| 106 | 110 |
| 107 void CreateDisplayCompositorOnCompositorThread( | 111 void CreateDisplayCompositorOnCompositorThread( |
| 108 mojom::GpuServiceInternalPtrInfo gpu_service_info, | 112 mojom::GpuServiceInternalPtrInfo gpu_service_info, |
| 109 cc::mojom::DisplayCompositorRequest request, | 113 cc::mojom::DisplayCompositorRequest request, |
| 110 cc::mojom::DisplayCompositorClientPtrInfo client_info); | 114 cc::mojom::DisplayCompositorClientPtrInfo client_info); |
| 111 | 115 |
| 116 void DestroyDisplayCompositorOnCompositorThread(); |
| 117 |
| 112 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; | 118 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; |
| 119 scoped_refptr<base::SingleThreadTaskRunner> compositor_runner_; |
| 113 | 120 |
| 114 // An event that will be signalled when we shutdown. | 121 // An event that will be signalled when we shutdown. |
| 115 base::WaitableEvent shutdown_event_; | 122 base::WaitableEvent shutdown_event_; |
| 116 | 123 |
| 117 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; | 124 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread_; |
| 118 | 125 |
| 119 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; | 126 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory_; |
| 120 | 127 |
| 121 gpu::GpuPreferences gpu_preferences_; | 128 gpu::GpuPreferences gpu_preferences_; |
| 122 | 129 |
| 123 // Information about the GPU, such as device and vendor ID. | 130 // Information about the GPU, such as device and vendor ID. |
| 124 gpu::GPUInfo gpu_info_; | 131 gpu::GPUInfo gpu_info_; |
| 125 | 132 |
| 126 base::Thread compositor_thread_; | 133 std::unique_ptr<ui::DisplayCompositor> display_compositor_; |
| 127 | 134 |
| 128 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_; | 135 scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_; |
| 129 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; | 136 std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_; |
| 130 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; | 137 std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_; |
| 131 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; | 138 std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_; |
| 132 mojo::BindingSet<mojom::GpuServiceInternal> bindings_; | 139 mojo::BindingSet<mojom::GpuServiceInternal> bindings_; |
| 133 | 140 |
| 134 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal); | 141 DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal); |
| 135 }; | 142 }; |
| 136 | 143 |
| 137 } // namespace ui | 144 } // namespace ui |
| 138 | 145 |
| 139 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ | 146 #endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_ |
| OLD | NEW |