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

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

Issue 2629983002: Fix the MessageLoop type in case more than one ozone platform is built (Closed)
Patch Set: addressed moar sadrul/kylechar's feedback Created 3 years, 10 months 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 #if defined(OS_LINUX) 75 #if defined(OS_LINUX)
76 #include "content/public/common/sandbox_init.h" 76 #include "content/public/common/sandbox_init.h"
77 #endif 77 #endif
78 78
79 #if defined(OS_MACOSX) 79 #if defined(OS_MACOSX)
80 #include "base/message_loop/message_pump_mac.h" 80 #include "base/message_loop/message_pump_mac.h"
81 #include "content/common/sandbox_mac.h" 81 #include "content/common/sandbox_mac.h"
82 #endif 82 #endif
83 83
84 #if defined(USE_OZONE)
85 #include "ui/ozone/public/ozone_platform.h"
86 #endif
87
84 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) 88 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
85 #include "media/gpu/vaapi_wrapper.h" 89 #include "media/gpu/vaapi_wrapper.h"
86 #endif 90 #endif
87 91
88 #if defined(SANITIZER_COVERAGE) 92 #if defined(SANITIZER_COVERAGE)
89 #include <sanitizer/common_interface_defs.h> 93 #include <sanitizer/common_interface_defs.h>
90 #include <sanitizer/coverage_interface.h> 94 #include <sanitizer/coverage_interface.h>
91 #endif 95 #endif
92 96
93 namespace content { 97 namespace content {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 #if defined(OS_WIN) 215 #if defined(OS_WIN)
212 // OK to use default non-UI message loop because all GPU windows run on 216 // OK to use default non-UI message loop because all GPU windows run on
213 // dedicated thread. 217 // dedicated thread.
214 main_message_loop.reset( 218 main_message_loop.reset(
215 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); 219 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT));
216 #elif defined(USE_X11) 220 #elif defined(USE_X11)
217 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX 221 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX
218 // and https://crbug.com/326995. 222 // and https://crbug.com/326995.
219 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); 223 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
220 event_source = ui::PlatformEventSource::CreateDefault(); 224 event_source = ui::PlatformEventSource::CreateDefault();
221 #elif defined(USE_OZONE) && defined(OZONE_X11)
222 // If we might be running Ozone X11 we need a UI loop to grab Expose events.
223 // See GLSurfaceGLX and https://crbug.com/326995.
224 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
225 #elif defined(USE_OZONE) 225 #elif defined(USE_OZONE)
226 main_message_loop.reset( 226 // Create the OzonePlatform instance without doing any initialization.
227 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); 227 // This is needed so that we can inquery a MessageLoopType, which varies
fwang 2017/02/07 17:03:46 inquire?
kylechar 2017/02/07 17:41:46 Maybe replace the last sentence with something lik
tonikitoo 2017/02/07 19:36:41 Done.
228 // depending on the runtime platform selection.
229 ui::OzonePlatform::CreateInstance();
230 main_message_loop.reset(new base::MessageLoop(
231 ui::OzonePlatform::GetInstance()->GetMessageLoopTypeForGpu()));
228 #elif defined(OS_LINUX) 232 #elif defined(OS_LINUX)
229 #error "Unsupported Linux platform." 233 #error "Unsupported Linux platform."
230 #elif defined(OS_MACOSX) 234 #elif defined(OS_MACOSX)
231 // This is necessary for CoreAnimation layers hosted in the GPU process to 235 // This is necessary for CoreAnimation layers hosted in the GPU process to
232 // be drawn. See http://crbug.com/312462. 236 // be drawn. See http://crbug.com/312462.
233 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); 237 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop());
234 main_message_loop.reset(new base::MessageLoop(std::move(pump))); 238 main_message_loop.reset(new base::MessageLoop(std::move(pump)));
235 #else 239 #else
236 main_message_loop.reset( 240 main_message_loop.reset(
237 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); 241 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 return true; 362 return true;
359 } 363 }
360 364
361 return false; 365 return false;
362 } 366 }
363 #endif // defined(OS_WIN) 367 #endif // defined(OS_WIN)
364 368
365 } // namespace. 369 } // namespace.
366 370
367 } // namespace content 371 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/BUILD.gn ('k') | services/ui/gpu/gpu_main.cc » ('j') | services/ui/gpu/gpu_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698