Index: content/gpu/gpu_main.cc |
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc |
index 51c2868899c077360575fbf89cab0518e99bc7a0..1ae774219f190a280ef6a0da92e5a3f0b7ee4dbe 100644 |
--- a/content/gpu/gpu_main.cc |
+++ b/content/gpu/gpu_main.cc |
@@ -193,32 +193,39 @@ int GpuMain(const MainFunctionParams& parameters) { |
logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
+ std::unique_ptr<base::MessageLoop> main_message_loop; |
+ if (command_line.HasSwitch(switches::kHeadless)) { |
+ main_message_loop.reset( |
+ new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
+ } else { |
#if defined(OS_WIN) |
- // OK to use default non-UI message loop because all GPU windows run on |
- // dedicated thread. |
- base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); |
+ // OK to use default non-UI message loop because all GPU windows run on |
+ // dedicated thread. |
+ base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); |
Eric Seckler
2016/11/28 15:51:48
think this won't compile, needs to do main_message
Sami
2016/11/28 18:00:36
Hmm yeah, I think I messed this up while rebasing.
|
#elif defined(USE_X11) |
- // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX |
- // and https://crbug.com/326995. |
- base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); |
- std::unique_ptr<ui::PlatformEventSource> event_source = |
- ui::PlatformEventSource::CreateDefault(); |
+ // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX |
+ // and https://crbug.com/326995. |
+ main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
+ std::unique_ptr<ui::PlatformEventSource> event_source = |
+ ui::PlatformEventSource::CreateDefault(); |
#elif defined(USE_OZONE) && defined(OZONE_X11) |
- // If we might be running Ozone X11 we need a UI loop to grab Expose events. |
- // See GLSurfaceGLX and https://crbug.com/326995. |
- base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); |
+ // If we might be running Ozone X11 we need a UI loop to grab Expose events. |
+ // See GLSurfaceGLX and https://crbug.com/326995. |
+ main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
#elif defined(USE_OZONE) |
- base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); |
+ main_message_loop.reset( |
+ new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
#elif defined(OS_LINUX) |
#error "Unsupported Linux platform." |
#elif defined(OS_MACOSX) |
- // This is necessary for CoreAnimation layers hosted in the GPU process to be |
- // drawn. See http://crbug.com/312462. |
- std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); |
- base::MessageLoop main_message_loop(std::move(pump)); |
+ // This is necessary for CoreAnimation layers hosted in the GPU process to |
+ // be drawn. See http://crbug.com/312462. |
+ std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); |
+ main_message_loop.reset(new base::MessageLoop(std::move(pump))); |
#else |
- base::MessageLoop main_message_loop(base::MessageLoop::TYPE_IO); |
+ main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_IO)); |
#endif |
+ } |
base::PlatformThread::SetName("CrGpuMain"); |