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_GetVideoMemoryUsageStats, |
| 102 OnGetVideoMemoryUsageStats) |
101 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) | 103 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) |
102 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) | 104 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) |
103 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) | 105 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) |
104 IPC_MESSAGE_UNHANDLED(handled = false) | 106 IPC_MESSAGE_UNHANDLED(handled = false) |
105 IPC_END_MESSAGE_MAP_EX() | 107 IPC_END_MESSAGE_MAP_EX() |
106 | 108 |
107 if (handled) | 109 if (handled) |
108 return true; | 110 return true; |
109 | 111 |
110 return gpu_channel_manager_.get() && | 112 return gpu_channel_manager_.get() && |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // collected. | 211 // collected. |
210 collecting_dx_diagnostics_ = false; | 212 collecting_dx_diagnostics_ = false; |
211 gpu_info_.finalized = true; | 213 gpu_info_.finalized = true; |
212 } | 214 } |
213 } | 215 } |
214 #endif | 216 #endif |
215 } | 217 } |
216 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); | 218 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); |
217 } | 219 } |
218 | 220 |
| 221 void GpuChildThread::OnGetVideoMemoryUsageStats() { |
| 222 content::GPUVideoMemoryUsageStats video_memory_usage_stats; |
| 223 if (gpu_channel_manager_.get()) |
| 224 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( |
| 225 video_memory_usage_stats); |
| 226 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_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 |