Editorial: use a dedicated parallel queue for the Clients API - #1842
Editorial: use a dedicated parallel queue for the Clients API#1842monica-ch wants to merge 1 commit into
Conversation
Give each Clients object a dedicated parallel queue and route Clients.get, Clients.matchAll, Clients.openWindow, and Clients.claim through it, so operations on the same Clients object do not race with each other. Wrap the remaining bare Resolve steps in get() and claim() in Queue a task on the promise's responsible event loop, matching the pattern used in the other queue-a-task refactors. Closes: w3c#1840
7f622b8 to
805ee59
Compare
| Each {{Clients}} object has an associated <dfn>Clients parallel queue</dfn> (a [=parallel queue=]) used to serialize the {{Clients}} object's operations. | ||
|
|
There was a problem hiding this comment.
Recognizing this patch is a WIP, I think this is currently under-constrained and it probably makes sense to do this like you've done it for the Cache API in #1838 which is basically one-per-storage-key. (Whereas this currently seems to be 1-per-ServiceWorker instance.)
There was a problem hiding this comment.
Agreed, 1-per-Clients is under-constrained. Will rework to 1-per-storage-key matching #1838.
Quick clarification before I push: #1838 hangs the queue off [=name to cache map=] because that map is itself per-storage-key. Clients don't have an equivalent map — the [=/service worker clients=] list is UA-wide, filtered by storage key. Would you prefer a UA-level <dfn>Clients parallel queue</dfn> map keyed by storage key, or a prose "for each storage key, the UA has an associated Clients parallel queue" form?
Closes #1840. Follow-up to #1755.
Give each {{Clients}} object a dedicated parallel queue and route the operations on {{Clients}} through it, so operations on the same {{Clients}} object do not race with each other (e.g.
matchAlliterating over service worker clients whileclaimis mutating their [=active service worker=]).Changes
<dfn export for="Clients">Clients parallel queue</dfn>(a [=parallel queue=]) attached to each {{Clients}} object, following the same pattern as thename to cache map parallel queueintroduced in Editorial: serialize CacheStorage access on a dedicated parallel queue #1838.Run … in parallelblock:Resolve |promise| with undefined.steps (inget()andclaim()) inQueue a taskon|promise|'s [=responsible event loop=] using the [=DOM manipulation task source=], matching the pattern already used inmatchAll()and consistent with the queue-a-task refactor from Editorial: Queue a task to resolve/reject promise or when fire an event. #1755.Total change: +10 / −6 in
index.bs, one commit.Rationale
Yoshi flagged this concern during #1755 review:
#1836 landed the queue-a-task-for-resolve fixes for these methods. This PR delivers the sibling parallel-queue work that was explicitly deferred in the split plan.
Out of scope
in parallelblock entirely and useQueue a taskon the client's own event loop, so no parallel-queue treatment is meaningful for them.Related
Preview | Diff