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 |
11 #include "base/environment.h" | 11 #include "base/environment.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
15 #include "base/win/scoped_com_initializer.h" | 15 #include "base/win/scoped_com_initializer.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "content/common/gpu/gpu_config.h" | 17 #include "content/common/gpu/gpu_config.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "content/public/common/main_function_params.h" | 19 #include "content/public/common/main_function_params.h" |
20 #include "content/gpu/gpu_child_thread.h" | 20 #include "content/gpu/gpu_child_thread.h" |
21 #include "content/gpu/gpu_process.h" | 21 #include "content/gpu/gpu_process.h" |
22 #include "ui/gfx/gl/gl_surface.h" | 22 #include "ui/gfx/gl/gl_surface.h" |
23 #include "ui/gfx/gl/gl_switches.h" | 23 #include "ui/gfx/gl/gl_switches.h" |
24 | 24 |
25 #if defined(OS_MACOSX) | 25 #if defined(OS_WIN) |
26 #include "content/common/chrome_application_mac.h" | |
27 #elif defined(OS_WIN) | |
28 #include "sandbox/src/sandbox.h" | 26 #include "sandbox/src/sandbox.h" |
29 #endif | 27 #endif |
30 | 28 |
31 #if defined(USE_X11) | 29 #if defined(USE_X11) |
32 #include "ui/base/x/x11_util.h" | 30 #include "ui/base/x/x11_util.h" |
33 #endif | 31 #endif |
34 | 32 |
35 // Main function for starting the Gpu process. | 33 // Main function for starting the Gpu process. |
36 int GpuMain(const content::MainFunctionParams& parameters) { | 34 int GpuMain(const content::MainFunctionParams& parameters) { |
37 base::Time start_time = base::Time::Now(); | 35 base::Time start_time = base::Time::Now(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
79 sandbox::TargetServices* target_services = | 77 sandbox::TargetServices* target_services = |
80 parameters.sandbox_info->target_services; | 78 parameters.sandbox_info->target_services; |
81 // For windows, if the target_services interface is not zero, the process | 79 // For windows, if the target_services interface is not zero, the process |
82 // is sandboxed and we must call LowerToken() before rendering untrusted | 80 // is sandboxed and we must call LowerToken() before rendering untrusted |
83 // content. | 81 // content. |
84 if (target_services) | 82 if (target_services) |
85 target_services->LowerToken(); | 83 target_services->LowerToken(); |
86 #endif | 84 #endif |
87 | 85 |
88 #if defined(OS_MACOSX) | |
89 chrome_application_mac::RegisterCrApp(); | |
90 #endif | |
91 | |
92 MessageLoop::Type message_loop_type = MessageLoop::TYPE_UI; | 86 MessageLoop::Type message_loop_type = MessageLoop::TYPE_UI; |
93 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
94 // Unless we're running on desktop GL, we don't need a UI message | 88 // Unless we're running on desktop GL, we don't need a UI message |
95 // loop, so avoid its use to work around apparent problems with some | 89 // loop, so avoid its use to work around apparent problems with some |
96 // third-party software. | 90 // third-party software. |
97 message_loop_type = MessageLoop::TYPE_IO; | 91 message_loop_type = MessageLoop::TYPE_IO; |
98 if (command_line.HasSwitch(switches::kUseGL) && | 92 if (command_line.HasSwitch(switches::kUseGL) && |
99 command_line.GetSwitchValueASCII(switches::kUseGL) == | 93 command_line.GetSwitchValueASCII(switches::kUseGL) == |
100 gfx::kGLImplementationDesktopName) { | 94 gfx::kGLImplementationDesktopName) { |
101 message_loop_type = MessageLoop::TYPE_UI; | 95 message_loop_type = MessageLoop::TYPE_UI; |
(...skipping 10 matching lines...) Expand all Loading... |
112 child_thread->Init(start_time); | 106 child_thread->Init(start_time); |
113 | 107 |
114 gpu_process.set_main_thread(child_thread); | 108 gpu_process.set_main_thread(child_thread); |
115 | 109 |
116 main_message_loop.Run(); | 110 main_message_loop.Run(); |
117 | 111 |
118 child_thread->StopWatchdog(); | 112 child_thread->StopWatchdog(); |
119 | 113 |
120 return 0; | 114 return 0; |
121 } | 115 } |
OLD | NEW |