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/content_switches.h" | 17 #include "content/common/content_switches.h" |
18 #include "content/common/gpu/gpu_config.h" | 18 #include "content/common/gpu/gpu_config.h" |
19 #include "content/common/main_function_params.h" | 19 #include "content/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 | 24 |
24 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
25 #include "content/common/chrome_application_mac.h" | 26 #include "content/common/chrome_application_mac.h" |
26 #elif defined(OS_WIN) | 27 #elif defined(OS_WIN) |
27 #include "sandbox/src/sandbox.h" | 28 #include "sandbox/src/sandbox.h" |
28 #endif | 29 #endif |
29 | 30 |
30 #if defined(USE_X11) | 31 #if defined(USE_X11) |
31 #include "ui/base/x/x11_util.h" | 32 #include "ui/base/x/x11_util.h" |
32 #endif | 33 #endif |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // is sandboxed and we must call LowerToken() before rendering untrusted | 67 // is sandboxed and we must call LowerToken() before rendering untrusted |
67 // content. | 68 // content. |
68 if (target_services) | 69 if (target_services) |
69 target_services->LowerToken(); | 70 target_services->LowerToken(); |
70 #endif | 71 #endif |
71 | 72 |
72 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
73 chrome_application_mac::RegisterCrApp(); | 74 chrome_application_mac::RegisterCrApp(); |
74 #endif | 75 #endif |
75 | 76 |
76 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 77 MessageLoop::Type message_loop_type = MessageLoop::TYPE_UI; |
| 78 #if defined(OS_WIN) |
| 79 // Unless we're running on desktop GL, we don't need a UI message |
| 80 // loop, so avoid its use to work around apparent problems with some |
| 81 // third-party software. |
| 82 message_loop_type = MessageLoop::TYPE_IO; |
| 83 if (command_line.HasSwitch(switches::kUseGL) && |
| 84 command_line.GetSwitchValueASCII(switches::kUseGL) == |
| 85 gfx::kGLImplementationDesktopName) { |
| 86 message_loop_type = MessageLoop::TYPE_UI; |
| 87 } |
| 88 #endif |
| 89 |
| 90 MessageLoop main_message_loop(message_loop_type); |
77 base::PlatformThread::SetName("CrGpuMain"); | 91 base::PlatformThread::SetName("CrGpuMain"); |
78 | 92 |
79 if (!command_line.HasSwitch(switches::kSingleProcess)) { | 93 if (!command_line.HasSwitch(switches::kSingleProcess)) { |
80 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
81 // Prevent Windows from displaying a modal dialog on failures like not being | 95 // Prevent Windows from displaying a modal dialog on failures like not being |
82 // able to load a DLL. | 96 // able to load a DLL. |
83 SetErrorMode( | 97 SetErrorMode( |
84 SEM_FAILCRITICALERRORS | | 98 SEM_FAILCRITICALERRORS | |
85 SEM_NOGPFAULTERRORBOX | | 99 SEM_NOGPFAULTERRORBOX | |
86 SEM_NOOPENFILEERRORBOX); | 100 SEM_NOOPENFILEERRORBOX); |
(...skipping 11 matching lines...) Expand all Loading... |
98 child_thread->Init(start_time); | 112 child_thread->Init(start_time); |
99 | 113 |
100 gpu_process.set_main_thread(child_thread); | 114 gpu_process.set_main_thread(child_thread); |
101 | 115 |
102 main_message_loop.Run(); | 116 main_message_loop.Run(); |
103 | 117 |
104 child_thread->StopWatchdog(); | 118 child_thread->StopWatchdog(); |
105 | 119 |
106 return 0; | 120 return 0; |
107 } | 121 } |
OLD | NEW |