From f87739ecd7eda7a0242ddac9ce81092711b231ff Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Each window event loop has a DOMHighResTimeStamp + estimated time of next render, initially set to zero.
If docs is not empty, then set hasARenderingOpportunity to - true.
Unnecessary rendering: Remove from docs all Document
objects
@@ -93895,7 +93898,7 @@ import "https://example.com/foo/../module2.mjs";
If all of the following are true +
If all of the following are true:
then for each Window
object whose relevant agent's
- event loop is this event loop, run the
- start an idle period algorithm, passing the Window
.
then:
+ +Let maxDeadline be now plus 50.
Let windows be all Window
objects whose
+ relevant agent's event loop is
+ this event loop.
For each Window
win in windows:
Let deadline be maxDeadline. + +
For each Window
windowToCheck in windows:
If the result of calling windowToCheck's + estimate next callback time is between now and + deadline, set deadline to that value.
If windowToCheck's map of animation frame callbacks is not + empty and windowToCheck's estimated time of next render is + between now and deadline, set deadline to that + value.
We need to run this step for every window to make sure any timeouts added + during the idle period algorithm are taken into account. A non-critical task + (requestIdleCallback) might schedule a critical task + (setTimeout / requetAnimationFrame).
+If the current high resolution time is greater than deadline, + abort this loop.
Objects that implement the WindowOrWorkerGlobalScope
mixin have a list of active timers. Each entry in this lists is identified by a number, which must
be unique within the list for the lifetime of the object that implements the
- WindowOrWorkerGlobalScope
mixin.
WindowOrWorkerGlobalScope
mixin, and has an estimate next callback time,
+ an algorithm returing a DOMHighResTimestamp.
Let task's timer nesting level be nesting level.
Let startTime be the current high resolution time.
Set the estimate next callback time algorithm for the entry in the + list of active timers associated with handle to the following steps:
+ +Let estimatedCallbackTime be startTime plus timeout, + plus the duration in milliseconds in which the document has not been + fully active since startTime, plus a number representing an + implementation-defined length of time in milliseconds.
+Let now be the current high resolution time.
If estimatedCallbackTime is less than now, return + now.
Return estimatedCallbackTime.
Return handle, and then continue running this algorithm in parallel.