Chromium Code Reviews| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 #endif | 153 #endif |
| 154 } | 154 } |
| 155 | 155 |
| 156 void GpuChildThread::StopWatchdog() { | 156 void GpuChildThread::StopWatchdog() { |
| 157 if (watchdog_thread_.get()) { | 157 if (watchdog_thread_.get()) { |
| 158 watchdog_thread_->Stop(); | 158 watchdog_thread_->Stop(); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 void GpuChildThread::OnCollectGraphicsInfo() { | 162 void GpuChildThread::OnCollectGraphicsInfo() { |
| 163 #if defined(OS_WIN) | |
| 164 // GPU full info collection should only happen on un-sandboxed GPU process | |
| 165 // or single process/in-process gpu mode on Windows. | |
| 163 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 166 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 164 if (command_line->HasSwitch(switches::kDisableGpuSandbox) || | 167 DCHECK(command_line->HasSwitch(switches::kDisableGpuSandbox) || |
| 165 command_line->ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || | 168 command_line->HasSwitch(switches::kSingleProcess) || |
| 166 command_line->ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) { | 169 command_line->HasSwitch(switches::kInProcessGPU)); |
| 167 // GPU full info collection should only happen on un-sandboxed GPU process | 170 #endif // OS_WIN |
| 168 // or single process/in-process gpu mode. | |
| 169 | 171 |
| 170 if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info_)) | 172 // Sandbox state is not part of the gpu info collection. It is determined |
| 171 VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed"; | 173 // in GpuMain() and passed down to GpuChildThread. |
| 172 GetContentClient()->SetGpuInfo(gpu_info_); | 174 bool sandboxed = gpu_info_.sandboxed; |
| 175 if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info_)) | |
| 176 VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed"; | |
| 177 gpu_info_.sandboxed = sandboxed; | |
|
apatrick_chromium
2012/12/05 23:31:08
Do any of the implementations of CollectGraphicsIn
Zhenyao Mo
2012/12/05 23:34:11
CollectGraphicsInfo always reset GPUInfo, so sandb
| |
| 178 GetContentClient()->SetGpuInfo(gpu_info_); | |
| 173 | 179 |
| 174 #if defined(OS_WIN) | 180 #if defined(OS_WIN) |
| 175 if (!collecting_dx_diagnostics_) { | 181 if (!collecting_dx_diagnostics_) { |
| 176 // Prevent concurrent collection of DirectX diagnostics. | 182 // Prevent concurrent collection of DirectX diagnostics. |
| 177 collecting_dx_diagnostics_ = true; | 183 collecting_dx_diagnostics_ = true; |
| 178 | 184 |
| 179 // Asynchronously collect the DirectX diagnostics because this can take a | 185 // Asynchronously collect the DirectX diagnostics because this can take a |
| 180 // couple of seconds. | 186 // couple of seconds. |
| 181 if (!base::WorkerPool::PostTask( | 187 if (!base::WorkerPool::PostTask( |
| 182 FROM_HERE, base::Bind(&GpuChildThread::CollectDxDiagnostics, this), | 188 FROM_HERE, base::Bind(&GpuChildThread::CollectDxDiagnostics, this), |
| 183 true)) { | 189 true)) { |
| 184 // Flag GPU info as complete if the DirectX diagnostics cannot be | 190 // Flag GPU info as complete if the DirectX diagnostics cannot be |
| 185 // collected. | 191 // collected. |
| 186 collecting_dx_diagnostics_ = false; | 192 collecting_dx_diagnostics_ = false; |
| 187 gpu_info_.finalized = true; | 193 gpu_info_.finalized = true; |
| 188 } | |
| 189 } | 194 } |
| 190 #endif | |
| 191 } | 195 } |
| 196 #endif // OS_WIN | |
| 192 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); | 197 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); |
| 193 } | 198 } |
| 194 | 199 |
| 195 void GpuChildThread::OnGetVideoMemoryUsageStats() { | 200 void GpuChildThread::OnGetVideoMemoryUsageStats() { |
| 196 GPUVideoMemoryUsageStats video_memory_usage_stats; | 201 GPUVideoMemoryUsageStats video_memory_usage_stats; |
| 197 if (gpu_channel_manager_.get()) | 202 if (gpu_channel_manager_.get()) |
| 198 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( | 203 gpu_channel_manager_->gpu_memory_manager()->GetVideoMemoryUsageStats( |
| 199 video_memory_usage_stats); | 204 video_memory_usage_stats); |
| 200 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); | 205 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats)); |
| 201 } | 206 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 thread->gpu_info_.dx_diagnostics = node; | 261 thread->gpu_info_.dx_diagnostics = node; |
| 257 thread->gpu_info_.finalized = true; | 262 thread->gpu_info_.finalized = true; |
| 258 thread->collecting_dx_diagnostics_ = false; | 263 thread->collecting_dx_diagnostics_ = false; |
| 259 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); | 264 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); |
| 260 } | 265 } |
| 261 | 266 |
| 262 #endif | 267 #endif |
| 263 | 268 |
| 264 } // namespace content | 269 } // namespace content |
| 265 | 270 |
| OLD | NEW |