| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "app/win/scoped_com_initializer.h" | 7 #include "app/win/scoped_com_initializer.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/env_vars.h" | 15 #include "chrome/common/env_vars.h" |
| 16 #include "chrome/common/main_function_params.h" | 16 #include "chrome/common/main_function_params.h" |
| 17 #include "chrome/gpu/gpu_config.h" | 17 #include "chrome/gpu/gpu_config.h" |
| 18 #include "chrome/gpu/gpu_process.h" | 18 #include "chrome/gpu/gpu_process.h" |
| 19 #include "chrome/gpu/gpu_thread.h" | 19 #include "chrome/gpu/gpu_thread.h" |
| 20 | 20 |
| 21 #if defined(USE_LINUX_BREAKPAD) | 21 #if defined(USE_LINUX_BREAKPAD) |
| 22 #include "chrome/app/breakpad_linux.h" | 22 #include "chrome/app/breakpad_linux.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #if defined(OS_WIN) |
| 26 #include <windows.h> |
| 27 #endif |
| 28 |
| 25 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
| 26 #include "chrome/common/chrome_application_mac.h" | 30 #include "chrome/common/chrome_application_mac.h" |
| 27 #endif | 31 #endif |
| 28 | 32 |
| 29 #if defined(USE_X11) | 33 #if defined(USE_X11) |
| 30 #include "gfx/gtk_util.h" | 34 #include "gfx/gtk_util.h" |
| 31 #endif | 35 #endif |
| 32 | 36 |
| 33 // Main function for starting the Gpu process. | 37 // Main function for starting the Gpu process. |
| 34 int GpuMain(const MainFunctionParams& parameters) { | 38 int GpuMain(const MainFunctionParams& parameters) { |
| 35 base::Time start_time = base::Time::Now(); | 39 base::Time start_time = base::Time::Now(); |
| 36 | 40 |
| 37 #if defined(USE_LINUX_BREAKPAD) | 41 #if defined(USE_LINUX_BREAKPAD) |
| 38 // Needs to be called after we have chrome::DIR_USER_DATA. | 42 // Needs to be called after we have chrome::DIR_USER_DATA. |
| 39 InitCrashReporter(); | 43 InitCrashReporter(); |
| 40 #endif | 44 #endif |
| 41 | 45 |
| 42 const CommandLine& command_line = parameters.command_line_; | 46 const CommandLine& command_line = parameters.command_line_; |
| 43 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { | 47 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { |
| 44 ChildProcess::WaitForDebugger(L"Gpu"); | 48 ChildProcess::WaitForDebugger(L"Gpu"); |
| 45 } | 49 } |
| 46 | 50 |
| 47 #if defined(OS_MACOSX) | 51 #if defined(OS_MACOSX) |
| 48 chrome_application_mac::RegisterCrApp(); | 52 chrome_application_mac::RegisterCrApp(); |
| 49 #endif | 53 #endif |
| 50 | 54 |
| 51 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 55 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
| 52 base::PlatformThread::SetName("CrGpuMain"); | 56 base::PlatformThread::SetName("CrGpuMain"); |
| 53 | 57 |
| 58 #if defined(OS_WIN) |
| 59 // Prevent Windows from displaying a modal dialog on failures like not being |
| 60 // able to load a DLL. |
| 61 SetErrorMode( |
| 62 SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); |
| 63 #endif |
| 64 |
| 54 app::win::ScopedCOMInitializer com_initializer; | 65 app::win::ScopedCOMInitializer com_initializer; |
| 55 | 66 |
| 56 #if defined(USE_X11) | 67 #if defined(USE_X11) |
| 57 // The X11 port of the command buffer code assumes it can access the X | 68 // The X11 port of the command buffer code assumes it can access the X |
| 58 // display via the macro GDK_DISPLAY(), which implies that Gtk has been | 69 // display via the macro GDK_DISPLAY(), which implies that Gtk has been |
| 59 // initialized. This code was taken from PluginThread. TODO(kbr): | 70 // initialized. This code was taken from PluginThread. TODO(kbr): |
| 60 // rethink whether initializing Gtk is really necessary or whether we | 71 // rethink whether initializing Gtk is really necessary or whether we |
| 61 // should just send a raw display connection down to the GPUProcessor. | 72 // should just send a raw display connection down to the GPUProcessor. |
| 62 g_thread_init(NULL); | 73 g_thread_init(NULL); |
| 63 gfx::GtkInitFromCommandLine(command_line); | 74 gfx::GtkInitFromCommandLine(command_line); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 74 GpuThread* gpu_thread = new GpuThread; | 85 GpuThread* gpu_thread = new GpuThread; |
| 75 gpu_thread->Init(start_time); | 86 gpu_thread->Init(start_time); |
| 76 gpu_process.set_main_thread(gpu_thread); | 87 gpu_process.set_main_thread(gpu_thread); |
| 77 | 88 |
| 78 main_message_loop.Run(); | 89 main_message_loop.Run(); |
| 79 | 90 |
| 80 gpu_thread->StopWatchdog(); | 91 gpu_thread->StopWatchdog(); |
| 81 | 92 |
| 82 return 0; | 93 return 0; |
| 83 } | 94 } |
| OLD | NEW |