[task] Implement timer slack on mac
Using leeway and delay policy, apply timer slack in MessagePumpCFRunLoop and MessagePumpKqueue, behind kTimerSlackMac feature.
Drive-by: remove next_delayed_do_work since all message pumps already
do the check internally.
Change-Id: Ib24f78b6770f05f3e85d30eea696815c93399894
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4594877
Reviewed-by: Robert Sesek <[email protected]>
Reviewed-by: Francois Pierre Doray <[email protected]>
Commit-Queue: Etienne Pierre-Doray <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1192657}
diff --git a/base/task/task_features.h b/base/task/task_features.h
index 0eb8fb0..d1aa519 100644
--- a/base/task/task_features.h
+++ b/base/task/task_features.h
@@ -51,6 +51,10 @@
// DelayPolicy.
BASE_EXPORT BASE_DECLARE_FEATURE(kAlignWakeUps);
+// Under this feature, slack is added on mac message pumps that support it when
+// allowed per DelayPolicy.
+BASE_EXPORT BASE_DECLARE_FEATURE(kTimerSlackMac);
+
// Under this feature, tasks that need high resolution timer are determined
// based on explicit DelayPolicy rather than based on a threshold.
BASE_EXPORT BASE_DECLARE_FEATURE(kExplicitHighResolutionTimerWin);