| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/threading/worker_pool.h" | 9 #include "base/threading/worker_pool.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 bool GpuChildThread::Send(IPC::Message* msg) { | 91 bool GpuChildThread::Send(IPC::Message* msg) { |
| 92 // The GPU process must never send a synchronous IPC message to the browser | 92 // The GPU process must never send a synchronous IPC message to the browser |
| 93 // process. This could result in deadlock. | 93 // process. This could result in deadlock. |
| 94 DCHECK(!msg->is_sync()); | 94 DCHECK(!msg->is_sync()); |
| 95 | 95 |
| 96 return ChildThread::Send(msg); | 96 return ChildThread::Send(msg); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { | 99 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 100 bool msg_is_ok = true; | |
| 101 bool handled = true; | 100 bool handled = true; |
| 102 IPC_BEGIN_MESSAGE_MAP_EX(GpuChildThread, msg, msg_is_ok) | 101 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) |
| 103 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) | 102 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) |
| 104 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) | 103 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) |
| 105 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, | 104 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, |
| 106 OnGetVideoMemoryUsageStats) | 105 OnGetVideoMemoryUsageStats) |
| 107 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) | 106 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) |
| 108 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) | 107 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) |
| 109 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) | 108 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) |
| 110 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) | 109 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) |
| 111 IPC_MESSAGE_UNHANDLED(handled = false) | 110 IPC_MESSAGE_UNHANDLED(handled = false) |
| 112 IPC_END_MESSAGE_MAP_EX() | 111 IPC_END_MESSAGE_MAP() |
| 113 | 112 |
| 114 if (handled) | 113 if (handled) |
| 115 return true; | 114 return true; |
| 116 | 115 |
| 117 return gpu_channel_manager_.get() && | 116 return gpu_channel_manager_.get() && |
| 118 gpu_channel_manager_->OnMessageReceived(msg); | 117 gpu_channel_manager_->OnMessageReceived(msg); |
| 119 } | 118 } |
| 120 | 119 |
| 121 void GpuChildThread::OnInitialize() { | 120 void GpuChildThread::OnInitialize() { |
| 122 // Record initialization only after collecting the GPU info because that can | 121 // Record initialization only after collecting the GPU info because that can |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // the future posting of tasks to the message loop. | 238 // the future posting of tasks to the message loop. |
| 240 if (watchdog_thread_->message_loop()) | 239 if (watchdog_thread_->message_loop()) |
| 241 watchdog_thread_->PostAcknowledge(); | 240 watchdog_thread_->PostAcknowledge(); |
| 242 // Prevent rearming. | 241 // Prevent rearming. |
| 243 watchdog_thread_->Stop(); | 242 watchdog_thread_->Stop(); |
| 244 } | 243 } |
| 245 } | 244 } |
| 246 | 245 |
| 247 } // namespace content | 246 } // namespace content |
| 248 | 247 |
| OLD | NEW |