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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 // initialization has succeeded. | 382 // initialization has succeeded. |
386 gpu_channel_manager_.reset( | 383 gpu_channel_manager_.reset( |
387 new GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), | 384 new GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), |
388 base::ThreadTaskRunnerHandle::Get().get(), | 385 base::ThreadTaskRunnerHandle::Get().get(), |
389 ChildProcess::current()->io_task_runner(), | 386 ChildProcess::current()->io_task_runner(), |
390 ChildProcess::current()->GetShutDownEvent(), | 387 ChildProcess::current()->GetShutDownEvent(), |
391 sync_point_manager_, gpu_memory_buffer_factory_)); | 388 sync_point_manager_, gpu_memory_buffer_factory_)); |
392 | 389 |
393 media_service_.reset(new MediaService(gpu_channel_manager_.get())); | 390 media_service_.reset(new MediaService(gpu_channel_manager_.get())); |
394 | 391 |
| 392 if (GetContentClient()->gpu()) // NULL in tests. |
| 393 GetContentClient()->gpu()->RegisterMojoServices(service_registry(), |
| 394 gpu_preferences_); |
| 395 |
395 #if defined(USE_OZONE) | 396 #if defined(USE_OZONE) |
396 ui::OzonePlatform::GetInstance() | 397 ui::OzonePlatform::GetInstance() |
397 ->GetGpuPlatformSupport() | 398 ->GetGpuPlatformSupport() |
398 ->OnChannelEstablished(this); | 399 ->OnChannelEstablished(this); |
399 #endif | 400 #endif |
400 } | 401 } |
401 | 402 |
402 void GpuChildThread::OnFinalize() { | 403 void GpuChildThread::OnFinalize() { |
403 // Quit the GPU process | 404 // Quit the GPU process |
404 base::MessageLoop::current()->QuitWhenIdle(); | 405 base::MessageLoop::current()->QuitWhenIdle(); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 562 |
562 void GpuChildThread::BindProcessControlRequest( | 563 void GpuChildThread::BindProcessControlRequest( |
563 mojo::InterfaceRequest<ProcessControl> request) { | 564 mojo::InterfaceRequest<ProcessControl> request) { |
564 DVLOG(1) << "GPU: Binding ProcessControl request"; | 565 DVLOG(1) << "GPU: Binding ProcessControl request"; |
565 DCHECK(process_control_); | 566 DCHECK(process_control_); |
566 process_control_bindings_.AddBinding(process_control_.get(), | 567 process_control_bindings_.AddBinding(process_control_.get(), |
567 std::move(request)); | 568 std::move(request)); |
568 } | 569 } |
569 | 570 |
570 } // namespace content | 571 } // namespace content |
OLD | NEW |