Refactor existing spec to share as much as possible between yield() and postTask():
Extract out "scheduling state" struct to hold abort and priority sources and compute this based the options passed to postTask() and yield()
Change map data structures and related algorithms to additionally be keyed on "is continuation" boolean (the queues need to be separate since the effective priorities are different)
Unify postTask() and yield() priority with notion of an "effective priority", which is used for picking the next task to run (yield() effective priority for a given task priority is just higher than postTask() equivalent).
Implement inheritance by adding notion of "current scheduling state" to the event loop
Set before running postTask() callback and idle callbacks
Stored/restored in HostMakeJobCallback and HostCallJobCallback (i.e. propagate to microtasks from .then() call)
Note: things get a little awkward regarding continuation vs. task priority IDL since we can't yet inherit from enums (ContinuationPriority is TaskPriority + "inherit"). And we sometimes pass one type as another where they are compatible (i.e. same string values permitted).
Implementation notes:
yield()
andpostTask()
:postTask()
andyield()
postTask()
andyield()
priority with notion of an "effective priority", which is used for picking the next task to run (yield()
effective priority for a given task priority is just higher thanpostTask()
equivalent).postTask()
callback and idle callbacksNote: things get a little awkward regarding continuation vs. task priority IDL since we can't yet inherit from enums (ContinuationPriority is TaskPriority + "inherit"). And we sometimes pass one type as another where they are compatible (i.e. same string values permitted).
Preview | Diff