| 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_MUS_H_ | 5 #ifndef SERVICES_UI_GPU_GPU_SERVICE_MUS_H_ |
| 6 #define SERVICES_UI_GPU_GPU_SERVICE_MUS_H_ | 6 #define SERVICES_UI_GPU_GPU_SERVICE_MUS_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" |
| 11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "gpu/command_buffer/service/gpu_preferences.h" | 13 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 14 #include "gpu/config/gpu_info.h" | 14 #include "gpu/config/gpu_info.h" |
| 15 #include "gpu/ipc/client/gpu_channel_host.h" | 15 #include "gpu/ipc/client/gpu_channel_host.h" |
| 16 #include "gpu/ipc/common/surface_handle.h" | 16 #include "gpu/ipc/common/surface_handle.h" |
| 17 #include "gpu/ipc/service/gpu_channel.h" | 17 #include "gpu/ipc/service/gpu_channel.h" |
| 18 #include "gpu/ipc/service/gpu_channel_manager.h" | 18 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 19 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 19 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
| 20 #include "gpu/ipc/service/gpu_config.h" | 20 #include "gpu/ipc/service/gpu_config.h" |
| 21 #include "gpu/ipc/service/x_util.h" | 21 #include "gpu/ipc/service/x_util.h" |
| 22 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 template <typename T> | 25 template <typename T> |
| 26 struct DefaultSingletonTraits; | 26 struct DefaultSingletonTraits; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace IPC { | |
| 30 struct ChannelHandle; | |
| 31 } | |
| 32 | |
| 33 namespace gpu { | 29 namespace gpu { |
| 34 class GpuChannelHost; | 30 class GpuChannelHost; |
| 35 class GpuMemoryBufferFactory; | 31 class GpuMemoryBufferFactory; |
| 36 class SyncPointManager; | 32 class SyncPointManager; |
| 37 } | 33 } |
| 38 | 34 |
| 39 namespace media { | 35 namespace media { |
| 40 class MediaService; | 36 class MediaService; |
| 41 } | 37 } |
| 42 | 38 |
| 43 namespace ui { | 39 namespace ui { |
| 44 | 40 |
| 45 class MusGpuMemoryBufferManager; | 41 class MusGpuMemoryBufferManager; |
| 46 | 42 |
| 47 // TODO(fsamuel): GpuServiceMus is intended to be the Gpu thread within Mus. | 43 // TODO(fsamuel): GpuServiceMus is intended to be the Gpu thread within Mus. |
| 48 // Similar to GpuChildThread, it is a GpuChannelManagerDelegate and will have a | 44 // Similar to GpuChildThread, it is a GpuChannelManagerDelegate and will have a |
| 49 // GpuChannelManager. | 45 // GpuChannelManager. |
| 50 class GpuServiceMus : public gpu::GpuChannelManagerDelegate, | 46 class GpuServiceMus : public gpu::GpuChannelManagerDelegate, |
| 51 public gpu::GpuChannelHostFactory, | 47 public gpu::GpuChannelHostFactory, |
| 52 public base::NonThreadSafe { | 48 public base::NonThreadSafe { |
| 53 public: | 49 public: |
| 54 typedef base::Callback<void(int client_id, const IPC::ChannelHandle&)> | 50 typedef base::Callback<void(int client_id, mojo::ScopedMessagePipeHandle)> |
| 55 EstablishGpuChannelCallback; | 51 EstablishGpuChannelCallback; |
| 56 void EstablishGpuChannel(uint64_t client_tracing_id, | 52 void EstablishGpuChannel(uint64_t client_tracing_id, |
| 57 bool preempts, | 53 bool preempts, |
| 58 bool allow_view_command_buffers, | 54 bool allow_view_command_buffers, |
| 59 bool allow_real_time_streams, | 55 bool allow_real_time_streams, |
| 60 const EstablishGpuChannelCallback& callback); | 56 const EstablishGpuChannelCallback& callback); |
| 61 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( | 57 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( |
| 62 gfx::GpuMemoryBufferId id, | 58 gfx::GpuMemoryBufferId id, |
| 63 const gfx::Size& size, | 59 const gfx::Size& size, |
| 64 gfx::BufferFormat format, | 60 gfx::BufferFormat format, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 111 |
| 116 static GpuServiceMus* GetInstance(); | 112 static GpuServiceMus* GetInstance(); |
| 117 | 113 |
| 118 private: | 114 private: |
| 119 friend struct base::DefaultSingletonTraits<GpuServiceMus>; | 115 friend struct base::DefaultSingletonTraits<GpuServiceMus>; |
| 120 | 116 |
| 121 GpuServiceMus(); | 117 GpuServiceMus(); |
| 122 ~GpuServiceMus() override; | 118 ~GpuServiceMus() override; |
| 123 | 119 |
| 124 void Initialize(); | 120 void Initialize(); |
| 125 void InitializeOnGpuThread(IPC::ChannelHandle* channel_handle, | 121 void InitializeOnGpuThread(mojo::ScopedMessagePipeHandle* channel_handle, |
| 126 base::WaitableEvent* event); | 122 base::WaitableEvent* event); |
| 127 void EstablishGpuChannelOnGpuThread(int client_id, | 123 void EstablishGpuChannelOnGpuThread( |
| 128 uint64_t client_tracing_id, | 124 int client_id, |
| 129 bool preempts, | 125 uint64_t client_tracing_id, |
| 130 bool allow_view_command_buffers, | 126 bool preempts, |
| 131 bool allow_real_time_streams, | 127 bool allow_view_command_buffers, |
| 132 IPC::ChannelHandle* channel_handle); | 128 bool allow_real_time_streams, |
| 129 mojo::ScopedMessagePipeHandle* channel_handle); |
| 133 | 130 |
| 134 // The next client id. | 131 // The next client id. |
| 135 int next_client_id_; | 132 int next_client_id_; |
| 136 | 133 |
| 137 // The main thread task runner. | 134 // The main thread task runner. |
| 138 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 135 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 139 | 136 |
| 140 // An event that will be signalled when we shutdown. | 137 // An event that will be signalled when we shutdown. |
| 141 base::WaitableEvent shutdown_event_; | 138 base::WaitableEvent shutdown_event_; |
| 142 | 139 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 164 | 161 |
| 165 // Information about the GPU, such as device and vendor ID. | 162 // Information about the GPU, such as device and vendor ID. |
| 166 gpu::GPUInfo gpu_info_; | 163 gpu::GPUInfo gpu_info_; |
| 167 | 164 |
| 168 DISALLOW_COPY_AND_ASSIGN(GpuServiceMus); | 165 DISALLOW_COPY_AND_ASSIGN(GpuServiceMus); |
| 169 }; | 166 }; |
| 170 | 167 |
| 171 } // namespace ui | 168 } // namespace ui |
| 172 | 169 |
| 173 #endif // SERVICES_UI_GPU_GPU_SERVICE_MUS_H_ | 170 #endif // SERVICES_UI_GPU_GPU_SERVICE_MUS_H_ |
| OLD | NEW |