Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: services/ui/gpu/gpu_main.cc

Issue 2329543002: services/ui: Use new gpu::GpuInit to do the GPU initialization. (Closed)
Patch Set: nullcheck Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/gpu/gpu_main.h ('k') | services/ui/gpu/gpu_service_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/gpu/gpu_main.cc
diff --git a/services/ui/gpu/gpu_main.cc b/services/ui/gpu/gpu_main.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ae9d93c694a5116cd287548b4f56838d69c84e20
--- /dev/null
+++ b/services/ui/gpu/gpu_main.cc
@@ -0,0 +1,49 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/ui/gpu/gpu_main.h"
+
+#include "base/command_line.h"
+#include "gpu/ipc/common/gpu_memory_buffer_support.h"
+#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
+#include "gpu/ipc/service/gpu_watchdog_thread.h"
+#include "services/ui/gpu/gpu_service_internal.h"
+
+namespace ui {
+
+GpuMain::GpuMain() {
+ gpu_init_.set_sandbox_helper(this);
+ bool success = gpu_init_.InitializeAndStartSandbox(
+ *base::CommandLine::ForCurrentProcess());
+ if (success) {
+ if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) {
+ gpu_memory_buffer_factory_ =
+ gpu::GpuMemoryBufferFactory::CreateNativeType();
+ }
+ gpu_service_internal_.reset(new GpuServiceInternal(
+ gpu_init_.gpu_info(), gpu_init_.watchdog_thread(),
+ gpu_memory_buffer_factory_.get()));
+ }
+}
+
+GpuMain::~GpuMain() {
+ if (gpu_init_.watchdog_thread())
+ gpu_init_.watchdog_thread()->Stop();
+}
+
+void GpuMain::Add(mojom::GpuServiceInternalRequest request) {
+ if (gpu_service_internal_)
+ gpu_service_internal_->Add(std::move(request));
+}
+
+void GpuMain::PreSandboxStartup() {
+ // TODO(sad): https://crbug.com/645602
+}
+
+bool GpuMain::EnsureSandboxInitialized() {
+ // TODO(sad): https://crbug.com/645602
+ return true;
+}
+
+} // namespace ui
« no previous file with comments | « services/ui/gpu/gpu_main.h ('k') | services/ui/gpu/gpu_service_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698