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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 | 91 |
92 return ChildThread::Send(msg); | 92 return ChildThread::Send(msg); |
93 } | 93 } |
94 | 94 |
95 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { | 95 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { |
96 bool msg_is_ok = true; | 96 bool msg_is_ok = true; |
97 bool handled = true; | 97 bool handled = true; |
98 IPC_BEGIN_MESSAGE_MAP_EX(GpuChildThread, msg, msg_is_ok) | 98 IPC_BEGIN_MESSAGE_MAP_EX(GpuChildThread, msg, msg_is_ok) |
99 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) | 99 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) |
100 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) | 100 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) |
101 IPC_MESSAGE_HANDLER(GpuMsg_GetVidmemUsageStats, OnGetVidmemUsageStats) | |
101 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) | 102 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) |
102 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) | 103 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) |
103 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) | 104 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) |
104 IPC_MESSAGE_UNHANDLED(handled = false) | 105 IPC_MESSAGE_UNHANDLED(handled = false) |
105 IPC_END_MESSAGE_MAP_EX() | 106 IPC_END_MESSAGE_MAP_EX() |
106 | 107 |
107 if (handled) | 108 if (handled) |
108 return true; | 109 return true; |
109 | 110 |
110 return gpu_channel_manager_.get() && | 111 return gpu_channel_manager_.get() && |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 // collected. | 210 // collected. |
210 collecting_dx_diagnostics_ = false; | 211 collecting_dx_diagnostics_ = false; |
211 gpu_info_.finalized = true; | 212 gpu_info_.finalized = true; |
212 } | 213 } |
213 } | 214 } |
214 #endif | 215 #endif |
215 } | 216 } |
216 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); | 217 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); |
217 } | 218 } |
218 | 219 |
220 void GpuChildThread::OnGetVidmemUsageStats() | |
221 { | |
jam
2012/08/17 18:31:05
nit: bracket on previous line
ccameron
2012/08/17 20:52:55
Done.
| |
222 content::GPUVidmemUsageStats vidmem_usage_stats; | |
223 if (gpu_channel_manager_.get()) | |
224 gpu_channel_manager_->gpu_memory_manager()->GetVidmemUsageStats( | |
225 vidmem_usage_stats); | |
226 Send(new GpuHostMsg_VidmemUsageStats(vidmem_usage_stats)); | |
227 } | |
228 | |
219 void GpuChildThread::OnClean() { | 229 void GpuChildThread::OnClean() { |
220 VLOG(1) << "GPU: Removing all contexts"; | 230 VLOG(1) << "GPU: Removing all contexts"; |
221 if (gpu_channel_manager_.get()) | 231 if (gpu_channel_manager_.get()) |
222 gpu_channel_manager_->LoseAllContexts(); | 232 gpu_channel_manager_->LoseAllContexts(); |
223 } | 233 } |
224 | 234 |
225 void GpuChildThread::OnCrash() { | 235 void GpuChildThread::OnCrash() { |
226 VLOG(1) << "GPU: Simulating GPU crash"; | 236 VLOG(1) << "GPU: Simulating GPU crash"; |
227 // Good bye, cruel world. | 237 // Good bye, cruel world. |
228 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; | 238 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; |
(...skipping 23 matching lines...) Expand all Loading... | |
252 // Runs on the main thread. | 262 // Runs on the main thread. |
253 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, | 263 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, |
254 const content::DxDiagNode& node) { | 264 const content::DxDiagNode& node) { |
255 thread->gpu_info_.dx_diagnostics = node; | 265 thread->gpu_info_.dx_diagnostics = node; |
256 thread->gpu_info_.finalized = true; | 266 thread->gpu_info_.finalized = true; |
257 thread->collecting_dx_diagnostics_ = false; | 267 thread->collecting_dx_diagnostics_ = false; |
258 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); | 268 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); |
259 } | 269 } |
260 | 270 |
261 #endif | 271 #endif |
OLD | NEW |