Chromium Code Reviews| 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 <dwmapi.h> | 8 #include <dwmapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 #if defined(USE_X11) | 46 #if defined(USE_X11) |
| 47 #include "ui/base/x/x11_util.h" | 47 #include "ui/base/x/x11_util.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 #if defined(OS_LINUX) | 50 #if defined(OS_LINUX) |
| 51 #include "content/public/common/sandbox_init.h" | 51 #include "content/public/common/sandbox_init.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 #if defined(OS_MACOSX) | |
| 55 #include "base/message_loop/message_pump_mac.h" | |
| 56 #endif | |
| 57 | |
| 54 const int kGpuTimeout = 10000; | 58 const int kGpuTimeout = 10000; |
| 55 | 59 |
| 56 namespace content { | 60 namespace content { |
| 57 | 61 |
| 58 namespace { | 62 namespace { |
| 59 | 63 |
| 60 bool WarmUpSandbox(const CommandLine& command_line); | 64 bool WarmUpSandbox(const CommandLine& command_line); |
| 61 #if defined(OS_LINUX) | 65 #if defined(OS_LINUX) |
| 62 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool); | 66 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool); |
| 63 #elif defined(OS_WIN) | 67 #elif defined(OS_WIN) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 // will need to tear down this process. However, we can not do so | 126 // will need to tear down this process. However, we can not do so |
| 123 // safely until the IPC channel is set up, because the detection of | 127 // safely until the IPC channel is set up, because the detection of |
| 124 // early return of a child process is implemented using an IPC | 128 // early return of a child process is implemented using an IPC |
| 125 // channel error. If the IPC channel is not fully set up between the | 129 // channel error. If the IPC channel is not fully set up between the |
| 126 // browser and GPU process, and the GPU process crashes or exits | 130 // browser and GPU process, and the GPU process crashes or exits |
| 127 // early, the browser process will never detect it. For this reason | 131 // early, the browser process will never detect it. For this reason |
| 128 // we defer tearing down the GPU process until receiving the | 132 // we defer tearing down the GPU process until receiving the |
| 129 // GpuMsg_Initialize message from the browser. | 133 // GpuMsg_Initialize message from the browser. |
| 130 bool dead_on_arrival = false; | 134 bool dead_on_arrival = false; |
| 131 | 135 |
| 136 #if defined(OS_WIN) | |
|
ccameron
2014/05/12 20:06:50
IMO the MessageLoop type enums are of limited util
Robert Sesek
2014/05/12 20:11:43
They do have limited utility, but we're starting t
| |
| 132 base::MessageLoop::Type message_loop_type = base::MessageLoop::TYPE_IO; | 137 base::MessageLoop::Type message_loop_type = base::MessageLoop::TYPE_IO; |
| 133 #if defined(OS_WIN) | |
| 134 // Unless we're running on desktop GL, we don't need a UI message | 138 // Unless we're running on desktop GL, we don't need a UI message |
| 135 // loop, so avoid its use to work around apparent problems with some | 139 // loop, so avoid its use to work around apparent problems with some |
| 136 // third-party software. | 140 // third-party software. |
| 137 if (command_line.HasSwitch(switches::kUseGL) && | 141 if (command_line.HasSwitch(switches::kUseGL) && |
| 138 command_line.GetSwitchValueASCII(switches::kUseGL) == | 142 command_line.GetSwitchValueASCII(switches::kUseGL) == |
| 139 gfx::kGLImplementationDesktopName) { | 143 gfx::kGLImplementationDesktopName) { |
| 140 message_loop_type = base::MessageLoop::TYPE_UI; | 144 message_loop_type = base::MessageLoop::TYPE_UI; |
| 141 } | 145 } |
| 146 base::MessageLoop main_message_loop(message_loop_type); | |
| 142 #elif defined(OS_LINUX) | 147 #elif defined(OS_LINUX) |
| 143 message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 148 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); |
| 149 #elif defined(OS_MACOSX) | |
| 150 // This is necessary for CoreAnimation layers hosted in the GPU process to be | |
|
Robert Sesek
2014/05/12 20:11:43
Do you know what specifically requires this? I'm a
ccameron
2014/05/12 20:30:44
Not sure. I've verified in Chrome and in stand-alo
Robert Sesek
2014/05/12 22:11:50
Interesting. What about CFRunLoopAddSource?
| |
| 151 // drawn. See: | |
| 152 // http://crbug.com/312462 | |
|
Robert Sesek
2014/05/12 20:11:43
nit: No need for this to be on its own line.
ccameron
2014/05/12 20:30:44
Done.
| |
| 153 scoped_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); | |
| 154 base::MessageLoop main_message_loop(pump.Pass()); | |
| 155 #else | |
| 156 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_IO); | |
| 144 #endif | 157 #endif |
| 145 | 158 |
| 146 base::MessageLoop main_message_loop(message_loop_type); | |
| 147 base::PlatformThread::SetName("CrGpuMain"); | 159 base::PlatformThread::SetName("CrGpuMain"); |
| 148 | 160 |
| 149 // In addition to disabling the watchdog if the command line switch is | 161 // In addition to disabling the watchdog if the command line switch is |
| 150 // present, disable the watchdog on valgrind because the code is expected | 162 // present, disable the watchdog on valgrind because the code is expected |
| 151 // to run slowly in that case. | 163 // to run slowly in that case. |
| 152 bool enable_watchdog = | 164 bool enable_watchdog = |
| 153 !command_line.HasSwitch(switches::kDisableGpuWatchdog) && | 165 !command_line.HasSwitch(switches::kDisableGpuWatchdog) && |
| 154 !RunningOnValgrind(); | 166 !RunningOnValgrind(); |
| 155 | 167 |
| 156 // Disable the watchdog in debug builds because they tend to only be run by | 168 // Disable the watchdog in debug builds because they tend to only be run by |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 return true; | 462 return true; |
| 451 } | 463 } |
| 452 | 464 |
| 453 return false; | 465 return false; |
| 454 } | 466 } |
| 455 #endif // defined(OS_WIN) | 467 #endif // defined(OS_WIN) |
| 456 | 468 |
| 457 } // namespace. | 469 } // namespace. |
| 458 | 470 |
| 459 } // namespace content | 471 } // namespace content |
| OLD | NEW |