Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a8c0dc3

Browse files
committed
Move pipeline completion and rasterizer
1 parent 03ee971 commit a8c0dc3

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

shell/common/animator.cc

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,23 @@ void Animator::BeginFrame(
119119
}
120120

121121
void Animator::EndFrame() {
122+
if (!layer_trees_tasks_.empty()) {
123+
// Commit the pending continuation.
124+
PipelineProduceResult result =
125+
producer_continuation_.Complete(std::make_unique<FrameItem>(
126+
std::move(layer_trees_tasks_), std::move(frame_timings_recorder_)));
127+
128+
if (!result.success) {
129+
FML_DLOG(INFO) << "No pending continuation to commit";
130+
} else if (!result.is_first_item) {
131+
// It has been successfully pushed to the pipeline but not as the first
132+
// item. Eventually the 'Rasterizer' will consume it, so we don't need to
133+
// notify the delegate.
134+
} else {
135+
delegate_.OnAnimatorDraw(layer_tree_pipeline_);
136+
}
137+
}
138+
122139
if (!frame_scheduled_ && has_rendered_) {
123140
// Wait a tad more than 3 60hz frames before reporting a big idle period.
124141
// This is a heuristic that is meant to avoid giving false positives to the
@@ -173,20 +190,6 @@ void Animator::Render(int64_t view_id,
173190
frame_timings_recorder_->RecordBuildEnd(fml::TimePoint::Now());
174191
delegate_.OnAnimatorUpdateLatestFrameTargetTime(
175192
frame_timings_recorder_->GetVsyncTargetTime());
176-
// Commit the pending continuation.
177-
PipelineProduceResult result =
178-
producer_continuation_.Complete(std::make_unique<FrameItem>(
179-
std::move(layer_trees_tasks_), std::move(frame_timings_recorder_)));
180-
181-
if (!result.success) {
182-
FML_DLOG(INFO) << "No pending continuation to commit";
183-
} else if (!result.is_first_item) {
184-
// It has been successfully pushed to the pipeline but not as the first
185-
// item. Eventually the 'Rasterizer' will consume it, so we don't need to
186-
// notify the delegate.
187-
} else {
188-
delegate_.OnAnimatorDraw(layer_tree_pipeline_);
189-
}
190193
}
191194

192195
const std::weak_ptr<VsyncWaiter> Animator::GetVsyncWaiter() const {

0 commit comments

Comments
 (0)