Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(849)

Side by Side Diff: content/gpu/gpu_main.cc

Issue 1991953002: Implement a runtime headless mode for Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 SEM_FAILCRITICALERRORS | 186 SEM_FAILCRITICALERRORS |
187 SEM_NOGPFAULTERRORBOX | 187 SEM_NOGPFAULTERRORBOX |
188 SEM_NOOPENFILEERRORBOX); 188 SEM_NOOPENFILEERRORBOX);
189 #elif defined(USE_X11) 189 #elif defined(USE_X11)
190 ui::SetDefaultX11ErrorHandlers(); 190 ui::SetDefaultX11ErrorHandlers();
191 191
192 #endif 192 #endif
193 193
194 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); 194 logging::SetLogMessageHandler(GpuProcessLogMessageHandler);
195 195
196 std::unique_ptr<base::MessageLoop> main_message_loop;
197 if (command_line.HasSwitch(switches::kHeadless)) {
198 main_message_loop.reset(
199 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT));
200 } else {
196 #if defined(OS_WIN) 201 #if defined(OS_WIN)
197 // OK to use default non-UI message loop because all GPU windows run on 202 // OK to use default non-UI message loop because all GPU windows run on
198 // dedicated thread. 203 // dedicated thread.
199 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); 204 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.
200 #elif defined(USE_X11) 205 #elif defined(USE_X11)
201 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX 206 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX
202 // and https://crbug.com/326995. 207 // and https://crbug.com/326995.
203 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); 208 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
204 std::unique_ptr<ui::PlatformEventSource> event_source = 209 std::unique_ptr<ui::PlatformEventSource> event_source =
205 ui::PlatformEventSource::CreateDefault(); 210 ui::PlatformEventSource::CreateDefault();
206 #elif defined(USE_OZONE) && defined(OZONE_X11) 211 #elif defined(USE_OZONE) && defined(OZONE_X11)
207 // If we might be running Ozone X11 we need a UI loop to grab Expose events. 212 // If we might be running Ozone X11 we need a UI loop to grab Expose events.
208 // See GLSurfaceGLX and https://crbug.com/326995. 213 // See GLSurfaceGLX and https://crbug.com/326995.
209 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); 214 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
210 #elif defined(USE_OZONE) 215 #elif defined(USE_OZONE)
211 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); 216 main_message_loop.reset(
217 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT));
212 #elif defined(OS_LINUX) 218 #elif defined(OS_LINUX)
213 #error "Unsupported Linux platform." 219 #error "Unsupported Linux platform."
214 #elif defined(OS_MACOSX) 220 #elif defined(OS_MACOSX)
215 // This is necessary for CoreAnimation layers hosted in the GPU process to be 221 // This is necessary for CoreAnimation layers hosted in the GPU process to
216 // drawn. See http://crbug.com/312462. 222 // be drawn. See http://crbug.com/312462.
217 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); 223 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop());
218 base::MessageLoop main_message_loop(std::move(pump)); 224 main_message_loop.reset(new base::MessageLoop(std::move(pump)));
219 #else 225 #else
220 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_IO); 226 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_IO));
221 #endif 227 #endif
228 }
222 229
223 base::PlatformThread::SetName("CrGpuMain"); 230 base::PlatformThread::SetName("CrGpuMain");
224 231
225 // Initializes StatisticsRecorder which tracks UMA histograms. 232 // Initializes StatisticsRecorder which tracks UMA histograms.
226 base::StatisticsRecorder::Initialize(); 233 base::StatisticsRecorder::Initialize();
227 234
228 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 235 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
229 // Set thread priority before sandbox initialization. 236 // Set thread priority before sandbox initialization.
230 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); 237 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY);
231 #endif 238 #endif
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 return true; 347 return true;
341 } 348 }
342 349
343 return false; 350 return false;
344 } 351 }
345 #endif // defined(OS_WIN) 352 #endif // defined(OS_WIN)
346 353
347 } // namespace. 354 } // namespace.
348 355
349 } // namespace content 356 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698