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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 #endif // OS_WIN | 191 #endif // OS_WIN |
192 | 192 |
193 gpu::CollectInfoResult result = | 193 gpu::CollectInfoResult result = |
194 gpu::CollectContextGraphicsInfo(&gpu_info_); | 194 gpu::CollectContextGraphicsInfo(&gpu_info_); |
195 switch (result) { | 195 switch (result) { |
196 case gpu::kCollectInfoFatalFailure: | 196 case gpu::kCollectInfoFatalFailure: |
197 LOG(ERROR) << "gpu::CollectGraphicsInfo failed (fatal)."; | 197 LOG(ERROR) << "gpu::CollectGraphicsInfo failed (fatal)."; |
198 // TODO(piman): can we signal overall failure? | 198 // TODO(piman): can we signal overall failure? |
199 break; | 199 break; |
200 case gpu::kCollectInfoNonFatalFailure: | 200 case gpu::kCollectInfoNonFatalFailure: |
201 VLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal)."; | 201 DVLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal)."; |
202 break; | 202 break; |
203 case gpu::kCollectInfoNone: | 203 case gpu::kCollectInfoNone: |
204 NOTREACHED(); | 204 NOTREACHED(); |
205 break; | 205 break; |
206 case gpu::kCollectInfoSuccess: | 206 case gpu::kCollectInfoSuccess: |
207 break; | 207 break; |
208 } | 208 } |
209 GetContentClient()->SetGpuInfo(gpu_info_); | 209 GetContentClient()->SetGpuInfo(gpu_info_); |
210 | 210 |
211 #if defined(OS_WIN) | 211 #if defined(OS_WIN) |
(...skipping 16 matching lines...) Expand all Loading... |
228 | 228 |
229 void GpuChildThread::OnGetVideoMemoryUsageStats() { | 229 void GpuChildThread::OnGetVideoMemoryUsageStats() { |
230 GPUVideoMemoryUsageStats video_memory_usage_stats; | 230 GPUVideoMemoryUsageStats video_memory_usage_stats; |
231 if (gpu_channel_manager_) | 231 if (gpu_channel_manager_) |
232 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( | 232 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( |
233 &video_memory_usage_stats); | 233 &video_memory_usage_stats); |
234 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); | 234 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); |
235 } | 235 } |
236 | 236 |
237 void GpuChildThread::OnClean() { | 237 void GpuChildThread::OnClean() { |
238 VLOG(1) << "GPU: Removing all contexts"; | 238 DVLOG(1) << "GPU: Removing all contexts"; |
239 if (gpu_channel_manager_) | 239 if (gpu_channel_manager_) |
240 gpu_channel_manager_->LoseAllContexts(); | 240 gpu_channel_manager_->LoseAllContexts(); |
241 } | 241 } |
242 | 242 |
243 void GpuChildThread::OnCrash() { | 243 void GpuChildThread::OnCrash() { |
244 VLOG(1) << "GPU: Simulating GPU crash"; | 244 DVLOG(1) << "GPU: Simulating GPU crash"; |
245 // Good bye, cruel world. | 245 // Good bye, cruel world. |
246 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; | 246 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; |
247 *it_s_the_end_of_the_world_as_we_know_it = 0xdead; | 247 *it_s_the_end_of_the_world_as_we_know_it = 0xdead; |
248 } | 248 } |
249 | 249 |
250 void GpuChildThread::OnHang() { | 250 void GpuChildThread::OnHang() { |
251 VLOG(1) << "GPU: Simulating GPU hang"; | 251 DVLOG(1) << "GPU: Simulating GPU hang"; |
252 for (;;) { | 252 for (;;) { |
253 // Do not sleep here. The GPU watchdog timer tracks the amount of user | 253 // Do not sleep here. The GPU watchdog timer tracks the amount of user |
254 // time this thread is using and it doesn't use much while calling Sleep. | 254 // time this thread is using and it doesn't use much while calling Sleep. |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 void GpuChildThread::OnDisableWatchdog() { | 258 void GpuChildThread::OnDisableWatchdog() { |
259 VLOG(1) << "GPU: Disabling watchdog thread"; | 259 DVLOG(1) << "GPU: Disabling watchdog thread"; |
260 if (watchdog_thread_.get()) { | 260 if (watchdog_thread_.get()) { |
261 // Disarm the watchdog before shutting down the message loop. This prevents | 261 // Disarm the watchdog before shutting down the message loop. This prevents |
262 // the future posting of tasks to the message loop. | 262 // the future posting of tasks to the message loop. |
263 if (watchdog_thread_->message_loop()) | 263 if (watchdog_thread_->message_loop()) |
264 watchdog_thread_->PostAcknowledge(); | 264 watchdog_thread_->PostAcknowledge(); |
265 // Prevent rearming. | 265 // Prevent rearming. |
266 watchdog_thread_->Stop(); | 266 watchdog_thread_->Stop(); |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 void GpuChildThread::OnGpuSwitched() { | 270 void GpuChildThread::OnGpuSwitched() { |
271 VLOG(1) << "GPU: GPU has switched"; | 271 DVLOG(1) << "GPU: GPU has switched"; |
272 // Notify observers in the GPU process. | 272 // Notify observers in the GPU process. |
273 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); | 273 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
274 } | 274 } |
275 | 275 |
276 } // namespace content | 276 } // namespace content |
277 | 277 |
OLD | NEW |