| 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 "base/power_monitor/power_monitor_device_source.h" | 10 #include "base/power_monitor/power_monitor_device_source.h" |
| 11 #include "gpu/command_buffer/common/activity_flags.h" | 11 #include "gpu/command_buffer/common/activity_flags.h" |
| 12 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 12 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| 13 #include "gpu/ipc/gpu_in_process_thread_service.h" | 13 #include "gpu/ipc/gpu_in_process_thread_service.h" |
| 14 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 14 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 15 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 15 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 16 #include "services/ui/common/server_gpu_memory_buffer_manager.h" | 16 #include "services/ui/common/server_gpu_memory_buffer_manager.h" |
| 17 #include "services/ui/gpu/gpu_service.h" | 17 #include "services/ui/gpu/gpu_service.h" |
| 18 #include "services/ui/surfaces/mus_display_provider.h" |
| 18 | 19 |
| 19 #if defined(USE_OZONE) | 20 #if defined(USE_OZONE) |
| 20 #include "ui/ozone/public/ozone_platform.h" | 21 #include "ui/ozone/public/ozone_platform.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
| 24 #include "base/message_loop/message_pump_mac.h" | 25 #include "base/message_loop/message_pump_mac.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 gpu::ImageFactory* image_factory, | 207 gpu::ImageFactory* image_factory, |
| 207 mojom::GpuServicePtrInfo gpu_service_info, | 208 mojom::GpuServicePtrInfo gpu_service_info, |
| 208 cc::mojom::DisplayCompositorRequest request, | 209 cc::mojom::DisplayCompositorRequest request, |
| 209 cc::mojom::DisplayCompositorClientPtrInfo client_info) { | 210 cc::mojom::DisplayCompositorClientPtrInfo client_info) { |
| 210 DCHECK(!display_compositor_); | 211 DCHECK(!display_compositor_); |
| 211 cc::mojom::DisplayCompositorClientPtr client; | 212 cc::mojom::DisplayCompositorClientPtr client; |
| 212 client.Bind(std::move(client_info)); | 213 client.Bind(std::move(client_info)); |
| 213 | 214 |
| 214 gpu_internal_.Bind(std::move(gpu_service_info)); | 215 gpu_internal_.Bind(std::move(gpu_service_info)); |
| 215 | 216 |
| 217 display_provider_ = base::MakeUnique<MusDisplayProvider>( |
| 218 gpu_command_service_, |
| 219 base::MakeUnique<ServerGpuMemoryBufferManager>(gpu_internal_.get(), |
| 220 1 /* client_id */), |
| 221 image_factory); |
| 222 |
| 216 display_compositor_ = base::MakeUnique<DisplayCompositor>( | 223 display_compositor_ = base::MakeUnique<DisplayCompositor>( |
| 217 gpu_command_service_, base::MakeUnique<ServerGpuMemoryBufferManager>( | 224 display_provider_.get(), std::move(request), std::move(client)); |
| 218 gpu_internal_.get(), 1 /* client_id */), | |
| 219 image_factory, std::move(request), std::move(client)); | |
| 220 } | 225 } |
| 221 | 226 |
| 222 void GpuMain::TearDownOnCompositorThread() { | 227 void GpuMain::TearDownOnCompositorThread() { |
| 223 display_compositor_.reset(); | 228 display_compositor_.reset(); |
| 229 display_provider_.reset(); |
| 224 gpu_internal_.reset(); | 230 gpu_internal_.reset(); |
| 225 } | 231 } |
| 226 | 232 |
| 227 void GpuMain::TearDownOnGpuThread() { | 233 void GpuMain::TearDownOnGpuThread() { |
| 228 gpu_service_.reset(); | 234 gpu_service_.reset(); |
| 229 gpu_memory_buffer_factory_.reset(); | 235 gpu_memory_buffer_factory_.reset(); |
| 230 gpu_init_.reset(); | 236 gpu_init_.reset(); |
| 231 } | 237 } |
| 232 | 238 |
| 233 void GpuMain::CreateGpuServiceOnGpuThread( | 239 void GpuMain::CreateGpuServiceOnGpuThread( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 256 // TODO(sad): https://crbug.com/645602 | 262 // TODO(sad): https://crbug.com/645602 |
| 257 } | 263 } |
| 258 | 264 |
| 259 bool GpuMain::EnsureSandboxInitialized( | 265 bool GpuMain::EnsureSandboxInitialized( |
| 260 gpu::GpuWatchdogThread* watchdog_thread) { | 266 gpu::GpuWatchdogThread* watchdog_thread) { |
| 261 // TODO(sad): https://crbug.com/645602 | 267 // TODO(sad): https://crbug.com/645602 |
| 262 return true; | 268 return true; |
| 263 } | 269 } |
| 264 | 270 |
| 265 } // namespace ui | 271 } // namespace ui |
| OLD | NEW |