OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "ui/gfx/gl/gl_switches.h" | 23 #include "ui/gfx/gl/gl_switches.h" |
24 | 24 |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include "sandbox/src/sandbox.h" | 26 #include "sandbox/src/sandbox.h" |
27 #endif | 27 #endif |
28 | 28 |
29 #if defined(USE_X11) | 29 #if defined(USE_X11) |
30 #include "ui/base/x/x11_util.h" | 30 #include "ui/base/x/x11_util.h" |
31 #endif | 31 #endif |
32 | 32 |
| 33 #if defined(TOOLKIT_USES_GTK) |
| 34 #include "ui/gfx/gtk_util.h" |
| 35 #endif |
| 36 |
33 // Main function for starting the Gpu process. | 37 // Main function for starting the Gpu process. |
34 int GpuMain(const content::MainFunctionParams& parameters) { | 38 int GpuMain(const content::MainFunctionParams& parameters) { |
35 base::Time start_time = base::Time::Now(); | 39 base::Time start_time = base::Time::Now(); |
36 | 40 |
37 const CommandLine& command_line = parameters.command_line; | 41 const CommandLine& command_line = parameters.command_line; |
38 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { | 42 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { |
39 ChildProcess::WaitForDebugger("Gpu"); | 43 ChildProcess::WaitForDebugger("Gpu"); |
40 } | 44 } |
41 | 45 |
42 if (!command_line.HasSwitch(switches::kSingleProcess)) { | 46 if (!command_line.HasSwitch(switches::kSingleProcess)) { |
43 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
44 // Prevent Windows from displaying a modal dialog on failures like not being | 48 // Prevent Windows from displaying a modal dialog on failures like not being |
45 // able to load a DLL. | 49 // able to load a DLL. |
46 SetErrorMode( | 50 SetErrorMode( |
47 SEM_FAILCRITICALERRORS | | 51 SEM_FAILCRITICALERRORS | |
48 SEM_NOGPFAULTERRORBOX | | 52 SEM_NOGPFAULTERRORBOX | |
49 SEM_NOOPENFILEERRORBOX); | 53 SEM_NOOPENFILEERRORBOX); |
50 #elif defined(USE_X11) | 54 #elif defined(USE_X11) |
51 ui::SetDefaultX11ErrorHandlers(); | 55 ui::SetDefaultX11ErrorHandlers(); |
52 #endif | 56 #endif |
| 57 #if defined(TOOLKIT_USES_GTK) |
| 58 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
| 59 #endif |
53 } | 60 } |
54 | 61 |
55 // Initialization of the OpenGL bindings may fail, in which case we | 62 // Initialization of the OpenGL bindings may fail, in which case we |
56 // will need to tear down this process. However, we can not do so | 63 // will need to tear down this process. However, we can not do so |
57 // safely until the IPC channel is set up, because the detection of | 64 // safely until the IPC channel is set up, because the detection of |
58 // early return of a child process is implemented using an IPC | 65 // early return of a child process is implemented using an IPC |
59 // channel error. If the IPC channel is not fully set up between the | 66 // channel error. If the IPC channel is not fully set up between the |
60 // browser and GPU process, and the GPU process crashes or exits | 67 // browser and GPU process, and the GPU process crashes or exits |
61 // early, the browser process will never detect it. For this reason | 68 // early, the browser process will never detect it. For this reason |
62 // we defer tearing down the GPU process until receiving the | 69 // we defer tearing down the GPU process until receiving the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 child_thread->Init(start_time); | 113 child_thread->Init(start_time); |
107 | 114 |
108 gpu_process.set_main_thread(child_thread); | 115 gpu_process.set_main_thread(child_thread); |
109 | 116 |
110 main_message_loop.Run(); | 117 main_message_loop.Run(); |
111 | 118 |
112 child_thread->StopWatchdog(); | 119 child_thread->StopWatchdog(); |
113 | 120 |
114 return 0; | 121 return 0; |
115 } | 122 } |
OLD | NEW |