Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: chrome/gpu/gpu_thread.cc

Issue 6364013: Defered collect DirectX diagnostics until they are needed for about:gpu.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/gpu/gpu_thread.h ('k') | chrome/test/gpu/gpu_pixel_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/gpu/gpu_thread.h" 5 #include "chrome/gpu/gpu_thread.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/gfx/gl/gl_context.h" 10 #include "app/gfx/gl/gl_context.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Load the GL implementation and locate the bindings before starting the GPU 88 // Load the GL implementation and locate the bindings before starting the GPU
89 // watchdog because this can take a lot of time and the GPU watchdog might 89 // watchdog because this can take a lot of time and the GPU watchdog might
90 // terminate the GPU process. 90 // terminate the GPU process.
91 if (!gfx::GLContext::InitializeOneOff()) { 91 if (!gfx::GLContext::InitializeOneOff()) {
92 MessageLoop::current()->Quit(); 92 MessageLoop::current()->Quit();
93 return; 93 return;
94 } 94 }
95 gpu_info_collector::CollectGraphicsInfo(&gpu_info_); 95 gpu_info_collector::CollectGraphicsInfo(&gpu_info_);
96 child_process_logging::SetGpuInfo(gpu_info_); 96 child_process_logging::SetGpuInfo(gpu_info_);
97 97
98 #if defined(OS_WIN)
99 // Asynchronously collect the DirectX diagnostics because this can take a
100 // couple of seconds.
101 if (!base::WorkerPool::PostTask(
102 FROM_HERE,
103 NewRunnableFunction(&GpuThread::CollectDxDiagnostics, this),
104 true)) {
105 // Flag GPU info as complete if the DirectX diagnostics cannot be collected.
106 gpu_info_.SetProgress(GPUInfo::kComplete);
107 }
108 #endif
109
110 // Record initialization only after collecting the GPU info because that can 98 // Record initialization only after collecting the GPU info because that can
111 // take a significant amount of time. 99 // take a significant amount of time.
112 gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time_); 100 gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time_);
113 101
114 // Note that kNoSandbox will also disable the GPU sandbox. 102 // Note that kNoSandbox will also disable the GPU sandbox.
115 bool no_gpu_sandbox = CommandLine::ForCurrentProcess()->HasSwitch( 103 bool no_gpu_sandbox = CommandLine::ForCurrentProcess()->HasSwitch(
116 switches::kNoGpuSandbox); 104 switches::kNoGpuSandbox);
117 if (!no_gpu_sandbox) { 105 if (!no_gpu_sandbox) {
118 if (!InitializeGpuSandbox()) { 106 if (!InitializeGpuSandbox()) {
119 LOG(ERROR) << "Failed to initialize the GPU sandbox"; 107 LOG(ERROR) << "Failed to initialize the GPU sandbox";
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 gpu_channels_.erase(iter); 189 gpu_channels_.erase(iter);
202 return; 190 return;
203 } 191 }
204 } 192 }
205 } 193 }
206 194
207 void GpuThread::OnSynchronize() { 195 void GpuThread::OnSynchronize() {
208 Send(new GpuHostMsg_SynchronizeReply()); 196 Send(new GpuHostMsg_SynchronizeReply());
209 } 197 }
210 198
211 void GpuThread::OnCollectGraphicsInfo() { 199 void GpuThread::OnCollectGraphicsInfo(GPUInfo::Level level) {
200 #if defined(OS_WIN)
201 if (level == GPUInfo::kComplete && gpu_info_.level() <= GPUInfo::kPartial) {
202 // Prevent concurrent collection of DirectX diagnostics.
203 gpu_info_.SetLevel(GPUInfo::kCompleting);
204
205 // Asynchronously collect the DirectX diagnostics because this can take a
206 // couple of seconds.
207 if (!base::WorkerPool::PostTask(
208 FROM_HERE,
209 NewRunnableFunction(&GpuThread::CollectDxDiagnostics, this),
210 true)) {
211
212 // Flag GPU info as complete if the DirectX diagnostics cannot be
213 // collected.
214 gpu_info_.SetLevel(GPUInfo::kComplete);
215 }
216 }
217 #endif
218
212 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); 219 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
213 } 220 }
214 221
215 #if defined(OS_MACOSX) 222 #if defined(OS_MACOSX)
216 void GpuThread::OnAcceleratedSurfaceBuffersSwappedACK( 223 void GpuThread::OnAcceleratedSurfaceBuffersSwappedACK(
217 int renderer_id, int32 route_id, uint64 swap_buffers_count) { 224 int renderer_id, int32 route_id, uint64 swap_buffers_count) {
218 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); 225 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
219 if (iter == gpu_channels_.end()) 226 if (iter == gpu_channels_.end())
220 return; 227 return;
221 scoped_refptr<GpuChannel> channel = iter->second; 228 scoped_refptr<GpuChannel> channel = iter->second;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 gpu_info_collector::GetDxDiagnostics(&node); 262 gpu_info_collector::GetDxDiagnostics(&node);
256 263
257 thread->message_loop()->PostTask( 264 thread->message_loop()->PostTask(
258 FROM_HERE, 265 FROM_HERE,
259 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); 266 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node));
260 } 267 }
261 268
262 // Runs on the GPU thread. 269 // Runs on the GPU thread.
263 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { 270 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) {
264 thread->gpu_info_.SetDxDiagnostics(node); 271 thread->gpu_info_.SetDxDiagnostics(node);
265 thread->gpu_info_.SetProgress(GPUInfo::kComplete); 272 thread->gpu_info_.SetLevel(GPUInfo::kComplete);
266 } 273 }
267 274
268 #endif 275 #endif
OLDNEW
« no previous file with comments | « chrome/gpu/gpu_thread.h ('k') | chrome/test/gpu/gpu_pixel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698