提交 b2058f8b 编写于 作者: A Adam Barth 提交者: GitHub

Rename SkyView to RuntimeController (#2924)

Also, rename SkyViewClient to RuntimeDelegate. These names are more
sensible.

This patch also cleans up the RuntimeDelegate a bit, for example by
removing support for flushing real-time events, which aren't used.
上级 0a439f3f
...@@ -172,15 +172,12 @@ class Window { ...@@ -172,15 +172,12 @@ class Window {
/// graphical operations, call the [endRecording] function on the /// graphical operations, call the [endRecording] function on the
/// [PictureRecorder] to obtain the final [Picture] that represents /// [PictureRecorder] to obtain the final [Picture] that represents
/// the issued graphical operations. /// the issued graphical operations.
/// ///
/// Next, create a [SceneBuilder], and add the [Picture] to it using /// Next, create a [SceneBuilder], and add the [Picture] to it using
/// [SceneBuilder.addPicture]. With the [SceneBuilder.build] method /// [SceneBuilder.addPicture]. With the [SceneBuilder.build] method
/// you can then obtain a [Scene] object, which you can display to /// you can then obtain a [Scene] object, which you can display to
/// the user via this [render] function. /// the user via this [render] function.
void render(Scene scene) native "Window_render"; void render(Scene scene) native "Window_render";
/// Flushes pending real-time events, executing their callbacks.
void flushRealTimeEvents() native "Scheduler_FlushRealTimeEvents";
} }
/// The [Window] singleton. This object exposes the size of the display, the /// The [Window] singleton. This object exposes the size of the display, the
......
...@@ -33,10 +33,6 @@ void Render(Dart_NativeArguments args) { ...@@ -33,10 +33,6 @@ void Render(Dart_NativeArguments args) {
UIDartState::Current()->window()->client()->Render(scene); UIDartState::Current()->window()->client()->Render(scene);
} }
void FlushRealTimeEvents(Dart_NativeArguments args) {
UIDartState::Current()->window()->client()->FlushRealTimeEvents();
}
} // namespace } // namespace
WindowClient::~WindowClient() {} WindowClient::~WindowClient() {}
...@@ -154,7 +150,6 @@ void Window::RegisterNatives(tonic::DartLibraryNatives* natives) { ...@@ -154,7 +150,6 @@ void Window::RegisterNatives(tonic::DartLibraryNatives* natives) {
natives->Register({ natives->Register({
{"Window_scheduleFrame", ScheduleFrame, 1, true}, {"Window_scheduleFrame", ScheduleFrame, 1, true},
{"Window_render", Render, 2, true}, {"Window_render", Render, 2, true},
{"Scheduler_FlushRealTimeEvents", FlushRealTimeEvents, 1, true},
}); });
} }
......
...@@ -20,7 +20,6 @@ class Scene; ...@@ -20,7 +20,6 @@ class Scene;
class WindowClient { class WindowClient {
public: public:
virtual void ScheduleFrame() = 0; virtual void ScheduleFrame() = 0;
virtual void FlushRealTimeEvents() = 0;
virtual void Render(Scene* scene) = 0; virtual void Render(Scene* scene) = 0;
protected: protected:
......
...@@ -46,10 +46,10 @@ source_set("runtime") { ...@@ -46,10 +46,10 @@ source_set("runtime") {
"dart_service_isolate.h", "dart_service_isolate.h",
"embedder_resources.cc", "embedder_resources.cc",
"embedder_resources.h", "embedder_resources.h",
"sky_view.cc", "runtime_controller.cc",
"sky_view_client.cc", "runtime_controller.h",
"sky_view_client.h", "runtime_delegate.cc",
"sky_view.h", "runtime_delegate.h",
"start_up.cc", "start_up.cc",
"start_up.h", "start_up.h",
] ]
......
...@@ -2,28 +2,50 @@ ...@@ -2,28 +2,50 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "flutter/runtime/sky_view.h" #include "flutter/runtime/runtime_controller.h"
#include "flutter/glue/trace_event.h" #include "flutter/glue/trace_event.h"
#include "flutter/lib/ui/compositing/scene.h" #include "flutter/lib/ui/compositing/scene.h"
#include "flutter/lib/ui/ui_dart_state.h" #include "flutter/lib/ui/ui_dart_state.h"
#include "flutter/lib/ui/window/window.h" #include "flutter/lib/ui/window/window.h"
#include "flutter/runtime/dart_controller.h" #include "flutter/runtime/dart_controller.h"
#include "flutter/runtime/sky_view_client.h" #include "flutter/runtime/runtime_delegate.h"
using tonic::DartState; using tonic::DartState;
namespace blink { namespace blink {
std::unique_ptr<SkyView> SkyView::Create(SkyViewClient* client) { std::unique_ptr<RuntimeController> RuntimeController::Create(
return std::unique_ptr<SkyView>(new SkyView(client)); RuntimeDelegate* client) {
return std::unique_ptr<RuntimeController>(new RuntimeController(client));
} }
SkyView::SkyView(SkyViewClient* client) : client_(client) {} RuntimeController::RuntimeController(RuntimeDelegate* client)
: client_(client) {}
SkyView::~SkyView() {} RuntimeController::~RuntimeController() {}
void SkyView::SetViewportMetrics(const sky::ViewportMetricsPtr& metrics) { void RuntimeController::CreateDartController(const std::string& script_uri) {
FTL_DCHECK(!dart_controller_);
dart_controller_.reset(new DartController());
std::unique_ptr<Window> window(new Window(this));
dart_controller_->CreateIsolateFor(
script_uri,
std::unique_ptr<UIDartState>(new UIDartState(this, std::move(window))));
UIDartState* dart_state = dart_controller_->dart_state();
DartState::Scope scope(dart_state);
dart_state->window()->DidCreateIsolate();
client_->DidCreateMainIsolate(dart_state->isolate());
if (viewport_metrics_)
GetWindow()->UpdateWindowMetrics(viewport_metrics_);
GetWindow()->UpdateLocale(language_code_, country_code_);
}
void RuntimeController::SetViewportMetrics(
const sky::ViewportMetricsPtr& metrics) {
if (metrics) { if (metrics) {
viewport_metrics_ = metrics->Clone(); viewport_metrics_ = metrics->Clone();
GetWindow()->UpdateWindowMetrics(viewport_metrics_); GetWindow()->UpdateWindowMetrics(viewport_metrics_);
...@@ -32,8 +54,8 @@ void SkyView::SetViewportMetrics(const sky::ViewportMetricsPtr& metrics) { ...@@ -32,8 +54,8 @@ void SkyView::SetViewportMetrics(const sky::ViewportMetricsPtr& metrics) {
} }
} }
void SkyView::SetLocale(const std::string& language_code, void RuntimeController::SetLocale(const std::string& language_code,
const std::string& country_code) { const std::string& country_code) {
if (language_code_ == language_code && country_code_ == country_code) if (language_code_ == language_code && country_code_ == country_code)
return; return;
...@@ -42,66 +64,46 @@ void SkyView::SetLocale(const std::string& language_code, ...@@ -42,66 +64,46 @@ void SkyView::SetLocale(const std::string& language_code,
GetWindow()->UpdateLocale(language_code_, country_code_); GetWindow()->UpdateLocale(language_code_, country_code_);
} }
void SkyView::PushRoute(const std::string& route) { void RuntimeController::PushRoute(const std::string& route) {
GetWindow()->PushRoute(route); GetWindow()->PushRoute(route);
} }
void SkyView::PopRoute() { void RuntimeController::PopRoute() {
GetWindow()->PopRoute(); GetWindow()->PopRoute();
} }
void SkyView::CreateView(const std::string& script_uri) { void RuntimeController::BeginFrame(ftl::TimePoint frame_time) {
FTL_DCHECK(!dart_controller_);
dart_controller_.reset(new DartController());
std::unique_ptr<Window> window(new Window(this));
dart_controller_->CreateIsolateFor(script_uri, std::unique_ptr<UIDartState>(
new UIDartState(this, std::move(window))));
UIDartState* dart_state = dart_controller_->dart_state();
DartState::Scope scope(dart_state);
dart_state->window()->DidCreateIsolate();
client_->DidCreateMainIsolate(dart_state->isolate());
if (viewport_metrics_)
GetWindow()->UpdateWindowMetrics(viewport_metrics_);
GetWindow()->UpdateLocale(language_code_, country_code_);
}
void SkyView::BeginFrame(ftl::TimePoint frame_time) {
GetWindow()->BeginFrame(frame_time); GetWindow()->BeginFrame(frame_time);
} }
void SkyView::HandlePointerPacket(const pointer::PointerPacketPtr& packet) { void RuntimeController::HandlePointerPacket(
TRACE_EVENT0("input", "SkyView::HandlePointerPacket"); const pointer::PointerPacketPtr& packet) {
TRACE_EVENT0("input", "RuntimeController::HandlePointerPacket");
GetWindow()->DispatchPointerPacket(packet); GetWindow()->DispatchPointerPacket(packet);
} }
Window* SkyView::GetWindow() { Window* RuntimeController::GetWindow() {
return dart_controller_->dart_state()->window(); return dart_controller_->dart_state()->window();
} }
void SkyView::ScheduleFrame() { void RuntimeController::ScheduleFrame() {
client_->ScheduleFrame(); client_->ScheduleFrame();
} }
void SkyView::FlushRealTimeEvents() { void RuntimeController::Render(Scene* scene) {
client_->FlushRealTimeEvents();
}
void SkyView::Render(Scene* scene) {
client_->Render(scene->takeLayerTree()); client_->Render(scene->takeLayerTree());
} }
void SkyView::DidCreateSecondaryIsolate(Dart_Isolate isolate) { void RuntimeController::DidCreateSecondaryIsolate(Dart_Isolate isolate) {
client_->DidCreateSecondaryIsolate(isolate); client_->DidCreateSecondaryIsolate(isolate);
} }
void SkyView::OnAppLifecycleStateChanged(sky::AppLifecycleState state) { void RuntimeController::OnAppLifecycleStateChanged(
sky::AppLifecycleState state) {
GetWindow()->OnAppLifecycleStateChanged(state); GetWindow()->OnAppLifecycleStateChanged(state);
} }
Dart_Port SkyView::GetMainPort() { Dart_Port RuntimeController::GetMainPort() {
if (!dart_controller_) { if (!dart_controller_) {
return ILLEGAL_PORT; return ILLEGAL_PORT;
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef FLUTTER_RUNTIME_SKY_VIEW_H_ #ifndef FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
#define FLUTTER_RUNTIME_SKY_VIEW_H_ #define FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
#include <memory> #include <memory>
...@@ -18,14 +18,17 @@ namespace blink { ...@@ -18,14 +18,17 @@ namespace blink {
class DartController; class DartController;
class DartLibraryProvider; class DartLibraryProvider;
class Scene; class Scene;
class SkyViewClient; class RuntimeDelegate;
class View; class View;
class Window; class Window;
class SkyView : public WindowClient, public IsolateClient { class RuntimeController : public WindowClient, public IsolateClient {
public: public:
static std::unique_ptr<SkyView> Create(SkyViewClient* client); static std::unique_ptr<RuntimeController> Create(RuntimeDelegate* client);
~SkyView(); ~RuntimeController();
void CreateDartController(const std::string& script_uri);
DartController* dart_controller() const { return dart_controller_.get(); }
void SetViewportMetrics(const sky::ViewportMetricsPtr& metrics); void SetViewportMetrics(const sky::ViewportMetricsPtr& metrics);
void SetLocale(const std::string& language_code, void SetLocale(const std::string& language_code,
...@@ -35,9 +38,6 @@ class SkyView : public WindowClient, public IsolateClient { ...@@ -35,9 +38,6 @@ class SkyView : public WindowClient, public IsolateClient {
void BeginFrame(ftl::TimePoint frame_time); void BeginFrame(ftl::TimePoint frame_time);
void CreateView(const std::string& script_uri);
DartController* dart_controller() const { return dart_controller_.get(); }
void HandlePointerPacket(const pointer::PointerPacketPtr& packet); void HandlePointerPacket(const pointer::PointerPacketPtr& packet);
void OnAppLifecycleStateChanged(sky::AppLifecycleState state); void OnAppLifecycleStateChanged(sky::AppLifecycleState state);
...@@ -45,25 +45,24 @@ class SkyView : public WindowClient, public IsolateClient { ...@@ -45,25 +45,24 @@ class SkyView : public WindowClient, public IsolateClient {
Dart_Port GetMainPort(); Dart_Port GetMainPort();
private: private:
explicit SkyView(SkyViewClient* client); explicit RuntimeController(RuntimeDelegate* client);
Window* GetWindow(); Window* GetWindow();
void ScheduleFrame() override; void ScheduleFrame() override;
void FlushRealTimeEvents() override;
void Render(Scene* scene) override; void Render(Scene* scene) override;
void DidCreateSecondaryIsolate(Dart_Isolate isolate) override; void DidCreateSecondaryIsolate(Dart_Isolate isolate) override;
SkyViewClient* client_; RuntimeDelegate* client_;
sky::ViewportMetricsPtr viewport_metrics_; sky::ViewportMetricsPtr viewport_metrics_;
std::string language_code_; std::string language_code_;
std::string country_code_; std::string country_code_;
std::unique_ptr<DartController> dart_controller_; std::unique_ptr<DartController> dart_controller_;
FTL_DISALLOW_COPY_AND_ASSIGN(SkyView); FTL_DISALLOW_COPY_AND_ASSIGN(RuntimeController);
}; };
} // namespace blink } // namespace blink
#endif // FLUTTER_RUNTIME_SKY_VIEW_H_ #endif // FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
...@@ -2,10 +2,14 @@ ...@@ -2,10 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "flutter/runtime/sky_view_client.h" #include "flutter/runtime/runtime_delegate.h"
namespace blink { namespace blink {
SkyViewClient::~SkyViewClient() {} RuntimeDelegate::~RuntimeDelegate() {}
void RuntimeDelegate::DidCreateMainIsolate(Dart_Isolate isolate) {}
void RuntimeDelegate::DidCreateSecondaryIsolate(Dart_Isolate isolate) {}
} // namespace blink } // namespace blink
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef FLUTTER_RUNTIME_SKY_VIEW_CLIENT_H_ #ifndef FLUTTER_RUNTIME_RUNTIME_DELEGATE_H_
#define FLUTTER_RUNTIME_SKY_VIEW_CLIENT_H_ #define FLUTTER_RUNTIME_RUNTIME_DELEGATE_H_
#include <memory> #include <memory>
...@@ -12,19 +12,18 @@ ...@@ -12,19 +12,18 @@
namespace blink { namespace blink {
class SkyViewClient { class RuntimeDelegate {
public: public:
virtual void ScheduleFrame() = 0; virtual void ScheduleFrame() = 0;
virtual void FlushRealTimeEvents() = 0;
virtual void Render(std::unique_ptr<flow::LayerTree> layer_tree) = 0; virtual void Render(std::unique_ptr<flow::LayerTree> layer_tree) = 0;
virtual void DidCreateMainIsolate(Dart_Isolate isolate) = 0; virtual void DidCreateMainIsolate(Dart_Isolate isolate);
virtual void DidCreateSecondaryIsolate(Dart_Isolate isolate) = 0; virtual void DidCreateSecondaryIsolate(Dart_Isolate isolate);
protected: protected:
virtual ~SkyViewClient(); virtual ~RuntimeDelegate();
}; };
} // namespace blink } // namespace blink
#endif // FLUTTER_RUNTIME_SKY_VIEW_CLIENT_H_ #endif // FLUTTER_RUNTIME_RUNTIME_DELEGATE_H_
...@@ -54,14 +54,6 @@ void Animator::RequestFrame() { ...@@ -54,14 +54,6 @@ void Animator::RequestFrame() {
} }
} }
void Animator::FlushRealTimeEvents() {
if (outstanding_requests_ > 0)
rasterizer_.WaitForIncomingResponseWithTimeout(0);
if (engine_requested_frame_ && vsync_provider_)
vsync_provider_.WaitForIncomingResponseWithTimeout(0);
}
void Animator::Stop() { void Animator::Stop() {
paused_ = true; paused_ = true;
} }
......
...@@ -22,7 +22,6 @@ class Animator { ...@@ -22,7 +22,6 @@ class Animator {
~Animator(); ~Animator();
void RequestFrame(); void RequestFrame();
void FlushRealTimeEvents();
void Render(std::unique_ptr<flow::LayerTree> layer_tree); void Render(std::unique_ptr<flow::LayerTree> layer_tree);
......
...@@ -78,8 +78,8 @@ void Engine::Init() { ...@@ -78,8 +78,8 @@ void Engine::Init() {
void Engine::BeginFrame(ftl::TimePoint frame_time) { void Engine::BeginFrame(ftl::TimePoint frame_time) {
TRACE_EVENT0("flutter", "Engine::BeginFrame"); TRACE_EVENT0("flutter", "Engine::BeginFrame");
if (sky_view_) if (runtime_)
sky_view_->BeginFrame(frame_time); runtime_->BeginFrame(frame_time);
} }
void Engine::RunFromSource(const std::string& main, void Engine::RunFromSource(const std::string& main,
...@@ -91,14 +91,14 @@ void Engine::RunFromSource(const std::string& main, ...@@ -91,14 +91,14 @@ void Engine::RunFromSource(const std::string& main,
packages_path = FindPackagesPath(main); packages_path = FindPackagesPath(main);
if (!bundle.empty()) if (!bundle.empty())
ConfigureDirectoryAssetBundle(bundle); ConfigureDirectoryAssetBundle(bundle);
ConfigureView(main); ConfigureRuntime(main);
sky_view_->dart_controller()->RunFromSource(main, packages_path); runtime_->dart_controller()->RunFromSource(main, packages_path);
} }
Dart_Port Engine::GetUIIsolateMainPort() { Dart_Port Engine::GetUIIsolateMainPort() {
if (!sky_view_) if (!runtime_)
return ILLEGAL_PORT; return ILLEGAL_PORT;
return sky_view_->GetMainPort(); return runtime_->GetMainPort();
} }
void Engine::ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request) { void Engine::ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request) {
...@@ -109,7 +109,7 @@ void Engine::OnOutputSurfaceCreated(const ftl::Closure& gpu_continuation) { ...@@ -109,7 +109,7 @@ void Engine::OnOutputSurfaceCreated(const ftl::Closure& gpu_continuation) {
blink::Threads::Gpu()->PostTask(gpu_continuation); blink::Threads::Gpu()->PostTask(gpu_continuation);
have_surface_ = true; have_surface_ = true;
StartAnimatorIfPossible(); StartAnimatorIfPossible();
if (sky_view_) if (runtime_)
ScheduleFrame(); ScheduleFrame();
} }
...@@ -154,16 +154,16 @@ void Engine::SetServices(ServicesDataPtr services) { ...@@ -154,16 +154,16 @@ void Engine::SetServices(ServicesDataPtr services) {
void Engine::OnViewportMetricsChanged(ViewportMetricsPtr metrics) { void Engine::OnViewportMetricsChanged(ViewportMetricsPtr metrics) {
viewport_metrics_ = metrics.Pass(); viewport_metrics_ = metrics.Pass();
if (sky_view_) if (runtime_)
sky_view_->SetViewportMetrics(viewport_metrics_); runtime_->SetViewportMetrics(viewport_metrics_);
} }
void Engine::OnLocaleChanged(const mojo::String& language_code, void Engine::OnLocaleChanged(const mojo::String& language_code,
const mojo::String& country_code) { const mojo::String& country_code) {
language_code_ = language_code; language_code_ = language_code;
country_code_ = country_code; country_code_ = country_code;
if (sky_view_) if (runtime_)
sky_view_->SetLocale(language_code_, country_code_); runtime_->SetLocale(language_code_, country_code_);
} }
void Engine::OnPointerPacket(pointer::PointerPacketPtr packet) { void Engine::OnPointerPacket(pointer::PointerPacketPtr packet) {
...@@ -175,20 +175,20 @@ void Engine::OnPointerPacket(pointer::PointerPacketPtr packet) { ...@@ -175,20 +175,20 @@ void Engine::OnPointerPacket(pointer::PointerPacketPtr packet) {
(*it)->y /= viewport_metrics_->device_pixel_ratio; (*it)->y /= viewport_metrics_->device_pixel_ratio;
} }
if (sky_view_) if (runtime_)
sky_view_->HandlePointerPacket(packet); runtime_->HandlePointerPacket(packet);
} }
void Engine::RunFromSnapshotStream( void Engine::RunFromSnapshotStream(
const std::string& script_uri, const std::string& script_uri,
mojo::ScopedDataPipeConsumerHandle snapshot) { mojo::ScopedDataPipeConsumerHandle snapshot) {
TRACE_EVENT0("flutter", "Engine::RunFromSnapshotStream"); TRACE_EVENT0("flutter", "Engine::RunFromSnapshotStream");
ConfigureView(script_uri); ConfigureRuntime(script_uri);
snapshot_drainer_.reset(new glue::DrainDataPipeJob( snapshot_drainer_.reset(new glue::DrainDataPipeJob(
std::move(snapshot), [this](std::vector<char> snapshot) { std::move(snapshot), [this](std::vector<char> snapshot) {
FTL_DCHECK(sky_view_); FTL_DCHECK(runtime_);
FTL_DCHECK(sky_view_->dart_controller()); FTL_DCHECK(runtime_->dart_controller());
sky_view_->dart_controller()->RunFromSnapshot( runtime_->dart_controller()->RunFromSnapshot(
reinterpret_cast<uint8_t*>(snapshot.data()), snapshot.size()); reinterpret_cast<uint8_t*>(snapshot.data()), snapshot.size());
})); }));
} }
...@@ -204,21 +204,21 @@ void Engine::ConfigureDirectoryAssetBundle(const std::string& path) { ...@@ -204,21 +204,21 @@ void Engine::ConfigureDirectoryAssetBundle(const std::string& path) {
blink::Threads::IO()); blink::Threads::IO());
} }
void Engine::ConfigureView(const std::string& script_uri) { void Engine::ConfigureRuntime(const std::string& script_uri) {
snapshot_drainer_.reset(); snapshot_drainer_.reset();
sky_view_ = blink::SkyView::Create(this); runtime_ = blink::RuntimeController::Create(this);
sky_view_->CreateView(std::move(script_uri)); runtime_->CreateDartController(std::move(script_uri));
sky_view_->SetViewportMetrics(viewport_metrics_); runtime_->SetViewportMetrics(viewport_metrics_);
sky_view_->SetLocale(language_code_, country_code_); runtime_->SetLocale(language_code_, country_code_);
if (!initial_route_.empty()) if (!initial_route_.empty())
sky_view_->PushRoute(initial_route_); runtime_->PushRoute(initial_route_);
} }
void Engine::RunFromPrecompiledSnapshot(const mojo::String& bundle_path) { void Engine::RunFromPrecompiledSnapshot(const mojo::String& bundle_path) {
TRACE_EVENT0("flutter", "Engine::RunFromPrecompiledSnapshot"); TRACE_EVENT0("flutter", "Engine::RunFromPrecompiledSnapshot");
ConfigureZipAssetBundle(bundle_path.get()); ConfigureZipAssetBundle(bundle_path.get());
ConfigureView("http://localhost"); ConfigureRuntime("http://localhost");
sky_view_->dart_controller()->RunFromPrecompiledSnapshot(); runtime_->dart_controller()->RunFromPrecompiledSnapshot();
} }
void Engine::RunFromFile(const mojo::String& main, void Engine::RunFromFile(const mojo::String& main,
...@@ -252,15 +252,15 @@ void Engine::RunFromBundleAndSnapshot(const mojo::String& script_uri, ...@@ -252,15 +252,15 @@ void Engine::RunFromBundleAndSnapshot(const mojo::String& script_uri,
} }
void Engine::PushRoute(const mojo::String& route) { void Engine::PushRoute(const mojo::String& route) {
if (sky_view_) if (runtime_)
sky_view_->PushRoute(route); runtime_->PushRoute(route);
else else
initial_route_ = route; initial_route_ = route;
} }
void Engine::PopRoute() { void Engine::PopRoute() {
if (sky_view_) if (runtime_)
sky_view_->PopRoute(); runtime_->PopRoute();
} }
void Engine::OnAppLifecycleStateChanged(sky::AppLifecycleState state) { void Engine::OnAppLifecycleStateChanged(sky::AppLifecycleState state) {
...@@ -276,8 +276,8 @@ void Engine::OnAppLifecycleStateChanged(sky::AppLifecycleState state) { ...@@ -276,8 +276,8 @@ void Engine::OnAppLifecycleStateChanged(sky::AppLifecycleState state) {
break; break;
} }
if (sky_view_) if (runtime_)
sky_view_->OnAppLifecycleStateChanged(state); runtime_->OnAppLifecycleStateChanged(state);
} }
void Engine::DidCreateMainIsolate(Dart_Isolate isolate) { void Engine::DidCreateMainIsolate(Dart_Isolate isolate) {
...@@ -324,10 +324,6 @@ void Engine::ScheduleFrame() { ...@@ -324,10 +324,6 @@ void Engine::ScheduleFrame() {
animator_->RequestFrame(); animator_->RequestFrame();
} }
void Engine::FlushRealTimeEvents() {
animator_->FlushRealTimeEvents();
}
void Engine::Render(std::unique_ptr<flow::LayerTree> layer_tree) { void Engine::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
if (!layer_tree) if (!layer_tree)
return; return;
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "flutter/assets/zip_asset_store.h" #include "flutter/assets/zip_asset_store.h"
#include "flutter/glue/drain_data_pipe_job.h" #include "flutter/glue/drain_data_pipe_job.h"
#include "flutter/runtime/sky_view_client.h" #include "flutter/runtime/runtime_delegate.h"
#include "flutter/runtime/sky_view.h" #include "flutter/runtime/runtime_controller.h"
#include "flutter/services/engine/sky_engine.mojom.h" #include "flutter/services/engine/sky_engine.mojom.h"
#include "flutter/services/rasterizer/rasterizer.mojom.h" #include "flutter/services/rasterizer/rasterizer.mojom.h"
#include "flutter/sky/shell/ui_delegate.h" #include "flutter/sky/shell/ui_delegate.h"
...@@ -30,7 +30,7 @@ class Animator; ...@@ -30,7 +30,7 @@ class Animator;
class Engine : public UIDelegate, class Engine : public UIDelegate,
public SkyEngine, public SkyEngine,
public blink::SkyViewClient { public blink::RuntimeDelegate {
public: public:
struct Config { struct Config {
Config(); Config();
...@@ -78,9 +78,8 @@ class Engine : public UIDelegate, ...@@ -78,9 +78,8 @@ class Engine : public UIDelegate,
void PopRoute() override; void PopRoute() override;
void OnAppLifecycleStateChanged(sky::AppLifecycleState state) override; void OnAppLifecycleStateChanged(sky::AppLifecycleState state) override;
// SkyViewClient methods: // RuntimeDelegate methods:
void ScheduleFrame() override; void ScheduleFrame() override;
void FlushRealTimeEvents() override;
void Render(std::unique_ptr<flow::LayerTree> layer_tree) override; void Render(std::unique_ptr<flow::LayerTree> layer_tree) override;
void DidCreateMainIsolate(Dart_Isolate isolate) override; void DidCreateMainIsolate(Dart_Isolate isolate) override;
void DidCreateSecondaryIsolate(Dart_Isolate isolate) override; void DidCreateSecondaryIsolate(Dart_Isolate isolate) override;
...@@ -98,7 +97,7 @@ class Engine : public UIDelegate, ...@@ -98,7 +97,7 @@ class Engine : public UIDelegate,
void ConfigureZipAssetBundle(const std::string& path); void ConfigureZipAssetBundle(const std::string& path);
void ConfigureDirectoryAssetBundle(const std::string& path); void ConfigureDirectoryAssetBundle(const std::string& path);
void ConfigureView(const std::string& script_uri); void ConfigureRuntime(const std::string& script_uri);
Config config_; Config config_;
std::unique_ptr<Animator> animator_; std::unique_ptr<Animator> animator_;
...@@ -109,7 +108,7 @@ class Engine : public UIDelegate, ...@@ -109,7 +108,7 @@ class Engine : public UIDelegate,
mojo::BindingSet<mojo::ServiceProvider> service_provider_bindings_; mojo::BindingSet<mojo::ServiceProvider> service_provider_bindings_;
mojo::asset_bundle::AssetBundlePtr root_bundle_; mojo::asset_bundle::AssetBundlePtr root_bundle_;
std::unique_ptr<blink::SkyView> sky_view_; std::unique_ptr<blink::RuntimeController> runtime_;
std::unique_ptr<glue::DrainDataPipeJob> snapshot_drainer_; std::unique_ptr<glue::DrainDataPipeJob> snapshot_drainer_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册