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 <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 29 matching lines...) Expand all Loading... | |
| 40 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 40 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 41 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 41 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 42 #include "ui/events/platform/platform_event_source.h" | 42 #include "ui/events/platform/platform_event_source.h" |
| 43 #include "ui/gfx/switches.h" | 43 #include "ui/gfx/switches.h" |
| 44 #include "ui/gl/gl_context.h" | 44 #include "ui/gl/gl_context.h" |
| 45 #include "ui/gl/gl_implementation.h" | 45 #include "ui/gl/gl_implementation.h" |
| 46 #include "ui/gl/gl_surface.h" | 46 #include "ui/gl/gl_surface.h" |
| 47 #include "ui/gl/gl_switches.h" | 47 #include "ui/gl/gl_switches.h" |
| 48 #include "ui/gl/gpu_switching_manager.h" | 48 #include "ui/gl/gpu_switching_manager.h" |
| 49 #include "ui/gl/init/gl_factory.h" | 49 #include "ui/gl/init/gl_factory.h" |
| 50 #include "ui/ozone/public/ozone_platform.h" | |
| 50 | 51 |
| 51 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
| 52 #include <windows.h> | 53 #include <windows.h> |
| 53 #include <dwmapi.h> | 54 #include <dwmapi.h> |
| 54 #endif | 55 #endif |
| 55 | 56 |
| 56 #if defined(OS_ANDROID) | 57 #if defined(OS_ANDROID) |
| 57 #include "base/trace_event/memory_dump_manager.h" | 58 #include "base/trace_event/memory_dump_manager.h" |
| 58 #include "components/tracing/common/graphics_memory_dump_provider_android.h" | 59 #include "components/tracing/common/graphics_memory_dump_provider_android.h" |
| 59 #endif | 60 #endif |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 #if defined(OS_WIN) | 211 #if defined(OS_WIN) |
| 211 // OK to use default non-UI message loop because all GPU windows run on | 212 // OK to use default non-UI message loop because all GPU windows run on |
| 212 // dedicated thread. | 213 // dedicated thread. |
| 213 main_message_loop.reset( | 214 main_message_loop.reset( |
| 214 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | 215 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
| 215 #elif defined(USE_X11) | 216 #elif defined(USE_X11) |
| 216 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX | 217 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX |
| 217 // and https://crbug.com/326995. | 218 // and https://crbug.com/326995. |
| 218 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); | 219 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
| 219 event_source = ui::PlatformEventSource::CreateDefault(); | 220 event_source = ui::PlatformEventSource::CreateDefault(); |
| 220 #elif defined(USE_OZONE) && defined(OZONE_X11) | |
| 221 // If we might be running Ozone X11 we need a UI loop to grab Expose events. | |
| 222 // See GLSurfaceGLX and https://crbug.com/326995. | |
| 223 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); | |
| 224 #elif defined(USE_OZONE) | 221 #elif defined(USE_OZONE) |
| 225 main_message_loop.reset( | 222 main_message_loop.reset( |
| 226 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | 223 new base::MessageLoop(ui::OzonePlatform::GetMessageLoopType())); |
|
sadrul
2017/01/31 17:12:36
Is there a reason to not always use TYPE_UI here?
| |
| 227 #elif defined(OS_LINUX) | 224 #elif defined(OS_LINUX) |
| 228 #error "Unsupported Linux platform." | 225 #error "Unsupported Linux platform." |
| 229 #elif defined(OS_MACOSX) | 226 #elif defined(OS_MACOSX) |
| 230 // This is necessary for CoreAnimation layers hosted in the GPU process to | 227 // This is necessary for CoreAnimation layers hosted in the GPU process to |
| 231 // be drawn. See http://crbug.com/312462. | 228 // be drawn. See http://crbug.com/312462. |
| 232 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); | 229 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); |
| 233 main_message_loop.reset(new base::MessageLoop(std::move(pump))); | 230 main_message_loop.reset(new base::MessageLoop(std::move(pump))); |
| 234 #else | 231 #else |
| 235 main_message_loop.reset( | 232 main_message_loop.reset( |
| 236 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | 233 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 return true; | 354 return true; |
| 358 } | 355 } |
| 359 | 356 |
| 360 return false; | 357 return false; |
| 361 } | 358 } |
| 362 #endif // defined(OS_WIN) | 359 #endif // defined(OS_WIN) |
| 363 | 360 |
| 364 } // namespace. | 361 } // namespace. |
| 365 | 362 |
| 366 } // namespace content | 363 } // namespace content |
| OLD | NEW |