| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // process. This could result in deadlock. | 231 // process. This could result in deadlock. |
| 232 DCHECK(!msg->is_sync()); | 232 DCHECK(!msg->is_sync()); |
| 233 | 233 |
| 234 return ChildThreadImpl::Send(msg); | 234 return ChildThreadImpl::Send(msg); |
| 235 } | 235 } |
| 236 | 236 |
| 237 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { | 237 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 238 bool handled = true; | 238 bool handled = true; |
| 239 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) | 239 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) |
| 240 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) | 240 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) |
| 241 IPC_MESSAGE_HANDLER(GpuMsg_Finalize, OnFinalize) | |
| 242 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) | 241 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) |
| 243 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, | 242 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, |
| 244 OnGetVideoMemoryUsageStats) | 243 OnGetVideoMemoryUsageStats) |
| 245 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) | 244 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) |
| 246 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) | 245 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) |
| 247 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) | 246 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) |
| 248 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) | 247 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) |
| 249 IPC_MESSAGE_HANDLER(GpuMsg_GpuSwitched, OnGpuSwitched) | 248 IPC_MESSAGE_HANDLER(GpuMsg_GpuSwitched, OnGpuSwitched) |
| 250 IPC_MESSAGE_UNHANDLED(handled = false) | 249 IPC_MESSAGE_UNHANDLED(handled = false) |
| 251 IPC_END_MESSAGE_MAP() | 250 IPC_END_MESSAGE_MAP() |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 if (GetContentClient()->gpu()) { // NULL in tests. | 396 if (GetContentClient()->gpu()) { // NULL in tests. |
| 398 GetContentClient()->gpu()->ExposeInterfacesToBrowser( | 397 GetContentClient()->gpu()->ExposeInterfacesToBrowser( |
| 399 GetInterfaceRegistry(), gpu_preferences_); | 398 GetInterfaceRegistry(), gpu_preferences_); |
| 400 GetContentClient()->gpu()->ConsumeInterfacesFromBrowser( | 399 GetContentClient()->gpu()->ConsumeInterfacesFromBrowser( |
| 401 GetRemoteInterfaces()); | 400 GetRemoteInterfaces()); |
| 402 } | 401 } |
| 403 | 402 |
| 404 GetInterfaceRegistry()->ResumeBinding(); | 403 GetInterfaceRegistry()->ResumeBinding(); |
| 405 } | 404 } |
| 406 | 405 |
| 407 void GpuChildThread::OnFinalize() { | |
| 408 // Quit the GPU process | |
| 409 base::MessageLoop::current()->QuitWhenIdle(); | |
| 410 } | |
| 411 | |
| 412 void GpuChildThread::StopWatchdog() { | 406 void GpuChildThread::StopWatchdog() { |
| 413 if (watchdog_thread_.get()) { | 407 if (watchdog_thread_.get()) { |
| 414 watchdog_thread_->Stop(); | 408 watchdog_thread_->Stop(); |
| 415 } | 409 } |
| 416 } | 410 } |
| 417 | 411 |
| 418 void GpuChildThread::OnCollectGraphicsInfo() { | 412 void GpuChildThread::OnCollectGraphicsInfo() { |
| 419 if (dead_on_arrival_) | 413 if (dead_on_arrival_) |
| 420 return; | 414 return; |
| 421 | 415 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 556 |
| 563 void GpuChildThread::BindServiceFactoryRequest( | 557 void GpuChildThread::BindServiceFactoryRequest( |
| 564 shell::mojom::ServiceFactoryRequest request) { | 558 shell::mojom::ServiceFactoryRequest request) { |
| 565 DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest"; | 559 DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest"; |
| 566 DCHECK(service_factory_); | 560 DCHECK(service_factory_); |
| 567 service_factory_bindings_.AddBinding(service_factory_.get(), | 561 service_factory_bindings_.AddBinding(service_factory_.get(), |
| 568 std::move(request)); | 562 std::move(request)); |
| 569 } | 563 } |
| 570 | 564 |
| 571 } // namespace content | 565 } // namespace content |
| OLD | NEW |