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

Unified Diff: chrome/gpu/gpu_thread.cc

Issue 4860001: Collect DirectX diagnostic information asynchronously.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« chrome/browser/browser_about_handler.cc ('K') | « chrome/gpu/gpu_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/gpu/gpu_thread.cc
===================================================================
--- chrome/gpu/gpu_thread.cc (revision 65876)
+++ chrome/gpu/gpu_thread.cc (working copy)
@@ -9,6 +9,7 @@
#include "app/gfx/gl/gl_context.h"
#include "base/command_line.h"
+#include "base/worker_pool.h"
#include "build/build_config.h"
#include "chrome/common/child_process.h"
#include "chrome/common/child_process_logging.h"
@@ -16,6 +17,10 @@
#include "chrome/gpu/gpu_info_collector.h"
#include "ipc/ipc_channel_handle.h"
+#if defined(OS_WIN)
+#include "app/win_util.h"
+#endif
+
#if defined(TOOLKIT_USES_GTK)
#include <gtk/gtk.h>
#include "app/x11_util.h"
@@ -44,6 +49,19 @@
gpu_info_collector::CollectGraphicsInfo(&gpu_info_);
child_process_logging::SetGpuInfo(gpu_info_);
+#if defined(OS_WIN)
+ // Asynchronously collect the DirectX diagnostics because this can take a
+ // couple of seconds.
+ if (!WorkerPool::PostTask(
+ FROM_HERE,
+ NewRunnableFunction(&GpuThread::CollectDxDiagnostics,
+ this),
Ken Russell (switch to Gerrit) 2010/11/13 02:34:45 This line break makes this harder to read.
apatrick_chromium 2010/11/15 21:46:25 Done.
+ true)) {
Ken Russell (switch to Gerrit) 2010/11/13 02:34:45 CollectDxDiagnostics uses CoCreateInstance. Do we
apatrick_chromium 2010/11/15 21:46:25 That's what win_util::ScopedCOMInitializer in GpuT
+ // Flag GPU info as complete if the DirectX diagnostics cannot be collected.
+ gpu_info_.SetProgress(GPUInfo::kComplete);
+ }
+#endif
+
// Record initialization only after collecting the GPU info because that can
// take a significant amount of time.
gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time);
@@ -118,3 +136,29 @@
for (;;)
PlatformThread::Sleep(1000);
}
+
+#if defined(OS_WIN)
+
+// Runs on a worker thread. The GpuThread never terminates voluntarily so it is
+// safe to assume that its message loop is valid.
+void GpuThread::CollectDxDiagnostics(GpuThread* thread) {
+ win_util::ScopedCOMInitializer com_initializer;
+
+ DxDiagNode node;
+ gpu_info_collector::GetDxDiagnostics(&node);
+
+ thread->message_loop()->PostTask(
+ FROM_HERE,
+ NewRunnableFunction(&GpuThread::SetDxDiagnostics,
+ thread,
+ node));
Ken Russell (switch to Gerrit) 2010/11/13 02:34:45 thread and node could be on the previous line.
apatrick_chromium 2010/11/15 21:46:25 Done.
+}
+
+// Runs on the GPU thread.
+void GpuThread::SetDxDiagnostics(GpuThread* thread,
+ const DxDiagNode& node) {
Ken Russell (switch to Gerrit) 2010/11/13 02:34:45 Formatting is off.
apatrick_chromium 2010/11/15 21:46:25 Done.
+ thread->gpu_info_.SetDxDiagnostics(node);
+ thread->gpu_info_.SetProgress(GPUInfo::kComplete);
+}
+
+#endif
« chrome/browser/browser_about_handler.cc ('K') | « chrome/gpu/gpu_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698