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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // take a significant amount of time. | 241 // take a significant amount of time. |
242 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 242 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
243 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); | 243 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); |
244 while (!deferred_messages_.empty()) { | 244 while (!deferred_messages_.empty()) { |
245 Send(deferred_messages_.front()); | 245 Send(deferred_messages_.front()); |
246 deferred_messages_.pop(); | 246 deferred_messages_.pop(); |
247 } | 247 } |
248 | 248 |
249 if (dead_on_arrival_) { | 249 if (dead_on_arrival_) { |
250 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; | 250 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; |
251 base::MessageLoop::current()->Quit(); | 251 base::MessageLoop::current()->QuitWhenIdle(); |
252 return; | 252 return; |
253 } | 253 } |
254 | 254 |
255 #if defined(OS_ANDROID) | 255 #if defined(OS_ANDROID) |
256 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); | 256 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); |
257 #endif | 257 #endif |
258 | 258 |
259 // We don't need to pipe log messages if we are running the GPU thread in | 259 // We don't need to pipe log messages if we are running the GPU thread in |
260 // the browser process. | 260 // the browser process. |
261 if (!in_browser_process_) | 261 if (!in_browser_process_) |
(...skipping 11 matching lines...) Expand all Loading... |
273 | 273 |
274 #if defined(USE_OZONE) | 274 #if defined(USE_OZONE) |
275 ui::OzonePlatform::GetInstance() | 275 ui::OzonePlatform::GetInstance() |
276 ->GetGpuPlatformSupport() | 276 ->GetGpuPlatformSupport() |
277 ->OnChannelEstablished(this); | 277 ->OnChannelEstablished(this); |
278 #endif | 278 #endif |
279 } | 279 } |
280 | 280 |
281 void GpuChildThread::OnFinalize() { | 281 void GpuChildThread::OnFinalize() { |
282 // Quit the GPU process | 282 // Quit the GPU process |
283 base::MessageLoop::current()->Quit(); | 283 base::MessageLoop::current()->QuitWhenIdle(); |
284 } | 284 } |
285 | 285 |
286 void GpuChildThread::StopWatchdog() { | 286 void GpuChildThread::StopWatchdog() { |
287 if (watchdog_thread_.get()) { | 287 if (watchdog_thread_.get()) { |
288 watchdog_thread_->Stop(); | 288 watchdog_thread_->Stop(); |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 void GpuChildThread::OnCollectGraphicsInfo() { | 292 void GpuChildThread::OnCollectGraphicsInfo() { |
293 #if defined(OS_WIN) | 293 #if defined(OS_WIN) |
(...skipping 28 matching lines...) Expand all Loading... |
322 // so it's OK to be blocking. | 322 // so it's OK to be blocking. |
323 gpu::GetDxDiagnostics(&gpu_info_.dx_diagnostics); | 323 gpu::GetDxDiagnostics(&gpu_info_.dx_diagnostics); |
324 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoSuccess; | 324 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoSuccess; |
325 #endif // OS_WIN | 325 #endif // OS_WIN |
326 | 326 |
327 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); | 327 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); |
328 | 328 |
329 #if defined(OS_WIN) | 329 #if defined(OS_WIN) |
330 if (!in_browser_process_) { | 330 if (!in_browser_process_) { |
331 // The unsandboxed GPU process fulfilled its duty. Rest in peace. | 331 // The unsandboxed GPU process fulfilled its duty. Rest in peace. |
332 base::MessageLoop::current()->Quit(); | 332 base::MessageLoop::current()->QuitWhenIdle(); |
333 } | 333 } |
334 #endif // OS_WIN | 334 #endif // OS_WIN |
335 } | 335 } |
336 | 336 |
337 void GpuChildThread::OnGetVideoMemoryUsageStats() { | 337 void GpuChildThread::OnGetVideoMemoryUsageStats() { |
338 GPUVideoMemoryUsageStats video_memory_usage_stats; | 338 GPUVideoMemoryUsageStats video_memory_usage_stats; |
339 if (gpu_channel_manager_) | 339 if (gpu_channel_manager_) |
340 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( | 340 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( |
341 &video_memory_usage_stats); | 341 &video_memory_usage_stats); |
342 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); | 342 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 void GpuChildThread::OnGpuSwitched() { | 378 void GpuChildThread::OnGpuSwitched() { |
379 DVLOG(1) << "GPU: GPU has switched"; | 379 DVLOG(1) << "GPU: GPU has switched"; |
380 // Notify observers in the GPU process. | 380 // Notify observers in the GPU process. |
381 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); | 381 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
382 } | 382 } |
383 | 383 |
384 } // namespace content | 384 } // namespace content |
OLD | NEW |