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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { | 100 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { |
101 bool msg_is_ok = true; | 101 bool msg_is_ok = true; |
102 bool handled = true; | 102 bool handled = true; |
103 IPC_BEGIN_MESSAGE_MAP_EX(GpuChildThread, msg, msg_is_ok) | 103 IPC_BEGIN_MESSAGE_MAP_EX(GpuChildThread, msg, msg_is_ok) |
104 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) | 104 IPC_MESSAGE_HANDLER(GpuMsg_Initialize, OnInitialize) |
105 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) | 105 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) |
106 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, | 106 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats, |
107 OnGetVideoMemoryUsageStats) | 107 OnGetVideoMemoryUsageStats) |
108 IPC_MESSAGE_HANDLER(GpuMsg_SetVideoMemoryWindowCount, | |
109 OnSetVideoMemoryWindowCount) | |
110 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) | 108 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) |
111 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) | 109 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) |
112 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) | 110 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) |
113 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) | 111 IPC_MESSAGE_HANDLER(GpuMsg_DisableWatchdog, OnDisableWatchdog) |
114 IPC_MESSAGE_UNHANDLED(handled = false) | 112 IPC_MESSAGE_UNHANDLED(handled = false) |
115 IPC_END_MESSAGE_MAP_EX() | 113 IPC_END_MESSAGE_MAP_EX() |
116 | 114 |
117 if (handled) | 115 if (handled) |
118 return true; | 116 return true; |
119 | 117 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 196 } |
199 | 197 |
200 void GpuChildThread::OnGetVideoMemoryUsageStats() { | 198 void GpuChildThread::OnGetVideoMemoryUsageStats() { |
201 GPUVideoMemoryUsageStats video_memory_usage_stats; | 199 GPUVideoMemoryUsageStats video_memory_usage_stats; |
202 if (gpu_channel_manager_.get()) | 200 if (gpu_channel_manager_.get()) |
203 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( | 201 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( |
204 &video_memory_usage_stats); | 202 &video_memory_usage_stats); |
205 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); | 203 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); |
206 } | 204 } |
207 | 205 |
208 void GpuChildThread::OnSetVideoMemoryWindowCount(uint32 window_count) { | |
209 if (gpu_channel_manager_.get()) | |
210 gpu_channel_manager_->gpu_memory_manager()->SetWindowCount(window_count); | |
211 } | |
212 | |
213 void GpuChildThread::OnClean() { | 206 void GpuChildThread::OnClean() { |
214 VLOG(1) << "GPU: Removing all contexts"; | 207 VLOG(1) << "GPU: Removing all contexts"; |
215 if (gpu_channel_manager_.get()) | 208 if (gpu_channel_manager_.get()) |
216 gpu_channel_manager_->LoseAllContexts(); | 209 gpu_channel_manager_->LoseAllContexts(); |
217 } | 210 } |
218 | 211 |
219 void GpuChildThread::OnCrash() { | 212 void GpuChildThread::OnCrash() { |
220 VLOG(1) << "GPU: Simulating GPU crash"; | 213 VLOG(1) << "GPU: Simulating GPU crash"; |
221 // Good bye, cruel world. | 214 // Good bye, cruel world. |
222 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; | 215 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; |
(...skipping 15 matching lines...) Expand all Loading... |
238 // the future posting of tasks to the message loop. | 231 // the future posting of tasks to the message loop. |
239 if (watchdog_thread_->message_loop()) | 232 if (watchdog_thread_->message_loop()) |
240 watchdog_thread_->PostAcknowledge(); | 233 watchdog_thread_->PostAcknowledge(); |
241 // Prevent rearming. | 234 // Prevent rearming. |
242 watchdog_thread_->Stop(); | 235 watchdog_thread_->Stop(); |
243 } | 236 } |
244 } | 237 } |
245 | 238 |
246 } // namespace content | 239 } // namespace content |
247 | 240 |
OLD | NEW |