| 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" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 | 217 |
| 218 void GpuChildThread::Init(const base::Time& process_start_time) { | 218 void GpuChildThread::Init(const base::Time& process_start_time) { |
| 219 process_start_time_ = process_start_time; | 219 process_start_time_ = process_start_time; |
| 220 | 220 |
| 221 process_control_.reset(new GpuProcessControlImpl()); | 221 process_control_.reset(new GpuProcessControlImpl()); |
| 222 // Use of base::Unretained(this) is safe here because |service_registry()| | 222 // Use of base::Unretained(this) is safe here because |service_registry()| |
| 223 // will be destroyed before GpuChildThread is destructed. | 223 // will be destroyed before GpuChildThread is destructed. |
| 224 service_registry()->AddService(base::Bind( | 224 service_registry()->AddService(base::Bind( |
| 225 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); | 225 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); |
| 226 | |
| 227 if (GetContentClient()->gpu()) // NULL in tests. | |
| 228 GetContentClient()->gpu()->RegisterMojoServices(service_registry()); | |
| 229 } | 226 } |
| 230 | 227 |
| 231 bool GpuChildThread::Send(IPC::Message* msg) { | 228 bool GpuChildThread::Send(IPC::Message* msg) { |
| 232 // The GPU process must never send a synchronous IPC message to the browser | 229 // The GPU process must never send a synchronous IPC message to the browser |
| 233 // process. This could result in deadlock. | 230 // process. This could result in deadlock. |
| 234 DCHECK(!msg->is_sync()); | 231 DCHECK(!msg->is_sync()); |
| 235 | 232 |
| 236 return ChildThreadImpl::Send(msg); | 233 return ChildThreadImpl::Send(msg); |
| 237 } | 234 } |
| 238 | 235 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // initialization has succeeded. | 394 // initialization has succeeded. |
| 398 gpu_channel_manager_.reset( | 395 gpu_channel_manager_.reset( |
| 399 new GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), | 396 new GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), |
| 400 base::ThreadTaskRunnerHandle::Get().get(), | 397 base::ThreadTaskRunnerHandle::Get().get(), |
| 401 ChildProcess::current()->io_task_runner(), | 398 ChildProcess::current()->io_task_runner(), |
| 402 ChildProcess::current()->GetShutDownEvent(), | 399 ChildProcess::current()->GetShutDownEvent(), |
| 403 sync_point_manager_, gpu_memory_buffer_factory_)); | 400 sync_point_manager_, gpu_memory_buffer_factory_)); |
| 404 | 401 |
| 405 media_service_.reset(new MediaService(gpu_channel_manager_.get())); | 402 media_service_.reset(new MediaService(gpu_channel_manager_.get())); |
| 406 | 403 |
| 404 if (GetContentClient()->gpu()) // NULL in tests. |
| 405 GetContentClient()->gpu()->RegisterMojoServices(service_registry(), |
| 406 gpu_preferences_); |
| 407 |
| 407 #if defined(USE_OZONE) | 408 #if defined(USE_OZONE) |
| 408 ui::OzonePlatform::GetInstance() | 409 ui::OzonePlatform::GetInstance() |
| 409 ->GetGpuPlatformSupport() | 410 ->GetGpuPlatformSupport() |
| 410 ->OnChannelEstablished(this); | 411 ->OnChannelEstablished(this); |
| 411 #endif | 412 #endif |
| 412 } | 413 } |
| 413 | 414 |
| 414 void GpuChildThread::OnFinalize() { | 415 void GpuChildThread::OnFinalize() { |
| 415 // Quit the GPU process | 416 // Quit the GPU process |
| 416 base::MessageLoop::current()->QuitWhenIdle(); | 417 base::MessageLoop::current()->QuitWhenIdle(); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 577 |
| 577 void GpuChildThread::BindProcessControlRequest( | 578 void GpuChildThread::BindProcessControlRequest( |
| 578 mojo::InterfaceRequest<mojom::ProcessControl> request) { | 579 mojo::InterfaceRequest<mojom::ProcessControl> request) { |
| 579 DVLOG(1) << "GPU: Binding ProcessControl request"; | 580 DVLOG(1) << "GPU: Binding ProcessControl request"; |
| 580 DCHECK(process_control_); | 581 DCHECK(process_control_); |
| 581 process_control_bindings_.AddBinding(process_control_.get(), | 582 process_control_bindings_.AddBinding(process_control_.get(), |
| 582 std::move(request)); | 583 std::move(request)); |
| 583 } | 584 } |
| 584 | 585 |
| 585 } // namespace content | 586 } // namespace content |
| OLD | NEW |