OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 17 matching lines...) Expand all Loading... | |
28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
29 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 29 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
30 #include "sandbox/src/sandbox.h" | 30 #include "sandbox/src/sandbox.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(USE_X11) | 33 #if defined(USE_X11) |
34 #include "ui/base/x/x11_util.h" | 34 #include "ui/base/x/x11_util.h" |
35 #endif | 35 #endif |
36 | 36 |
37 #if defined(TOOLKIT_GTK) | 37 #if defined(TOOLKIT_GTK) |
38 #include "ui/gfx/gtk_util.h" | 38 #include "ui/gfx/gtk_util.h" |
apatrick_chromium
2012/04/19 19:54:10
I think you should be able to delete this.
| |
39 #endif | 39 #endif |
40 | 40 |
41 #if defined(OS_LINUX) | 41 #if defined(OS_LINUX) |
42 #include "content/public/common/sandbox_init.h" | 42 #include "content/public/common/sandbox_init.h" |
43 #endif | 43 #endif |
44 | 44 |
45 // Main function for starting the Gpu process. | 45 // Main function for starting the Gpu process. |
46 int GpuMain(const content::MainFunctionParams& parameters) { | 46 int GpuMain(const content::MainFunctionParams& parameters) { |
47 base::Time start_time = base::Time::Now(); | 47 base::Time start_time = base::Time::Now(); |
48 | 48 |
49 const CommandLine& command_line = parameters.command_line; | 49 const CommandLine& command_line = parameters.command_line; |
50 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { | 50 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { |
51 ChildProcess::WaitForDebugger("Gpu"); | 51 ChildProcess::WaitForDebugger("Gpu"); |
52 } | 52 } |
53 | 53 |
54 if (!command_line.HasSwitch(switches::kSingleProcess)) { | 54 if (!command_line.HasSwitch(switches::kSingleProcess)) { |
55 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
56 // Prevent Windows from displaying a modal dialog on failures like not being | 56 // Prevent Windows from displaying a modal dialog on failures like not being |
57 // able to load a DLL. | 57 // able to load a DLL. |
58 SetErrorMode( | 58 SetErrorMode( |
59 SEM_FAILCRITICALERRORS | | 59 SEM_FAILCRITICALERRORS | |
60 SEM_NOGPFAULTERRORBOX | | 60 SEM_NOGPFAULTERRORBOX | |
61 SEM_NOOPENFILEERRORBOX); | 61 SEM_NOOPENFILEERRORBOX); |
62 #elif defined(USE_X11) | 62 #elif defined(USE_X11) |
63 ui::SetDefaultX11ErrorHandlers(); | 63 ui::SetDefaultX11ErrorHandlers(); |
64 #endif | 64 #endif |
65 #if defined(TOOLKIT_GTK) | |
66 gfx::GdkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | |
67 #endif | |
68 } | 65 } |
69 | 66 |
70 // Initialization of the OpenGL bindings may fail, in which case we | 67 // Initialization of the OpenGL bindings may fail, in which case we |
71 // will need to tear down this process. However, we can not do so | 68 // will need to tear down this process. However, we can not do so |
72 // safely until the IPC channel is set up, because the detection of | 69 // safely until the IPC channel is set up, because the detection of |
73 // early return of a child process is implemented using an IPC | 70 // early return of a child process is implemented using an IPC |
74 // channel error. If the IPC channel is not fully set up between the | 71 // channel error. If the IPC channel is not fully set up between the |
75 // browser and GPU process, and the GPU process crashes or exits | 72 // browser and GPU process, and the GPU process crashes or exits |
76 // early, the browser process will never detect it. For this reason | 73 // early, the browser process will never detect it. For this reason |
77 // we defer tearing down the GPU process until receiving the | 74 // we defer tearing down the GPU process until receiving the |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 child_thread->Init(start_time); | 153 child_thread->Init(start_time); |
157 | 154 |
158 gpu_process.set_main_thread(child_thread); | 155 gpu_process.set_main_thread(child_thread); |
159 | 156 |
160 main_message_loop.Run(); | 157 main_message_loop.Run(); |
161 | 158 |
162 child_thread->StopWatchdog(); | 159 child_thread->StopWatchdog(); |
163 | 160 |
164 return 0; | 161 return 0; |
165 } | 162 } |
OLD | NEW |