| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 9 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| 10 #include "gpu/ipc/gpu_in_process_thread_service.h" | 10 #include "gpu/ipc/gpu_in_process_thread_service.h" |
| 11 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 11 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 12 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 12 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 13 #include "services/ui/common/server_gpu_memory_buffer_manager.h" | 13 #include "services/ui/common/server_gpu_memory_buffer_manager.h" |
| 14 #include "services/ui/gpu/gpu_service.h" | 14 #include "services/ui/gpu/gpu_service.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 #if defined(OS_WIN) | |
| 19 std::unique_ptr<base::MessagePump> CreateMessagePumpWin() { | |
| 20 base::MessagePumpForGpu::InitFactory(); | |
| 21 return base::MessageLoop::CreateMessagePumpForType( | |
| 22 base::MessageLoop::TYPE_UI); | |
| 23 } | |
| 24 #endif // defined(OS_WIN) | |
| 25 | |
| 26 #if defined(USE_X11) | 18 #if defined(USE_X11) |
| 27 std::unique_ptr<base::MessagePump> CreateMessagePumpX11() { | 19 std::unique_ptr<base::MessagePump> CreateMessagePumpX11() { |
| 28 // TODO(sad): This should create a TYPE_UI message pump, and create a | 20 // TODO(sad): This should create a TYPE_UI message pump, and create a |
| 29 // PlatformEventSource when gpu process split happens. | 21 // PlatformEventSource when gpu process split happens. |
| 30 return base::MessageLoop::CreateMessagePumpForType( | 22 return base::MessageLoop::CreateMessagePumpForType( |
| 31 base::MessageLoop::TYPE_DEFAULT); | 23 base::MessageLoop::TYPE_DEFAULT); |
| 32 } | 24 } |
| 33 #endif // defined(USE_X11) | 25 #endif // defined(USE_X11) |
| 34 | 26 |
| 35 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
| 36 std::unique_ptr<base::MessagePump> CreateMessagePumpMac() { | 28 std::unique_ptr<base::MessagePump> CreateMessagePumpMac() { |
| 37 return base::MakeUnique<base::MessagePumpCFRunLoop>(); | 29 return base::MakeUnique<base::MessagePumpCFRunLoop>(); |
| 38 } | 30 } |
| 39 #endif // defined(OS_MACOSX) | 31 #endif // defined(OS_MACOSX) |
| 40 | 32 |
| 41 } // namespace | 33 } // namespace |
| 42 | 34 |
| 43 namespace ui { | 35 namespace ui { |
| 44 | 36 |
| 45 GpuMain::GpuMain(mojom::GpuMainRequest request) | 37 GpuMain::GpuMain(mojom::GpuMainRequest request) |
| 46 : gpu_thread_("GpuThread"), | 38 : gpu_thread_("GpuThread"), |
| 47 io_thread_("GpuIOThread"), | 39 io_thread_("GpuIOThread"), |
| 48 compositor_thread_("DisplayCompositorThread"), | 40 compositor_thread_("DisplayCompositorThread"), |
| 49 binding_(this, std::move(request)) { | 41 binding_(this, std::move(request)) { |
| 50 base::Thread::Options thread_options; | 42 base::Thread::Options thread_options; |
| 51 | 43 |
| 52 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 53 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpWin); | 45 thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
| 54 #elif defined(USE_X11) | 46 #elif defined(USE_X11) |
| 55 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpX11); | 47 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpX11); |
| 56 #elif defined(USE_OZONE) | 48 #elif defined(USE_OZONE) |
| 57 thread_options.message_loop_type = base::MessageLoop::TYPE_UI; | 49 thread_options.message_loop_type = base::MessageLoop::TYPE_UI; |
| 58 #elif defined(OS_LINUX) | 50 #elif defined(OS_LINUX) |
| 59 thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 51 thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
| 60 #elif defined(OS_MACOSX) | 52 #elif defined(OS_MACOSX) |
| 61 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpMac); | 53 thread_options.message_pump_factory = base::Bind(&CreateMessagePumpMac); |
| 62 #else | 54 #else |
| 63 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; | 55 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // TODO(sad): https://crbug.com/645602 | 231 // TODO(sad): https://crbug.com/645602 |
| 240 } | 232 } |
| 241 | 233 |
| 242 bool GpuMain::EnsureSandboxInitialized( | 234 bool GpuMain::EnsureSandboxInitialized( |
| 243 gpu::GpuWatchdogThread* watchdog_thread) { | 235 gpu::GpuWatchdogThread* watchdog_thread) { |
| 244 // TODO(sad): https://crbug.com/645602 | 236 // TODO(sad): https://crbug.com/645602 |
| 245 return true; | 237 return true; |
| 246 } | 238 } |
| 247 | 239 |
| 248 } // namespace ui | 240 } // namespace ui |
| OLD | NEW |