| 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 "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "chrome/common/child_process.h" | 13 #include "chrome/common/child_process.h" |
| 14 #include "chrome/common/gpu_info.h" | 14 #include "chrome/common/gpu_info.h" |
| 15 #include "chrome/common/gpu_messages.h" | 15 #include "chrome/common/gpu_messages.h" |
| 16 #include "chrome/gpu/gpu_info_collector.h" | 16 #include "chrome/gpu/gpu_info_collector.h" |
| 17 #include "ipc/ipc_channel_handle.h" | 17 #include "ipc/ipc_channel_handle.h" |
| 18 | 18 |
| 19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 20 #include "chrome/gpu/gpu_view_win.h" | 20 #include "chrome/gpu/gpu_view_win.h" |
| 21 #elif defined(GPU_USE_GLX) | 21 #elif defined(GPU_USE_GLX) |
| 22 #include "chrome/gpu/gpu_backing_store_glx_context.h" | 22 #include "chrome/gpu/gpu_backing_store_glx_context.h" |
| 23 #include "chrome/gpu/gpu_view_x.h" | 23 #include "chrome/gpu/gpu_view_x.h" |
| 24 | 24 |
| 25 #include <X11/Xutil.h> // Must be last. | 25 #include <X11/Xutil.h> // Must be last. |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #if defined(OS_LINUX) | 28 #if defined(OS_LINUX) |
| 29 #include "app/x11_util.h" |
| 29 #include <gtk/gtk.h> | 30 #include <gtk/gtk.h> |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 GpuThread::GpuThread() { | 33 GpuThread::GpuThread() { |
| 33 #if defined(GPU_USE_GLX) | 34 #if defined(GPU_USE_GLX) |
| 34 display_ = ::XOpenDisplay(NULL); | 35 display_ = ::XOpenDisplay(NULL); |
| 35 #endif | 36 #endif |
| 36 #if defined(OS_LINUX) | 37 #if defined(OS_LINUX) |
| 37 { | 38 { |
| 38 // The X11 port of the command buffer code assumes it can access the X | 39 // The X11 port of the command buffer code assumes it can access the X |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 // here. | 51 // here. |
| 51 argv[i] = strdup(args[i].c_str()); | 52 argv[i] = strdup(args[i].c_str()); |
| 52 } | 53 } |
| 53 argv[argc] = NULL; | 54 argv[argc] = NULL; |
| 54 char **argv_pointer = argv.get(); | 55 char **argv_pointer = argv.get(); |
| 55 | 56 |
| 56 gtk_init(&argc, &argv_pointer); | 57 gtk_init(&argc, &argv_pointer); |
| 57 for (size_t i = 0; i < args.size(); ++i) { | 58 for (size_t i = 0; i < args.size(); ++i) { |
| 58 free(argv[i]); | 59 free(argv[i]); |
| 59 } | 60 } |
| 60 x11_util::SetX11ErrorHandlers(); | 61 x11_util::SetDefaultX11ErrorHandlers(); |
| 61 } | 62 } |
| 62 #endif | 63 #endif |
| 63 } | 64 } |
| 64 | 65 |
| 65 GpuThread::~GpuThread() { | 66 GpuThread::~GpuThread() { |
| 66 } | 67 } |
| 67 | 68 |
| 68 #if defined(GPU_USE_GLX) | 69 #if defined(GPU_USE_GLX) |
| 69 GpuBackingStoreGLXContext* GpuThread::GetGLXContext() { | 70 GpuBackingStoreGLXContext* GpuThread::GetGLXContext() { |
| 70 if (!glx_context_.get()) | 71 if (!glx_context_.get()) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 void GpuThread::OnCollectGraphicsInfo() { | 153 void GpuThread::OnCollectGraphicsInfo() { |
| 153 // Fail to establish a channel if some implementation of GL cannot be | 154 // Fail to establish a channel if some implementation of GL cannot be |
| 154 // initialized. | 155 // initialized. |
| 155 GPUInfo gpu_info; | 156 GPUInfo gpu_info; |
| 156 if (gfx::GLContext::InitializeOneOff()) { | 157 if (gfx::GLContext::InitializeOneOff()) { |
| 157 gpu_info_collector::CollectGraphicsInfo(&gpu_info); | 158 gpu_info_collector::CollectGraphicsInfo(&gpu_info); |
| 158 } | 159 } |
| 159 | 160 |
| 160 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info)); | 161 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info)); |
| 161 } | 162 } |
| OLD | NEW |