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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 void GpuChildThread::Init(const base::Time& process_start_time) { | 211 void GpuChildThread::Init(const base::Time& process_start_time) { |
212 process_start_time_ = process_start_time; | 212 process_start_time_ = process_start_time; |
213 | 213 |
214 process_control_.reset(new GpuProcessControlImpl()); | 214 process_control_.reset(new GpuProcessControlImpl()); |
215 // Use of base::Unretained(this) is safe here because |service_registry()| | 215 // Use of base::Unretained(this) is safe here because |service_registry()| |
216 // will be destroyed before GpuChildThread is destructed. | 216 // will be destroyed before GpuChildThread is destructed. |
217 service_registry()->AddService(base::Bind( | 217 service_registry()->AddService(base::Bind( |
218 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); | 218 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); |
219 | |
220 if (GetContentClient()->gpu()) // NULL in tests. | |
221 GetContentClient()->gpu()->RegisterMojoServices(service_registry()); | |
222 } | 219 } |
223 | 220 |
224 bool GpuChildThread::Send(IPC::Message* msg) { | 221 bool GpuChildThread::Send(IPC::Message* msg) { |
225 // The GPU process must never send a synchronous IPC message to the browser | 222 // The GPU process must never send a synchronous IPC message to the browser |
226 // process. This could result in deadlock. | 223 // process. This could result in deadlock. |
227 DCHECK(!msg->is_sync()); | 224 DCHECK(!msg->is_sync()); |
228 | 225 |
229 return ChildThreadImpl::Send(msg); | 226 return ChildThreadImpl::Send(msg); |
230 } | 227 } |
231 | 228 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // initialization has succeeded. | 362 // initialization has succeeded. |
366 gpu_channel_manager_.reset( | 363 gpu_channel_manager_.reset( |
367 new GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), | 364 new GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), |
368 base::ThreadTaskRunnerHandle::Get().get(), | 365 base::ThreadTaskRunnerHandle::Get().get(), |
369 ChildProcess::current()->io_task_runner(), | 366 ChildProcess::current()->io_task_runner(), |
370 ChildProcess::current()->GetShutDownEvent(), | 367 ChildProcess::current()->GetShutDownEvent(), |
371 sync_point_manager_, gpu_memory_buffer_factory_)); | 368 sync_point_manager_, gpu_memory_buffer_factory_)); |
372 | 369 |
373 media_service_.reset(new MediaService(gpu_channel_manager_.get())); | 370 media_service_.reset(new MediaService(gpu_channel_manager_.get())); |
374 | 371 |
| 372 if (GetContentClient()->gpu()) // NULL in tests. |
| 373 GetContentClient()->gpu()->RegisterMojoServices(service_registry(), |
| 374 gpu_preferences_); |
| 375 |
375 #if defined(USE_OZONE) | 376 #if defined(USE_OZONE) |
376 ui::OzonePlatform::GetInstance() | 377 ui::OzonePlatform::GetInstance() |
377 ->GetGpuPlatformSupport() | 378 ->GetGpuPlatformSupport() |
378 ->OnChannelEstablished(this); | 379 ->OnChannelEstablished(this); |
379 #endif | 380 #endif |
380 } | 381 } |
381 | 382 |
382 void GpuChildThread::OnFinalize() { | 383 void GpuChildThread::OnFinalize() { |
383 // Quit the GPU process | 384 // Quit the GPU process |
384 base::MessageLoop::current()->QuitWhenIdle(); | 385 base::MessageLoop::current()->QuitWhenIdle(); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 542 |
542 void GpuChildThread::BindProcessControlRequest( | 543 void GpuChildThread::BindProcessControlRequest( |
543 mojo::InterfaceRequest<ProcessControl> request) { | 544 mojo::InterfaceRequest<ProcessControl> request) { |
544 DVLOG(1) << "GPU: Binding ProcessControl request"; | 545 DVLOG(1) << "GPU: Binding ProcessControl request"; |
545 DCHECK(process_control_); | 546 DCHECK(process_control_); |
546 process_control_bindings_.AddBinding(process_control_.get(), | 547 process_control_bindings_.AddBinding(process_control_.get(), |
547 std::move(request)); | 548 std::move(request)); |
548 } | 549 } |
549 | 550 |
550 } // namespace content | 551 } // namespace content |
OLD | NEW |