| 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/command_buffer/common/activity_flags.h" |
| 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | 11 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| 11 #include "gpu/ipc/gpu_in_process_thread_service.h" | 12 #include "gpu/ipc/gpu_in_process_thread_service.h" |
| 12 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 13 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 13 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 14 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 14 #include "services/ui/common/server_gpu_memory_buffer_manager.h" | 15 #include "services/ui/common/server_gpu_memory_buffer_manager.h" |
| 15 #include "services/ui/gpu/gpu_service.h" | 16 #include "services/ui/gpu/gpu_service.h" |
| 16 | 17 |
| 17 #if defined(USE_OZONE) | 18 #if defined(USE_OZONE) |
| 18 #include "ui/ozone/public/ozone_platform.h" | 19 #include "ui/ozone/public/ozone_platform.h" |
| 19 #endif | 20 #endif |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // |this| will outlive the gpu thread and so it's safe to use | 112 // |this| will outlive the gpu thread and so it's safe to use |
| 112 // base::Unretained here. | 113 // base::Unretained here. |
| 113 gpu_thread_task_runner_->PostTask( | 114 gpu_thread_task_runner_->PostTask( |
| 114 FROM_HERE, | 115 FROM_HERE, |
| 115 base::Bind(&GpuMain::InitOnGpuThread, base::Unretained(this), | 116 base::Bind(&GpuMain::InitOnGpuThread, base::Unretained(this), |
| 116 io_thread_.task_runner(), compositor_thread_task_runner_)); | 117 io_thread_.task_runner(), compositor_thread_task_runner_)); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void GpuMain::CreateGpuService(mojom::GpuServiceRequest request, | 120 void GpuMain::CreateGpuService(mojom::GpuServiceRequest request, |
| 120 mojom::GpuHostPtr gpu_host, | 121 mojom::GpuHostPtr gpu_host, |
| 121 const gpu::GpuPreferences& preferences) { | 122 const gpu::GpuPreferences& preferences, |
| 123 mojo::ScopedSharedBufferHandle activity_flags) { |
| 122 // |this| will outlive the gpu thread and so it's safe to use | 124 // |this| will outlive the gpu thread and so it's safe to use |
| 123 // base::Unretained here. | 125 // base::Unretained here. |
| 124 gpu_thread_task_runner_->PostTask( | 126 gpu_thread_task_runner_->PostTask( |
| 125 FROM_HERE, | 127 FROM_HERE, |
| 126 base::Bind(&GpuMain::CreateGpuServiceOnGpuThread, base::Unretained(this), | 128 base::Bind(&GpuMain::CreateGpuServiceOnGpuThread, base::Unretained(this), |
| 127 base::Passed(std::move(request)), | 129 base::Passed(std::move(request)), |
| 128 base::Passed(gpu_host.PassInterface()), preferences)); | 130 base::Passed(gpu_host.PassInterface()), preferences, |
| 131 base::Passed( |
| 132 gpu::GpuProcessActivityFlags(std::move(activity_flags))))); |
| 129 } | 133 } |
| 130 | 134 |
| 131 void GpuMain::CreateDisplayCompositor( | 135 void GpuMain::CreateDisplayCompositor( |
| 132 cc::mojom::DisplayCompositorRequest request, | 136 cc::mojom::DisplayCompositorRequest request, |
| 133 cc::mojom::DisplayCompositorClientPtr client) { | 137 cc::mojom::DisplayCompositorClientPtr client) { |
| 134 if (!gpu_service_) { | 138 if (!gpu_service_) { |
| 135 pending_display_compositor_request_ = std::move(request); | 139 pending_display_compositor_request_ = std::move(request); |
| 136 pending_display_compositor_client_info_ = client.PassInterface(); | 140 pending_display_compositor_client_info_ = client.PassInterface(); |
| 137 return; | 141 return; |
| 138 } | 142 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 224 |
| 221 void GpuMain::TearDownOnGpuThread() { | 225 void GpuMain::TearDownOnGpuThread() { |
| 222 gpu_service_.reset(); | 226 gpu_service_.reset(); |
| 223 gpu_memory_buffer_factory_.reset(); | 227 gpu_memory_buffer_factory_.reset(); |
| 224 gpu_init_.reset(); | 228 gpu_init_.reset(); |
| 225 } | 229 } |
| 226 | 230 |
| 227 void GpuMain::CreateGpuServiceOnGpuThread( | 231 void GpuMain::CreateGpuServiceOnGpuThread( |
| 228 mojom::GpuServiceRequest request, | 232 mojom::GpuServiceRequest request, |
| 229 mojom::GpuHostPtrInfo gpu_host_info, | 233 mojom::GpuHostPtrInfo gpu_host_info, |
| 230 const gpu::GpuPreferences& preferences) { | 234 const gpu::GpuPreferences& preferences, |
| 235 gpu::GpuProcessActivityFlags activity_flags) { |
| 231 mojom::GpuHostPtr gpu_host; | 236 mojom::GpuHostPtr gpu_host; |
| 232 gpu_host.Bind(std::move(gpu_host_info)); | 237 gpu_host.Bind(std::move(gpu_host_info)); |
| 233 gpu_service_->InitializeWithHost(std::move(gpu_host), preferences); | 238 gpu_service_->InitializeWithHost(std::move(gpu_host), preferences, |
| 239 std::move(activity_flags)); |
| 234 gpu_service_->Bind(std::move(request)); | 240 gpu_service_->Bind(std::move(request)); |
| 235 | 241 |
| 236 if (pending_display_compositor_request_.is_pending()) { | 242 if (pending_display_compositor_request_.is_pending()) { |
| 237 CreateDisplayCompositorInternal( | 243 CreateDisplayCompositorInternal( |
| 238 std::move(pending_display_compositor_request_), | 244 std::move(pending_display_compositor_request_), |
| 239 std::move(pending_display_compositor_client_info_)); | 245 std::move(pending_display_compositor_client_info_)); |
| 240 } | 246 } |
| 241 } | 247 } |
| 242 | 248 |
| 243 void GpuMain::BindGpuInternalOnGpuThread(mojom::GpuServiceRequest request) { | 249 void GpuMain::BindGpuInternalOnGpuThread(mojom::GpuServiceRequest request) { |
| 244 gpu_service_->Bind(std::move(request)); | 250 gpu_service_->Bind(std::move(request)); |
| 245 } | 251 } |
| 246 | 252 |
| 247 void GpuMain::PreSandboxStartup() { | 253 void GpuMain::PreSandboxStartup() { |
| 248 // TODO(sad): https://crbug.com/645602 | 254 // TODO(sad): https://crbug.com/645602 |
| 249 } | 255 } |
| 250 | 256 |
| 251 bool GpuMain::EnsureSandboxInitialized( | 257 bool GpuMain::EnsureSandboxInitialized( |
| 252 gpu::GpuWatchdogThread* watchdog_thread) { | 258 gpu::GpuWatchdogThread* watchdog_thread) { |
| 253 // TODO(sad): https://crbug.com/645602 | 259 // TODO(sad): https://crbug.com/645602 |
| 254 return true; | 260 return true; |
| 255 } | 261 } |
| 256 | 262 |
| 257 } // namespace ui | 263 } // namespace ui |
| OLD | NEW |