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

Unified Diff: sky/shell/instance.cc

Issue 1187503003: Refactor SkyShell to allow multiple SkyViews (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
Index: sky/shell/instance.cc
diff --git a/sky/shell/instance.cc b/sky/shell/instance.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bd2d2c962e6a006b9c4bb723b6835f9e86dd7122
--- /dev/null
+++ b/sky/shell/instance.cc
@@ -0,0 +1,43 @@
+// Copyright 2015 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 "sky/shell/instance.h"
+
+#include "base/bind.h"
+#include "base/single_thread_task_runner.h"
+#include "sky/shell/gpu/rasterizer.h"
+#include "sky/shell/platform_view.h"
+#include "sky/shell/shell.h"
+#include "sky/shell/ui/engine.h"
+
+namespace sky {
+namespace shell {
+
+Instance::Instance(Shell& shell)
+ : shell_(shell) {
+ rasterizer_.reset(new Rasterizer());
+ CreateEngine();
+ CreateView();
+}
+
+Instance::~Instance() {
+}
+
+void Instance::CreateEngine() {
+ Engine::Config config;
+ config.service_provider_context = shell_.service_provider_context();
+ config.gpu_task_runner = shell_.gpu_task_runner();
+ config.gpu_delegate = rasterizer_->GetWeakPtr();
+ engine_.reset(new Engine(config));
+}
+
+void Instance::CreateView() {
+ PlatformView::Config config;
+ config.ui_task_runner = shell_.ui_task_runner();
+ config.ui_delegate = engine_->GetWeakPtr();
+ view_.reset(PlatformView::Create(config));
+}
+
+} // namespace shell
+} // namespace sky

Powered by Google App Engine
This is Rietveld 408576698