Remove obsolete member variables in 'flutter::Engine' and tweak the unittest (flutter/engine#31148)

This commit is contained in:
ColdPaleLight
2022-02-01 13:30:11 +08:00
committed by GitHub
parent 429435ecba
commit 764fe4790b
4 changed files with 4 additions and 22 deletions

View File

@@ -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;

View File

@@ -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<PlatformMessage> message) {
@@ -398,8 +395,7 @@ void Engine::HandleSettingsPlatformMessage(PlatformMessage* message) {
const auto& data = message->data();
std::string jsonData(reinterpret_cast<const char*>(data.GetMapping()),
data.GetSize());
if (runtime_controller_->SetUserSettingsData(std::move(jsonData)) &&
have_surface_) {
if (runtime_controller_->SetUserSettingsData(std::move(jsonData))) {
ScheduleFrame();
}
}

View File

@@ -931,10 +931,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
std::string last_entry_point_library_;
std::vector<std::string> last_entry_point_args_;
std::string initial_route_;
ViewportMetrics viewport_metrics_;
std::shared_ptr<AssetManager> asset_manager_;
bool activity_running_;
bool have_surface_;
std::shared_ptr<FontCollection> font_collection_;
ImageDecoder image_decoder_;
ImageGeneratorRegistry image_generator_registry_;

View File

@@ -55,6 +55,7 @@ void onBeginFrameMain() {
PlatformDispatcher.instance.onBeginFrame = (Duration beginTime) {
nativeOnBeginFrame(beginTime.inMicroseconds);
};
PlatformDispatcher.instance.scheduleFrame();
}
@pragma('vm:entry-point')