diff --git a/engine/src/flutter/shell/common/animator_unittests.cc b/engine/src/flutter/shell/common/animator_unittests.cc index fea09475ba..e09d5a07d8 100644 --- a/engine/src/flutter/shell/common/animator_unittests.cc +++ b/engine/src/flutter/shell/common/animator_unittests.cc @@ -87,18 +87,6 @@ TEST_F(ShellTest, VSyncTargetTime) { RunEngine(shell.get(), std::move(configuration)); }); platform_task.wait(); - - // schedule a frame to trigger window.onBeginFrame - fml::TaskRunner::RunNowOrPostTask(shell->GetTaskRunners().GetUITaskRunner(), - [engine = shell->GetEngine()]() { - if (engine) { - // this implies we can re-use the last - // frame to trigger begin frame rather - // than re-generating the layer tree. - engine->ScheduleFrame(true); - } - }); - on_target_time_latch.Wait(); const auto vsync_waiter_target_time = ConstantFiringVsyncWaiter::frame_target_time; diff --git a/engine/src/flutter/shell/common/engine.cc b/engine/src/flutter/shell/common/engine.cc index cccf646abd..68c8fa3626 100644 --- a/engine/src/flutter/shell/common/engine.cc +++ b/engine/src/flutter/shell/common/engine.cc @@ -279,11 +279,8 @@ tonic::DartErrorHandleType Engine::GetUIIsolateLastError() { } void Engine::SetViewportMetrics(const ViewportMetrics& metrics) { - viewport_metrics_ = metrics; - runtime_controller_->SetViewportMetrics(viewport_metrics_); - if (animator_) { - ScheduleFrame(); - } + runtime_controller_->SetViewportMetrics(metrics); + ScheduleFrame(); } void Engine::DispatchPlatformMessage(std::unique_ptr message) { @@ -398,8 +395,7 @@ void Engine::HandleSettingsPlatformMessage(PlatformMessage* message) { const auto& data = message->data(); std::string jsonData(reinterpret_cast(data.GetMapping()), data.GetSize()); - if (runtime_controller_->SetUserSettingsData(std::move(jsonData)) && - have_surface_) { + if (runtime_controller_->SetUserSettingsData(std::move(jsonData))) { ScheduleFrame(); } } diff --git a/engine/src/flutter/shell/common/engine.h b/engine/src/flutter/shell/common/engine.h index faa25e4c38..85ae92d64f 100644 --- a/engine/src/flutter/shell/common/engine.h +++ b/engine/src/flutter/shell/common/engine.h @@ -931,10 +931,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate { std::string last_entry_point_library_; std::vector last_entry_point_args_; std::string initial_route_; - ViewportMetrics viewport_metrics_; std::shared_ptr asset_manager_; - bool activity_running_; - bool have_surface_; std::shared_ptr font_collection_; ImageDecoder image_decoder_; ImageGeneratorRegistry image_generator_registry_; diff --git a/engine/src/flutter/shell/common/fixtures/shell_test.dart b/engine/src/flutter/shell/common/fixtures/shell_test.dart index 33aa4c774e..fdbaf066a0 100644 --- a/engine/src/flutter/shell/common/fixtures/shell_test.dart +++ b/engine/src/flutter/shell/common/fixtures/shell_test.dart @@ -55,6 +55,7 @@ void onBeginFrameMain() { PlatformDispatcher.instance.onBeginFrame = (Duration beginTime) { nativeOnBeginFrame(beginTime.inMicroseconds); }; + PlatformDispatcher.instance.scheduleFrame(); } @pragma('vm:entry-point')