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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // The GPU process must never send a synchronous IPC message to the browser | 239 // The GPU process must never send a synchronous IPC message to the browser |
240 // process. This could result in deadlock. | 240 // process. This could result in deadlock. |
241 DCHECK(!msg->is_sync()); | 241 DCHECK(!msg->is_sync()); |
242 | 242 |
243 return ChildThreadImpl::Send(msg); | 243 return ChildThreadImpl::Send(msg); |
244 } | 244 } |
245 | 245 |
246 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { | 246 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { |
247 bool handled = true; | 247 bool handled = true; |
248 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) | 248 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) |
249 IPC_MESSAGE_HANDLER(GpuMsg_Finalize, OnFinalize) | |
250 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) | 249 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) |
251 IPC_MESSAGE_HANDLER(GpuMsg_GpuSwitched, OnGpuSwitched) | 250 IPC_MESSAGE_HANDLER(GpuMsg_GpuSwitched, OnGpuSwitched) |
252 IPC_MESSAGE_UNHANDLED(handled = false) | 251 IPC_MESSAGE_UNHANDLED(handled = false) |
253 IPC_END_MESSAGE_MAP() | 252 IPC_END_MESSAGE_MAP() |
254 | 253 |
255 return handled; | 254 return handled; |
256 } | 255 } |
257 | 256 |
258 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { | 257 bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) { |
259 if (ChildThreadImpl::OnMessageReceived(msg)) | 258 if (ChildThreadImpl::OnMessageReceived(msg)) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 339 |
341 GetInterfaceRegistry()->ResumeBinding(); | 340 GetInterfaceRegistry()->ResumeBinding(); |
342 } | 341 } |
343 | 342 |
344 void GpuChildThread::CreateDisplayCompositor( | 343 void GpuChildThread::CreateDisplayCompositor( |
345 cc::mojom::DisplayCompositorRequest request, | 344 cc::mojom::DisplayCompositorRequest request, |
346 cc::mojom::DisplayCompositorClientPtr client) { | 345 cc::mojom::DisplayCompositorClientPtr client) { |
347 NOTREACHED(); | 346 NOTREACHED(); |
348 } | 347 } |
349 | 348 |
350 void GpuChildThread::OnFinalize() { | |
351 // Quit the GPU process | |
352 base::MessageLoop::current()->QuitWhenIdle(); | |
353 } | |
354 | |
355 void GpuChildThread::OnCollectGraphicsInfo() { | 349 void GpuChildThread::OnCollectGraphicsInfo() { |
356 if (dead_on_arrival_) | 350 if (dead_on_arrival_) |
357 return; | 351 return; |
358 | 352 |
359 #if defined(OS_MACOSX) | 353 #if defined(OS_MACOSX) |
360 // gpu::CollectContextGraphicsInfo() is already called during gpu process | 354 // gpu::CollectContextGraphicsInfo() is already called during gpu process |
361 // initialization (see GpuInit::InitializeAndStartSandbox()) on non-mac | 355 // initialization (see GpuInit::InitializeAndStartSandbox()) on non-mac |
362 // platforms, and during in-browser gpu thread initialization on all platforms | 356 // platforms, and during in-browser gpu thread initialization on all platforms |
363 // (See InProcessGpuThread::Init()). | 357 // (See InProcessGpuThread::Init()). |
364 if (!in_browser_process_) { | 358 if (!in_browser_process_) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 417 |
424 void GpuChildThread::BindServiceFactoryRequest( | 418 void GpuChildThread::BindServiceFactoryRequest( |
425 service_manager::mojom::ServiceFactoryRequest request) { | 419 service_manager::mojom::ServiceFactoryRequest request) { |
426 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; | 420 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; |
427 DCHECK(service_factory_); | 421 DCHECK(service_factory_); |
428 service_factory_bindings_.AddBinding(service_factory_.get(), | 422 service_factory_bindings_.AddBinding(service_factory_.get(), |
429 std::move(request)); | 423 std::move(request)); |
430 } | 424 } |
431 | 425 |
432 } // namespace content | 426 } // namespace content |
OLD | NEW |