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 gpu_init_.watchdog_thread()->Stop(); | |
32 } | |
33 | |
34 void GpuMain::Add(mojom::GpuServiceInternalRequest request) { | |
35 if (gpu_service_internal_) | |
36 gpu_service_internal_->Add(std::move(request)); | |
37 } | |
38 | |
39 void GpuMain::PreSandboxStartup() { | |
40 // TODO(sad): https://crbug.com/645602 | |
41 } | |
42 | |
43 bool GpuMain::EnsureSandboxInitialized() { | |
44 // TODO(sad): https://crbug.com/645602 | |
45 return true; | |
46 } | |
47 | |
48 } // namespace ui | |
OLD | NEW |