Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shell/common/animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void Animator::Render(std::unique_ptr<flutter::LayerTree> layer_tree) {
FML_DLOG(INFO) << "No pending continuation to commit";
}

delegate_.OnAnimatorDraw(layer_tree_pipeline_);
delegate_.OnAnimatorDraw(layer_tree_pipeline_, last_frame_target_time_);
}

bool Animator::CanReuseLastLayerTree() {
Expand Down
3 changes: 2 additions & 1 deletion shell/common/animator.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class Animator final {
virtual void OnAnimatorNotifyIdle(int64_t deadline) = 0;

virtual void OnAnimatorDraw(
fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline) = 0;
fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline,
fml::TimePoint frame_target_time) = 0;

virtual void OnAnimatorDrawLastLayerTree() = 0;
};
Expand Down
13 changes: 12 additions & 1 deletion shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,20 @@ void Shell::OnAnimatorNotifyIdle(int64_t deadline) {
}

// |Animator::Delegate|
void Shell::OnAnimatorDraw(fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline) {
void Shell::OnAnimatorDraw(fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline,
fml::TimePoint frame_target_time) {
FML_DCHECK(is_setup_);

// record the target time for use by rasterizer.
{
std::scoped_lock time_recorder_lock(time_recorder_mutex_);
if (!latest_frame_target_time_) {
latest_frame_target_time_ = frame_target_time;
} else if (latest_frame_target_time_ < frame_target_time) {
latest_frame_target_time_ = frame_target_time;
}
}

task_runners_.GetRasterTaskRunner()->PostTask(
[&waiting_for_first_frame = waiting_for_first_frame_,
&waiting_for_first_frame_condition = waiting_for_first_frame_condition_,
Expand Down
4 changes: 2 additions & 2 deletions shell/common/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ class Shell final : public PlatformView::Delegate,
void OnAnimatorNotifyIdle(int64_t deadline) override;

// |Animator::Delegate|
void OnAnimatorDraw(
fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline) override;
void OnAnimatorDraw(fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline,
fml::TimePoint frame_target_time) override;

// |Animator::Delegate|
void OnAnimatorDrawLastLayerTree() override;
Expand Down