| 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" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 MessageLoop::current()->Quit(); | 96 MessageLoop::current()->Quit(); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // We don't need to pipe log messages if we are running the GPU thread in | 100 // We don't need to pipe log messages if we are running the GPU thread in |
| 101 // the browser process. | 101 // the browser process. |
| 102 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) && | 102 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) && |
| 103 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) | 103 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) |
| 104 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 104 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
| 105 | 105 |
| 106 // Always set gpu info and send it back, even if there's an error and it's |
| 107 // impartially collected. |
| 106 bool succeeded = gpu_info_collector::CollectGraphicsInfo(&gpu_info_); | 108 bool succeeded = gpu_info_collector::CollectGraphicsInfo(&gpu_info_); |
| 107 | 109 content::GetContentClient()->SetGpuInfo(gpu_info_); |
| 108 if (succeeded) { | 110 LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo complete. success = " << |
| 109 content::GetContentClient()->SetGpuInfo(gpu_info_); | 111 succeeded; |
| 110 LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo complete"; | |
| 111 } | |
| 112 | 112 |
| 113 // Record initialization only after collecting the GPU info because that can | 113 // Record initialization only after collecting the GPU info because that can |
| 114 // take a significant amount of time. | 114 // take a significant amount of time. |
| 115 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; | 115 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; |
| 116 | 116 |
| 117 // In addition to disabling the watchdog if the command line switch is | 117 // In addition to disabling the watchdog if the command line switch is |
| 118 // present, disable it in two other cases. OSMesa is expected to run very | 118 // present, disable it in two other cases. OSMesa is expected to run very |
| 119 // slowly. Also disable the watchdog on valgrind because the code is expected | 119 // slowly. Also disable the watchdog on valgrind because the code is expected |
| 120 // to run slowly in that case. | 120 // to run slowly in that case. |
| 121 bool enable_watchdog = | 121 bool enable_watchdog = |
| (...skipping 28 matching lines...) Expand all Loading... |
| 150 // IPC messages before the sandbox has been enabled and all other necessary | 150 // IPC messages before the sandbox has been enabled and all other necessary |
| 151 // initialization has succeeded. | 151 // initialization has succeeded. |
| 152 gpu_channel_manager_.reset(new GpuChannelManager( | 152 gpu_channel_manager_.reset(new GpuChannelManager( |
| 153 this, | 153 this, |
| 154 watchdog_thread_, | 154 watchdog_thread_, |
| 155 ChildProcess::current()->io_message_loop_proxy(), | 155 ChildProcess::current()->io_message_loop_proxy(), |
| 156 ChildProcess::current()->GetShutDownEvent())); | 156 ChildProcess::current()->GetShutDownEvent())); |
| 157 | 157 |
| 158 // Ensure the browser process receives the GPU info before a reply to any | 158 // Ensure the browser process receives the GPU info before a reply to any |
| 159 // subsequent IPC it might send. | 159 // subsequent IPC it might send. |
| 160 if (succeeded) | 160 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); |
| 161 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); | |
| 162 } | 161 } |
| 163 | 162 |
| 164 void GpuChildThread::StopWatchdog() { | 163 void GpuChildThread::StopWatchdog() { |
| 165 if (watchdog_thread_.get()) { | 164 if (watchdog_thread_.get()) { |
| 166 watchdog_thread_->Stop(); | 165 watchdog_thread_->Stop(); |
| 167 } | 166 } |
| 168 } | 167 } |
| 169 | 168 |
| 170 void GpuChildThread::OnCollectGraphicsInfo() { | 169 void GpuChildThread::OnCollectGraphicsInfo() { |
| 171 #if defined(OS_WIN) | 170 #if defined(OS_WIN) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // Runs on the main thread. | 228 // Runs on the main thread. |
| 230 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, | 229 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, |
| 231 const content::DxDiagNode& node) { | 230 const content::DxDiagNode& node) { |
| 232 thread->gpu_info_.dx_diagnostics = node; | 231 thread->gpu_info_.dx_diagnostics = node; |
| 233 thread->gpu_info_.finalized = true; | 232 thread->gpu_info_.finalized = true; |
| 234 thread->collecting_dx_diagnostics_ = false; | 233 thread->collecting_dx_diagnostics_ = false; |
| 235 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); | 234 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); |
| 236 } | 235 } |
| 237 | 236 |
| 238 #endif | 237 #endif |
| OLD | NEW |