| 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 "app/gfx/gl/gl_implementation.h" |
| 5 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 6 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 7 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
| 8 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/main_function_params.h" | 10 #include "chrome/common/main_function_params.h" |
| 10 #include "chrome/gpu/gpu_config.h" | 11 #include "chrome/gpu/gpu_config.h" |
| 11 #include "chrome/gpu/gpu_process.h" | 12 #include "chrome/gpu/gpu_process.h" |
| 12 #include "chrome/gpu/gpu_thread.h" | 13 #include "chrome/gpu/gpu_thread.h" |
| 13 | 14 |
| 14 #if defined(USE_LINUX_BREAKPAD) | 15 #if defined(USE_LINUX_BREAKPAD) |
| 15 #include "chrome/app/breakpad_linux.h" | 16 #include "chrome/app/breakpad_linux.h" |
| 16 #endif | 17 #endif |
| 17 | 18 |
| 18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 19 #include "app/win_util.h" | 20 #include "app/win_util.h" |
| 20 #elif defined(GPU_USE_GLX) | |
| 21 #include <dlfcn.h> | |
| 22 #include <GL/glxew.h> | |
| 23 #endif | 21 #endif |
| 24 | 22 |
| 25 // Main function for starting the Gpu process. | 23 // Main function for starting the Gpu process. |
| 26 int GpuMain(const MainFunctionParams& parameters) { | 24 int GpuMain(const MainFunctionParams& parameters) { |
| 27 #if defined(USE_LINUX_BREAKPAD) | 25 #if defined(USE_LINUX_BREAKPAD) |
| 28 // Needs to be called after we have chrome::DIR_USER_DATA. | 26 // Needs to be called after we have chrome::DIR_USER_DATA. |
| 29 InitCrashReporter(); | 27 InitCrashReporter(); |
| 30 #endif | 28 #endif |
| 31 | 29 |
| 32 const CommandLine& command_line = parameters.command_line_; | 30 const CommandLine& command_line = parameters.command_line_; |
| 33 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { | 31 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { |
| 34 ChildProcess::WaitForDebugger(L"Gpu"); | 32 ChildProcess::WaitForDebugger(L"Gpu"); |
| 35 } | 33 } |
| 36 | 34 |
| 37 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 35 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
| 38 std::wstring app_name = chrome::kBrowserAppName; | 36 std::wstring app_name = chrome::kBrowserAppName; |
| 39 PlatformThread::SetName(WideToASCII(app_name + L"_GpuMain").c_str()); | 37 PlatformThread::SetName(WideToASCII(app_name + L"_GpuMain").c_str()); |
| 40 | 38 |
| 41 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 42 win_util::ScopedCOMInitializer com_initializer; | 40 win_util::ScopedCOMInitializer com_initializer; |
| 43 #elif defined(GPU_USE_GLX) | 41 #elif defined(GPU_USE_GLX) |
| 44 dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); | 42 gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); |
| 45 glxewInit(); | |
| 46 #endif | 43 #endif |
| 47 | 44 |
| 48 GpuProcess gpu_process; | 45 GpuProcess gpu_process; |
| 49 gpu_process.set_main_thread(new GpuThread()); | 46 gpu_process.set_main_thread(new GpuThread()); |
| 50 | 47 |
| 51 main_message_loop.Run(); | 48 main_message_loop.Run(); |
| 52 | 49 |
| 53 return 0; | 50 return 0; |
| 54 } | 51 } |
| 55 | 52 |
| OLD | NEW |