Scheduling APIs: Inherit by default in yield()
Change the default to inherit if the signal and priority options are not
given. This puts the implementation in line with the draft spec:
https://pr-preview.s3.amazonaws.com/shaseley/scheduling-apis/pull/88.html
Bug: 40633887
Change-Id: Id36c305421bac88d6d49ebb9b796c2d2584e341f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5506575
Reviewed-by: Nate Chapin <japhet@chromium.org>
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1295865}
diff --git a/scheduler/tentative/yield/yield-priority-posttask.any.js b/scheduler/tentative/yield/yield-priority-posttask.any.js
index 0700094..5e40eba 100644
--- a/scheduler/tentative/yield/yield-priority-posttask.any.js
+++ b/scheduler/tentative/yield/yield-priority-posttask.any.js
@@ -103,6 +103,15 @@
}, 'yield() with postTask tasks (inherit signal)');
promise_test(async t => {
+ for (const config of signalConfigs) {
+ const {tasks, ids} =
+ postTestTasks(config.options, {});
+ await Promise.all(tasks);
+ assert_equals(ids.join(), config.expected);
+ }
+}, 'yield() with postTask tasks (inherit signal by default)');
+
+promise_test(async t => {
const expected = 'y0,ub1,ub2,uv1,uv2,y1,y2,y3,bg1,bg2';
const {tasks, ids} = postTestTasks(
{priority: 'user-blocking'}, {priority: 'background'});
@@ -171,10 +180,10 @@
subtasks.push(scheduler.postTask(() => { ids.push('ub1'); }, {priority: 'user-blocking'}));
subtasks.push(scheduler.postTask(() => { ids.push('uv1'); }));
- // Ignore inherited signal (user-visible continuations).
- await scheduler.yield();
+ // Ignore inherited signal.
+ await scheduler.yield({priority: 'user-visible'});
ids.push('y1');
- await scheduler.yield();
+ await scheduler.yield({priority: 'user-visible'});
ids.push('y2');
subtasks.push(scheduler.postTask(() => { ids.push('ub2'); }, {priority: 'user-blocking'}));