Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/gpu/gpu_main.h" | 5 #include "services/ui/gpu/gpu_main.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| 11 #include "gpu/ipc/gpu_in_process_thread_service.h" | 11 #include "gpu/ipc/gpu_in_process_thread_service.h" |
| 12 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 12 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 13 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 13 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 14 #include "services/ui/common/server_gpu_memory_buffer_manager.h" | 14 #include "services/ui/common/server_gpu_memory_buffer_manager.h" |
| 15 #include "services/ui/gpu/gpu_service.h" | 15 #include "services/ui/gpu/gpu_service.h" |
| 16 | 16 |
| 17 #if defined(USE_OZONE) | |
| 18 #include "ui/ozone/public/ozone_platform.h" | |
| 19 #endif | |
| 20 | |
| 17 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
| 18 #include "base/message_loop/message_pump_mac.h" | 22 #include "base/message_loop/message_pump_mac.h" |
| 19 #endif | 23 #endif |
| 20 | 24 |
| 21 namespace { | 25 namespace { |
| 22 | 26 |
| 23 #if defined(USE_X11) | 27 #if defined(USE_X11) |
| 24 std::unique_ptr<base::MessagePump> CreateMessagePumpX11() { | 28 std::unique_ptr<base::MessagePump> CreateMessagePumpX11() { |
| 25 // TODO(sad): This should create a TYPE_UI message pump, and create a | 29 // TODO(sad): This should create a TYPE_UI message pump, and create a |
| 26 // PlatformEventSource when gpu process split happens. | 30 // PlatformEventSource when gpu process split happens. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 44 io_thread_("GpuIOThread"), | 48 io_thread_("GpuIOThread"), |
| 45 compositor_thread_("DisplayCompositorThread"), | 49 compositor_thread_("DisplayCompositorThread"), |
| 46 binding_(this, std::move(request)) { | 50 binding_(this, std::move(request)) { |
| 47 base::Thread::Options thread_options; | 51 base::Thread::Options thread_options; |
| 48 | 52 |
| 49 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 50 thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 54 thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
| 51 #elif defined(USE_X11) | 55 #elif defined(USE_X11) |
| 52 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpX11); | 56 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpX11); |
| 53 #elif defined(USE_OZONE) | 57 #elif defined(USE_OZONE) |
| 54 thread_options.message_loop_type = base::MessageLoop::TYPE_UI; | 58 // Create the OzonePlatform instance without doing any initialization. |
| 59 // The MessageLoop type required depends on the Ozone platform selected at | |
| 60 // runtime. | |
| 61 ui::OzonePlatform::CreateInstance(); | |
|
sadrul
2017/02/08 01:49:26
We should not have this here.
tonikitoo
2017/02/08 02:42:34
It was originally suggested by kyle in https://cod
| |
| 62 thread_options.message_loop_type = | |
| 63 ui::OzonePlatform::GetInstance()->GetMessageLoopTypeForGpu(); | |
| 55 #elif defined(OS_LINUX) | 64 #elif defined(OS_LINUX) |
| 56 thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 65 thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
| 57 #elif defined(OS_MACOSX) | 66 #elif defined(OS_MACOSX) |
| 58 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpMac); | 67 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpMac); |
| 59 #else | 68 #else |
| 60 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; | 69 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 61 #endif | 70 #endif |
| 62 | 71 |
| 63 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 72 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 64 thread_options.priority = base::ThreadPriority::DISPLAY; | 73 thread_options.priority = base::ThreadPriority::DISPLAY; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 // TODO(sad): https://crbug.com/645602 | 247 // TODO(sad): https://crbug.com/645602 |
| 239 } | 248 } |
| 240 | 249 |
| 241 bool GpuMain::EnsureSandboxInitialized( | 250 bool GpuMain::EnsureSandboxInitialized( |
| 242 gpu::GpuWatchdogThread* watchdog_thread) { | 251 gpu::GpuWatchdogThread* watchdog_thread) { |
| 243 // TODO(sad): https://crbug.com/645602 | 252 // TODO(sad): https://crbug.com/645602 |
| 244 return true; | 253 return true; |
| 245 } | 254 } |
| 246 | 255 |
| 247 } // namespace ui | 256 } // namespace ui |
| OLD | NEW |