| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/gpu/gpu_child_thread.h" | 5 #include "content/gpu/gpu_child_thread.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "content/child/child_process.h" | 14 #include "content/child/child_process.h" |
| 15 #include "content/child/thread_safe_sender.h" | 15 #include "content/child/thread_safe_sender.h" |
| 16 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 16 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 17 #include "content/common/gpu/gpu_messages.h" | 17 #include "content/common/gpu/gpu_messages.h" |
| 18 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 18 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 19 #include "content/gpu/gpu_process_control_impl.h" | 19 #include "content/gpu/gpu_process_control_impl.h" |
| 20 #include "content/gpu/gpu_watchdog_thread.h" | 20 #include "content/gpu/gpu_watchdog_thread.h" |
| 21 #include "content/public/common/content_client.h" | 21 #include "content/public/common/content_client.h" |
| 22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
| 23 #include "content/public/gpu/content_gpu_client.h" |
| 23 #include "gpu/config/gpu_info_collector.h" | 24 #include "gpu/config/gpu_info_collector.h" |
| 24 #include "ipc/ipc_channel_handle.h" | 25 #include "ipc/ipc_channel_handle.h" |
| 25 #include "ipc/ipc_sync_message_filter.h" | 26 #include "ipc/ipc_sync_message_filter.h" |
| 26 #include "ui/gl/gl_implementation.h" | 27 #include "ui/gl/gl_implementation.h" |
| 27 #include "ui/gl/gpu_switching_manager.h" | 28 #include "ui/gl/gpu_switching_manager.h" |
| 28 | 29 |
| 29 #if defined(USE_OZONE) | 30 #if defined(USE_OZONE) |
| 30 #include "ui/ozone/public/gpu_platform_support.h" | 31 #include "ui/ozone/public/gpu_platform_support.h" |
| 31 #include "ui/ozone/public/ozone_platform.h" | 32 #include "ui/ozone/public/ozone_platform.h" |
| 32 #endif | 33 #endif |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 199 } |
| 199 | 200 |
| 200 void GpuChildThread::Init(const base::Time& process_start_time) { | 201 void GpuChildThread::Init(const base::Time& process_start_time) { |
| 201 process_start_time_ = process_start_time; | 202 process_start_time_ = process_start_time; |
| 202 | 203 |
| 203 process_control_.reset(new GpuProcessControlImpl()); | 204 process_control_.reset(new GpuProcessControlImpl()); |
| 204 // Use of base::Unretained(this) is safe here because |service_registry()| | 205 // Use of base::Unretained(this) is safe here because |service_registry()| |
| 205 // will be destroyed before GpuChildThread is destructed. | 206 // will be destroyed before GpuChildThread is destructed. |
| 206 service_registry()->AddService(base::Bind( | 207 service_registry()->AddService(base::Bind( |
| 207 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); | 208 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); |
| 209 |
| 210 if (GetContentClient()->gpu()) // NULL in tests. |
| 211 GetContentClient()->gpu()->RegisterMojoServices(service_registry()); |
| 208 } | 212 } |
| 209 | 213 |
| 210 bool GpuChildThread::Send(IPC::Message* msg) { | 214 bool GpuChildThread::Send(IPC::Message* msg) { |
| 211 // The GPU process must never send a synchronous IPC message to the browser | 215 // The GPU process must never send a synchronous IPC message to the browser |
| 212 // process. This could result in deadlock. | 216 // process. This could result in deadlock. |
| 213 DCHECK(!msg->is_sync()); | 217 DCHECK(!msg->is_sync()); |
| 214 | 218 |
| 215 return ChildThreadImpl::Send(msg); | 219 return ChildThreadImpl::Send(msg); |
| 216 } | 220 } |
| 217 | 221 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 399 |
| 396 void GpuChildThread::BindProcessControlRequest( | 400 void GpuChildThread::BindProcessControlRequest( |
| 397 mojo::InterfaceRequest<ProcessControl> request) { | 401 mojo::InterfaceRequest<ProcessControl> request) { |
| 398 DVLOG(1) << "GPU: Binding ProcessControl request"; | 402 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 399 DCHECK(process_control_); | 403 DCHECK(process_control_); |
| 400 process_control_bindings_.AddBinding(process_control_.get(), | 404 process_control_bindings_.AddBinding(process_control_.get(), |
| 401 std::move(request)); | 405 std::move(request)); |
| 402 } | 406 } |
| 403 | 407 |
| 404 } // namespace content | 408 } // namespace content |
| OLD | NEW |