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/vsync_waiter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void VsyncWaiter::ScheduleSecondaryCallback(uintptr_t id,
return;
}
}
AwaitVSync();
AwaitVSyncForSecondaryCallback();
}

void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time,
Expand Down
17 changes: 17 additions & 0 deletions shell/common/vsync_waiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,29 @@ class VsyncWaiter : public std::enable_shared_from_this<VsyncWaiter> {

VsyncWaiter(TaskRunners task_runners);

// There are two distinct situations where VsyncWaiter wishes to awaken at
// the next vsync. Although the functionality can be the same, the intent is
// different, therefore it makes sense to have a method for each intent.

// The intent of AwaitVSync() is that the Animator wishes to produce a frame.
// The underlying implementation can choose to be aware of this intent when
// it comes to implementing backpressure and other scheduling invariants.
//
// Implementations are meant to override this method and arm their vsync
// latches when in response to this invocation. On vsync, they are meant to
// invoke the |FireCallback| method once (and only once) with the appropriate
// arguments. This method should not block the current thread.
virtual void AwaitVSync() = 0;

// The intent of AwaitVSyncForSecondaryCallback() is simply to wake up at the
// next vsync.
//
// Because there is no association with frame scheduling, underlying
// implementations do not need to worry about maintaining invariants or
// backpressure. The default implementation is to simply follow the same logic
// as AwaitVSync().
virtual void AwaitVSyncForSecondaryCallback() { AwaitVSync(); }

void FireCallback(fml::TimePoint frame_start_time,
fml::TimePoint frame_target_time,
bool pause_secondary_tasks = true);
Expand Down