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

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

Issue 6370013: Revert 72704 - Defered collect DirectX diagnostics until they are needed for ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
98 // Record initialization only after collecting the GPU info because that can 110 // Record initialization only after collecting the GPU info because that can
99 // take a significant amount of time. 111 // take a significant amount of time.
100 gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time_); 112 gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time_);
101 113
102 // Note that kNoSandbox will also disable the GPU sandbox. 114 // Note that kNoSandbox will also disable the GPU sandbox.
103 bool no_gpu_sandbox = CommandLine::ForCurrentProcess()->HasSwitch( 115 bool no_gpu_sandbox = CommandLine::ForCurrentProcess()->HasSwitch(
104 switches::kNoGpuSandbox); 116 switches::kNoGpuSandbox);
105 if (!no_gpu_sandbox) { 117 if (!no_gpu_sandbox) {
106 if (!InitializeGpuSandbox()) { 118 if (!InitializeGpuSandbox()) {
107 LOG(ERROR) << "Failed to initialize the GPU sandbox"; 119 LOG(ERROR) << "Failed to initialize the GPU sandbox";
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 gpu_channels_.erase(iter); 201 gpu_channels_.erase(iter);
190 return; 202 return;
191 } 203 }
192 } 204 }
193 } 205 }
194 206
195 void GpuThread::OnSynchronize() { 207 void GpuThread::OnSynchronize() {
196 Send(new GpuHostMsg_SynchronizeReply()); 208 Send(new GpuHostMsg_SynchronizeReply());
197 } 209 }
198 210
199 void GpuThread::OnCollectGraphicsInfo(GPUInfo::Level level) { 211 void GpuThread::OnCollectGraphicsInfo() {
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
219 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); 212 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
220 } 213 }
221 214
222 #if defined(OS_MACOSX) 215 #if defined(OS_MACOSX)
223 void GpuThread::OnAcceleratedSurfaceBuffersSwappedACK( 216 void GpuThread::OnAcceleratedSurfaceBuffersSwappedACK(
224 int renderer_id, int32 route_id, uint64 swap_buffers_count) { 217 int renderer_id, int32 route_id, uint64 swap_buffers_count) {
225 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); 218 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
226 if (iter == gpu_channels_.end()) 219 if (iter == gpu_channels_.end())
227 return; 220 return;
228 scoped_refptr<GpuChannel> channel = iter->second; 221 scoped_refptr<GpuChannel> channel = iter->second;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 gpu_info_collector::GetDxDiagnostics(&node); 255 gpu_info_collector::GetDxDiagnostics(&node);
263 256
264 thread->message_loop()->PostTask( 257 thread->message_loop()->PostTask(
265 FROM_HERE, 258 FROM_HERE,
266 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); 259 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node));
267 } 260 }
268 261
269 // Runs on the GPU thread. 262 // Runs on the GPU thread.
270 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { 263 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) {
271 thread->gpu_info_.SetDxDiagnostics(node); 264 thread->gpu_info_.SetDxDiagnostics(node);
272 thread->gpu_info_.SetLevel(GPUInfo::kComplete); 265 thread->gpu_info_.SetProgress(GPUInfo::kComplete);
273 } 266 }
274 267
275 #endif 268 #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