Closed Bug 1644009 Opened 4 years ago Closed 4 years ago

Split direct task dispatching from AbstractThread

Categories

(Core :: XPCOM, task)

task

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: jya, Assigned: jya)

References

(Blocks 1 open bug)

Details

Attachments

(14 files)

(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details

Currently to be able to use direct tasks, which ar similar to the JS Promise microtasks, we need an AbstractThread and its tail dispatcher.

This is an implementation detail that doesn't have to be.

So the plan is to split direct task dispatching from the tail dispatcher and abstract thread.

We will do so with a new nsIDirectTaskDispatcher task.

nsThread and TaskQueue will then implement it.

For this to be usable with MozPromise (which may require direct task dispatching), we need bug 1637500 to be resolved.

Depends on: 1637500
Blocks: 1641737

DirectTask dispatching will now be directly handled by nsThread.

DirectTask dispatching will now be directly handled by nsThread.

Depends on D79085

DirectTask dispatching will now be directly handled by nsThread.

Depends on D79086

DirectTask dispatching will now be directly handled by nsThread.

Depends on D79087

DirectTask dispatching will now be directly handled by nsThread.

Depends on D79088

DirectTask dispatching will now be directly handled by nsThread.

Depends on D79089

DirectTask dispatching will now be directly handled by nsThread.

Depends on D79090

We will use it later for implementing direct task dispatching where required.

Depends on D79091

We extract the dealing of direct tasks from the TailDispatcher object and move into to the existing nsThread and TaskQueue classes.
TaskQueue is made to work with do_QueryInterface.

We continue accessing the direct tasks dispatcher via the TailDispatcher for now, which itself will forward the dealing of such tasks to the underlying thread.

Depends on D79092

It will simply forward the interface to the main thread.
This is the final step required to remove AbstractThread support here.

Depends on D79094

This prevent being able to assert in the AutoTaskDispatcher that we are using it from the right thread/taskqueue as the SimpleTaskQueue object isn't thread-safe.

We want to assert that all nsIDirectTaskDispatcher methods are only ever accessed on the underlying thread. To do so require that the scope of AutoTaskDispatcher to terminate prior the AutoTaskGuard one.

Depends on D79095

Depends on D79096

Attachment #9155596 - Attachment description: Bug 1644009 - P11. Make DogGroup's LabellingEventTarget implement nsIDirectTaskDispatcher. r?farre → Bug 1644009 - P11. Make DocGroup's LabellingEventTarget implement nsIDirectTaskDispatcher. r?farre
Attachment #9155597 - Attachment description: Bug 1644009 - P12. Don't have AutoTaskGuard inherit from AutoTaskDispatcher. r?bholley. → Bug 1644009 - P13. Don't have AutoTaskGuard inherit from AutoTaskDispatcher. r?bholley.
Attachment #9155598 - Attachment description: Bug 1644009 - P13. Make the presence of nsIDirectTaskDispatcher a soft assertion. r?bholley → Bug 1644009 - P14. Make the presence of nsIDirectTaskDispatcher a soft assertion. r?bholley
Attachment #9155598 - Attachment description: Bug 1644009 - P14. Make the presence of nsIDirectTaskDispatcher a soft assertion. r?bholley → Bug 1644009 - P14. Fallback to normal dispatch on release. r?bholley
Pushed by jyavenard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/50563df7052a P1. Revert "Bug 1592488 - P11. Ensure an AbstractThread exists for each WorkerThread." r=nika https://hg.mozilla.org/integration/autoland/rev/70208fbe3755 P2. Revert "Bug 1592488 - P9. Make a DOMCacheThread an AbstractThread." r=nika https://hg.mozilla.org/integration/autoland/rev/12725e7040d6 P3. Revert "Bug 1592488 - P8. Ensure AbstractThread exists with STS thread." r=valentin,necko-reviewers https://hg.mozilla.org/integration/autoland/rev/28097e44c058 P4. Revert "Bug 1592488 - P7. Ensure an AbstractThread exists with RemoteDecoder manager thread." r=mattwoodrow https://hg.mozilla.org/integration/autoland/rev/62b9fb746823 P5. Revert "Bug 1592488 - P6. Ensure an AbstractThread exists with RemoteWorkerService thread." r=nika https://hg.mozilla.org/integration/autoland/rev/4dbb4af6a2ab P6. Revert "Bug 1592488 - P5. Ensure an AbstractThread exists with BackgroundThread." r=nika https://hg.mozilla.org/integration/autoland/rev/81a565d1fd64 P7. Revert "Bug 1592488 - P4. Ensure an AbstractThread exists for the Compositor Thread." r=mattwoodrow https://hg.mozilla.org/integration/autoland/rev/f6fc16f49976 P8. Add SimpleTaskQueue object. r=froydnj https://hg.mozilla.org/integration/autoland/rev/faa8e3461f33 P9. Add nsIDirectTaskDispatcher interface. r=froydnj https://hg.mozilla.org/integration/autoland/rev/a0fe9db3ab56 P10. Make MozPromise access direct task dispatcher using QI(nsIDirectTaskDispatcher). r=bholley https://hg.mozilla.org/integration/autoland/rev/b7ed3455ea43 P11. Make DocGroup's LabellingEventTarget implement nsIDirectTaskDispatcher. r=farre https://hg.mozilla.org/integration/autoland/rev/0888e8f9b191 P12. Make STS thread supports nsIDirectTaskDispatcher interface. r=valentin,necko-reviewers https://hg.mozilla.org/integration/autoland/rev/d985d78962c7 P13. Don't have AutoTaskGuard inherit from AutoTaskDispatcher. r=bholley. https://hg.mozilla.org/integration/autoland/rev/86419b2114e5 P14. Fallback to normal dispatch on release. r=bholley
No longer regressed by: 1648549
Regressions: 1648549
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: