flutter_flutter/shell/shell_view.cc
Adam Barth c8e5668ddb Refactor SkyShell to allow multiple SkyViews
This CL separates the view-specific state from the process-global state. The
view-specific state now lives on Instance rather than Shell.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1187503003.
2015-06-12 13:29:53 -07:00

44 lines
1.1 KiB
C++

// 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/shell_view.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 {
ShellView::ShellView(Shell& shell)
: shell_(shell) {
rasterizer_.reset(new Rasterizer());
CreateEngine();
CreatePlatformView();
}
ShellView::~ShellView() {
}
void ShellView::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 ShellView::CreatePlatformView() {
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