OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/ui/gpu/gpu_main.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
| 9 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 10 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
| 11 #include "services/ui/gpu/gpu_service_internal.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 GpuMain::GpuMain() { |
| 16 gpu_init_.set_sandbox_helper(this); |
| 17 bool success = gpu_init_.InitializeAndStartSandbox( |
| 18 *base::CommandLine::ForCurrentProcess()); |
| 19 if (success) { |
| 20 if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) { |
| 21 gpu_memory_buffer_factory_ = |
| 22 gpu::GpuMemoryBufferFactory::CreateNativeType(); |
| 23 } |
| 24 gpu_service_internal_.reset(new GpuServiceInternal( |
| 25 gpu_init_.gpu_info(), gpu_init_.watchdog_thread(), |
| 26 gpu_memory_buffer_factory_.get())); |
| 27 } |
| 28 } |
| 29 |
| 30 GpuMain::~GpuMain() { |
| 31 if (gpu_init_.watchdog_thread()) |
| 32 gpu_init_.watchdog_thread()->Stop(); |
| 33 } |
| 34 |
| 35 void GpuMain::Add(mojom::GpuServiceInternalRequest request) { |
| 36 if (gpu_service_internal_) |
| 37 gpu_service_internal_->Add(std::move(request)); |
| 38 } |
| 39 |
| 40 void GpuMain::PreSandboxStartup() { |
| 41 // TODO(sad): https://crbug.com/645602 |
| 42 } |
| 43 |
| 44 bool GpuMain::EnsureSandboxInitialized() { |
| 45 // TODO(sad): https://crbug.com/645602 |
| 46 return true; |
| 47 } |
| 48 |
| 49 } // namespace ui |
OLD | NEW |