| OLD | NEW |
| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/worker_pool.h" | 12 #include "base/worker_pool.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/common/child_process.h" | 14 #include "chrome/common/child_process.h" |
| 15 #include "chrome/common/child_process_logging.h" | 15 #include "chrome/common/child_process_logging.h" |
| 16 #include "chrome/common/gpu_messages.h" | 16 #include "chrome/common/gpu_messages.h" |
| 17 #include "chrome/gpu/gpu_info_collector.h" | 17 #include "chrome/gpu/gpu_info_collector.h" |
| 18 #include "ipc/ipc_channel_handle.h" | 18 #include "ipc/ipc_channel_handle.h" |
| 19 | 19 |
| 20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 21 #include "app/win_util.h" | 21 #include "app/win_util.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 #if defined(TOOLKIT_USES_GTK) | |
| 25 #include <gtk/gtk.h> | |
| 26 #include "app/x11_util.h" | |
| 27 #include "gfx/gtk_util.h" | |
| 28 #endif | |
| 29 | |
| 30 GpuThread::GpuThread() { | 24 GpuThread::GpuThread() { |
| 31 #if defined(OS_LINUX) | |
| 32 { | |
| 33 // The X11 port of the command buffer code assumes it can access the X | |
| 34 // display via the macro GDK_DISPLAY(), which implies that Gtk has been | |
| 35 // initialized. This code was taken from PluginThread. TODO(kbr): | |
| 36 // rethink whether initializing Gtk is really necessary or whether we | |
| 37 // should just send a raw display connection down to the GPUProcessor. | |
| 38 g_thread_init(NULL); | |
| 39 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | |
| 40 x11_util::SetDefaultX11ErrorHandlers(); | |
| 41 } | |
| 42 #endif | |
| 43 } | 25 } |
| 44 | 26 |
| 45 GpuThread::~GpuThread() { | 27 GpuThread::~GpuThread() { |
| 46 } | 28 } |
| 47 | 29 |
| 48 void GpuThread::Init(const base::Time& process_start_time) { | 30 void GpuThread::Init(const base::Time& process_start_time) { |
| 49 gpu_info_collector::CollectGraphicsInfo(&gpu_info_); | 31 gpu_info_collector::CollectGraphicsInfo(&gpu_info_); |
| 50 child_process_logging::SetGpuInfo(gpu_info_); | 32 child_process_logging::SetGpuInfo(gpu_info_); |
| 51 | 33 |
| 52 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); | 133 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); |
| 152 } | 134 } |
| 153 | 135 |
| 154 // Runs on the GPU thread. | 136 // Runs on the GPU thread. |
| 155 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { | 137 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { |
| 156 thread->gpu_info_.SetDxDiagnostics(node); | 138 thread->gpu_info_.SetDxDiagnostics(node); |
| 157 thread->gpu_info_.SetProgress(GPUInfo::kComplete); | 139 thread->gpu_info_.SetProgress(GPUInfo::kComplete); |
| 158 } | 140 } |
| 159 | 141 |
| 160 #endif | 142 #endif |
| OLD | NEW |