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 #include "services/ui/gpu/gpu_service_internal.h" | 5 #include "services/ui/gpu/gpu_service_internal.h" |
6 | 6 |
7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "gpu/command_buffer/service/gpu_switches.h" | 12 #include "gpu/command_buffer/service/gpu_switches.h" |
13 #include "gpu/command_buffer/service/sync_point_manager.h" | 13 #include "gpu/command_buffer/service/sync_point_manager.h" |
14 #include "gpu/config/gpu_info_collector.h" | 14 #include "gpu/config/gpu_info_collector.h" |
15 #include "gpu/config/gpu_switches.h" | 15 #include "gpu/config/gpu_switches.h" |
16 #include "gpu/config/gpu_util.h" | 16 #include "gpu/config/gpu_util.h" |
17 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 17 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
18 #include "gpu/ipc/common/memory_stats.h" | 18 #include "gpu/ipc/common/memory_stats.h" |
19 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 19 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 20 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
20 #include "ipc/ipc_channel_handle.h" | 21 #include "ipc/ipc_channel_handle.h" |
21 #include "ipc/ipc_sync_message_filter.h" | 22 #include "ipc/ipc_sync_message_filter.h" |
22 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" | 23 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" |
23 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" | 24 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" |
24 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" | 25 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" |
25 #include "media/gpu/ipc/service/media_service.h" | 26 #include "media/gpu/ipc/service/media_service.h" |
26 #include "ui/gl/gl_implementation.h" | 27 #include "ui/gl/gl_implementation.h" |
27 #include "ui/gl/gl_switches.h" | 28 #include "ui/gl/gl_switches.h" |
28 #include "ui/gl/gpu_switching_manager.h" | 29 #include "ui/gl/gpu_switching_manager.h" |
29 #include "ui/gl/init/gl_factory.h" | 30 #include "ui/gl/init/gl_factory.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 VLOG(1) << "gl::init::InitializeGLOneOff failed"; | 178 VLOG(1) << "gl::init::InitializeGLOneOff failed"; |
178 | 179 |
179 DCHECK(!owned_sync_point_manager_); | 180 DCHECK(!owned_sync_point_manager_); |
180 const bool allow_threaded_wait = false; | 181 const bool allow_threaded_wait = false; |
181 owned_sync_point_manager_.reset( | 182 owned_sync_point_manager_.reset( |
182 new gpu::SyncPointManager(allow_threaded_wait)); | 183 new gpu::SyncPointManager(allow_threaded_wait)); |
183 | 184 |
184 // Defer creation of the render thread. This is to prevent it from handling | 185 // Defer creation of the render thread. This is to prevent it from handling |
185 // IPC messages before the sandbox has been enabled and all other necessary | 186 // IPC messages before the sandbox has been enabled and all other necessary |
186 // initialization has succeeded. | 187 // initialization has succeeded. |
187 // TODO(penghuang): implement a watchdog. | 188 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); |
188 gpu::GpuWatchdog* watchdog = nullptr; | |
189 gpu_channel_manager_.reset(new gpu::GpuChannelManager( | 189 gpu_channel_manager_.reset(new gpu::GpuChannelManager( |
190 gpu_preferences_, this, watchdog, | 190 gpu_preferences_, this, watchdog_thread_.get(), |
191 base::ThreadTaskRunnerHandle::Get().get(), io_thread_.task_runner().get(), | 191 base::ThreadTaskRunnerHandle::Get().get(), io_thread_.task_runner().get(), |
192 &shutdown_event_, owned_sync_point_manager_.get(), | 192 &shutdown_event_, owned_sync_point_manager_.get(), |
193 gpu_memory_buffer_factory_.get())); | 193 gpu_memory_buffer_factory_.get())); |
194 | 194 |
195 media_service_.reset(new media::MediaService(gpu_channel_manager_.get())); | 195 media_service_.reset(new media::MediaService(gpu_channel_manager_.get())); |
196 event->Signal(); | 196 event->Signal(); |
197 } | 197 } |
198 | 198 |
199 void GpuServiceInternal::EstablishGpuChannelOnGpuThread( | 199 void GpuServiceInternal::EstablishGpuChannelOnGpuThread( |
200 int client_id, | 200 int client_id, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 allow_real_time_streams, callback); | 251 allow_real_time_streams, callback); |
252 } | 252 } |
253 | 253 |
254 // static | 254 // static |
255 GpuServiceInternal* GpuServiceInternal::GetInstance() { | 255 GpuServiceInternal* GpuServiceInternal::GetInstance() { |
256 return base::Singleton<GpuServiceInternal, | 256 return base::Singleton<GpuServiceInternal, |
257 base::LeakySingletonTraits<GpuServiceInternal>>::get(); | 257 base::LeakySingletonTraits<GpuServiceInternal>>::get(); |
258 } | 258 } |
259 | 259 |
260 } // namespace ui | 260 } // namespace ui |
OLD | NEW |