| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
| 13 #include "base/win/scoped_com_initializer.h" | |
| 14 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 15 #include "content/common/child_process.h" | 14 #include "content/common/child_process.h" |
| 16 #include "content/common/gpu/gpu_messages.h" | 15 #include "content/common/gpu/gpu_messages.h" |
| 17 #include "content/public/common/content_client.h" | 16 #include "content/public/common/content_client.h" |
| 18 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 19 #include "content/gpu/gpu_info_collector.h" | 18 #include "content/gpu/gpu_info_collector.h" |
| 20 #include "content/gpu/gpu_watchdog_thread.h" | 19 #include "content/gpu/gpu_watchdog_thread.h" |
| 21 #include "ipc/ipc_channel_handle.h" | 20 #include "ipc/ipc_channel_handle.h" |
| 22 #include "ui/gfx/gl/gl_implementation.h" | 21 #include "ui/gfx/gl/gl_implementation.h" |
| 23 | 22 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // Do not sleep here. The GPU watchdog timer tracks the amount of user | 209 // Do not sleep here. The GPU watchdog timer tracks the amount of user |
| 211 // time this thread is using and it doesn't use much while calling Sleep. | 210 // time this thread is using and it doesn't use much while calling Sleep. |
| 212 } | 211 } |
| 213 } | 212 } |
| 214 | 213 |
| 215 #if defined(OS_WIN) | 214 #if defined(OS_WIN) |
| 216 | 215 |
| 217 // Runs on a worker thread. The GPU process never terminates voluntarily so | 216 // Runs on a worker thread. The GPU process never terminates voluntarily so |
| 218 // it is safe to assume that its message loop is valid. | 217 // it is safe to assume that its message loop is valid. |
| 219 void GpuChildThread::CollectDxDiagnostics(GpuChildThread* thread) { | 218 void GpuChildThread::CollectDxDiagnostics(GpuChildThread* thread) { |
| 220 base::win::ScopedCOMInitializer com_initializer; | 219 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 220 switches::kDisableGpuSandbox)) { |
| 221 content::DxDiagNode node; |
| 222 gpu_info_collector::GetDxDiagnostics(&node); |
| 221 | 223 |
| 222 content::DxDiagNode node; | 224 thread->message_loop()->PostTask( |
| 223 gpu_info_collector::GetDxDiagnostics(&node); | 225 FROM_HERE, base::Bind(&GpuChildThread::SetDxDiagnostics, thread, node)); |
| 224 | 226 } |
| 225 thread->message_loop()->PostTask( | |
| 226 FROM_HERE, base::Bind(&GpuChildThread::SetDxDiagnostics, thread, node)); | |
| 227 } | 227 } |
| 228 | 228 |
| 229 // Runs on the main thread. | 229 // Runs on the main thread. |
| 230 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, | 230 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, |
| 231 const content::DxDiagNode& node) { | 231 const content::DxDiagNode& node) { |
| 232 thread->gpu_info_.dx_diagnostics = node; | 232 thread->gpu_info_.dx_diagnostics = node; |
| 233 thread->gpu_info_.finalized = true; | 233 thread->gpu_info_.finalized = true; |
| 234 thread->collecting_dx_diagnostics_ = false; | 234 thread->collecting_dx_diagnostics_ = false; |
| 235 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); | 235 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); |
| 236 } | 236 } |
| 237 | 237 |
| 238 #endif | 238 #endif |
| OLD | NEW |