[vsync_waiter] add AwaitVSyncForSecondaryCallback() (#25787)
diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc
index ede589f..fe21c84 100644
--- a/shell/common/vsync_waiter.cc
+++ b/shell/common/vsync_waiter.cc
@@ -88,7 +88,7 @@
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 6af0b8d..6a71d65 100644
--- a/shell/common/vsync_waiter.h
+++ b/shell/common/vsync_waiter.h
@@ -42,12 +42,29 @@
explicit 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);