diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 40ced727abcfe..41a13db0db460 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -87,7 +87,7 @@ void VsyncWaiter::ScheduleSecondaryCallback(uintptr_t id, return; } } - AwaitVSync(); + AwaitVSyncForSecondaryCallback(); } void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, diff --git a/shell/common/vsync_waiter.h b/shell/common/vsync_waiter.h index d593c7014b073..8a95960dd72f3 100644 --- a/shell/common/vsync_waiter.h +++ b/shell/common/vsync_waiter.h @@ -42,12 +42,29 @@ class VsyncWaiter : public std::enable_shared_from_this { 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);