| 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/gpu/gpu_process_control_impl.h" | 18 #include "content/gpu/gpu_process_control_impl.h" |
| 19 #include "content/gpu/gpu_watchdog_thread.h" | 19 #include "content/gpu/gpu_watchdog_thread.h" |
| 20 #include "content/public/common/content_client.h" | 20 #include "content/public/common/content_client.h" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/gpu/content_gpu_client.h" |
| 22 #include "gpu/config/gpu_info_collector.h" | 23 #include "gpu/config/gpu_info_collector.h" |
| 23 #include "ipc/ipc_channel_handle.h" | 24 #include "ipc/ipc_channel_handle.h" |
| 24 #include "ipc/ipc_sync_message_filter.h" | 25 #include "ipc/ipc_sync_message_filter.h" |
| 25 #include "ui/gl/gl_implementation.h" | 26 #include "ui/gl/gl_implementation.h" |
| 26 #include "ui/gl/gpu_switching_manager.h" | 27 #include "ui/gl/gpu_switching_manager.h" |
| 27 | 28 |
| 28 #if defined(USE_OZONE) | 29 #if defined(USE_OZONE) |
| 29 #include "ui/ozone/public/gpu_platform_support.h" | 30 #include "ui/ozone/public/gpu_platform_support.h" |
| 30 #include "ui/ozone/public/ozone_platform.h" | 31 #include "ui/ozone/public/ozone_platform.h" |
| 31 #endif | 32 #endif |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 193 } |
| 193 | 194 |
| 194 void GpuChildThread::Init(const base::Time& process_start_time) { | 195 void GpuChildThread::Init(const base::Time& process_start_time) { |
| 195 process_start_time_ = process_start_time; | 196 process_start_time_ = process_start_time; |
| 196 | 197 |
| 197 process_control_.reset(new GpuProcessControlImpl()); | 198 process_control_.reset(new GpuProcessControlImpl()); |
| 198 // Use of base::Unretained(this) is safe here because |service_registry()| | 199 // Use of base::Unretained(this) is safe here because |service_registry()| |
| 199 // will be destroyed before GpuChildThread is destructed. | 200 // will be destroyed before GpuChildThread is destructed. |
| 200 service_registry()->AddService(base::Bind( | 201 service_registry()->AddService(base::Bind( |
| 201 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); | 202 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); |
| 203 |
| 204 GetContentClient()->gpu()->RegisterMojoServices(service_registry()); |
| 202 } | 205 } |
| 203 | 206 |
| 204 bool GpuChildThread::Send(IPC::Message* msg) { | 207 bool GpuChildThread::Send(IPC::Message* msg) { |
| 205 // The GPU process must never send a synchronous IPC message to the browser | 208 // The GPU process must never send a synchronous IPC message to the browser |
| 206 // process. This could result in deadlock. | 209 // process. This could result in deadlock. |
| 207 DCHECK(!msg->is_sync()); | 210 DCHECK(!msg->is_sync()); |
| 208 | 211 |
| 209 return ChildThreadImpl::Send(msg); | 212 return ChildThreadImpl::Send(msg); |
| 210 } | 213 } |
| 211 | 214 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 396 |
| 394 void GpuChildThread::BindProcessControlRequest( | 397 void GpuChildThread::BindProcessControlRequest( |
| 395 mojo::InterfaceRequest<ProcessControl> request) { | 398 mojo::InterfaceRequest<ProcessControl> request) { |
| 396 DVLOG(1) << "GPU: Binding ProcessControl request"; | 399 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 397 DCHECK(process_control_); | 400 DCHECK(process_control_); |
| 398 process_control_bindings_.AddBinding(process_control_.get(), | 401 process_control_bindings_.AddBinding(process_control_.get(), |
| 399 std::move(request)); | 402 std::move(request)); |
| 400 } | 403 } |
| 401 | 404 |
| 402 } // namespace content | 405 } // namespace content |
| OLD | NEW |