Commit Graph
110 Commits
Author SHA1 Message Date
Nika Layzell 325ec7d64a Bug 1983309 - Reduce lock contention in TaskQueue. r=xpcom-reviewers,jstutte
This patch aims to reduce lock contention when dispatching to TaskQueue,
by reducing the frequency with which the runner thread needs to acquire
the TaskQueue monitor.

Prior to this change, if there is a backlog of queued runnables,
TaskQueue::Runner would acquire mQueueMonitor 3 times per event. After
this change, mQueueMonitor will only be acquired when the set of tasks
read the last time the monitor was held have all been processed.

TaskQueue would need to change to use an unbounded lock-free MPSC
queue in order to further reduce contention when dispatching. Doing so
is a much larger project, and would require more substantial changes
to the TaskQueue type to make state management (especially around
shutdown) avoid locking.

Differential Revision: https://phabricator.services.mozilla.com/D261278
2026-05-21 12:38:58 +00:00
Sylvestre Ledru 6149f49299 Bug 2023419 - Remove Emacs/Vim modelines from xpcom/ r=emilio
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287878
2026-03-16 17:22:07 +00:00
Jens Stutte cf6c4de4d7 Bug 1999508 - Let TaskQueue register a shutdown task for itself on its target when needed and possible. r=xpcom-reviewers,nika
In addition, remove the TaskQueueTracker from the BackgroundEventTarget and let it just support shutdown tasks, too.

On a target that SUPPORTS_SHUTDOWN_TASK_DISPATCH, TaskQueue's runner already ensures to drain the queue before the target can fully shutdown. However, eventual TaskQueue shutdown tasks were not yet executed in this case.
We thus register a shutdown task that shuts the TaskQueue down on the target if we have at least one own shutdown task. Note that this will keep the TaskQueue alive until target shutdown if there is no earlier, explicit shutdown on behalf of the consumer.

Note that this means that a TaskQueue may or may not fully enter its internal shutdown state when the target dies, depending on consumers having registered a shutdown task to it. But subsequent dispatches will always fail in the same way, and there is no way to query the shutdown state, anyways.

Differential Revision: https://phabricator.services.mozilla.com/D272151
2026-01-28 07:24:10 +00:00
Jens Stutte 6829afc661 Bug 1999508 - Introduce nsIEventTarget::GetFeatures. r=xpcom-reviewers,necko-reviewers,dom-worker-reviewers,nika,asuth,valentin
Introduces SUPPORTS_SHUTDOWN_TASKS and SUPPORTS_SHUTDOWN_TASK_DISPATCH flags.

This just wires the function through all event targets without ever being used.

Differential Revision: https://phabricator.services.mozilla.com/D272150
2026-01-28 07:24:07 +00:00
Jens Stutte 69091519a2 Bug 2011161 - Enforce TaskQueue names to be literal with StaticString. r=xpcom-reviewers,dom-storage-reviewers,nika,asuth
By now, nobody really uses TaskQueue::mName. Bug 1999508 wants to introduce logging and in order to avoid copying strings just for that, we enforce names to be literals.

In a few cases this reduces the level of detail provided in the name (WebRTC, IndexedDB), but given it never showed up (except maybe while debugging) we can probably live without it.

Differential Revision: https://phabricator.services.mozilla.com/D279500
2026-01-26 15:15:47 +00:00
Sandor Molnar 64ab8b77b5 Revert "Bug 2011161 - Enforce TaskQueue names to be literal with StaticString. r=xpcom-reviewers,dom-storage-reviewers,nika,asuth" for causing build bustages @ TestFileSystemDataManagerVersions.cpp
This reverts commit 1030b77bd4.
2026-01-26 12:34:32 +00:00
Jens Stutte 1030b77bd4 Bug 2011161 - Enforce TaskQueue names to be literal with StaticString. r=xpcom-reviewers,dom-storage-reviewers,nika,asuth
By now, nobody really uses TaskQueue::mName. Bug 1999508 wants to introduce logging and in order to avoid copying strings just for that, we enforce names to be literals.

In a few cases this reduces the level of detail provided in the name (WebRTC, IndexedDB), but given it never showed up (except maybe while debugging) we can probably live without it.

Differential Revision: https://phabricator.services.mozilla.com/D279500
2026-01-26 11:30:22 +00:00
Harveer Singh 0e3c4881ea Bug 2001760: Improving the return error code from TaskQueue::DispatchLocked in case we are in shutdown.r=jari
The linked bug has been intermittently failing. I think this could be because we are in shutdown. Improving the return code from the TaskQueue::DispatchLocked in case dispatch wasn't successful because we were shutting down.

Differential Revision: https://phabricator.services.mozilla.com/D274046
2025-11-27 16:55:11 +00:00
Jens Stutte 6a6b74df8e Bug 1979268 - part 1: Have a common TargetShutdownTaskSet to manage a set of nsITargetShutdownTask. r=xpcom-reviewers,nika,dom-worker-reviewers,smaug
This is just a refactoring to have less copy&pasted code instead of more once we enable more targets for shutdown tasks.

Differential Revision: https://phabricator.services.mozilla.com/D258804
2025-09-26 17:39:50 +00:00
Jeff Muizelaar 572e5cfd9f Bug 1988021 - Conditionally capture stacks on runnable dispatch. r=smaug
This captures stacks during runnable dispatch which is really
helpful for understanding what's going on and debugging flows.

It's conditional on the Flows profiler feature so that we don't
take the performance cost all the time.

Differential Revision: https://phabricator.services.mozilla.com/D264474
2025-09-15 14:21:47 +00:00
Cristina Horotan 9e34621d53 Revert "Bug 1983309 - Reduce lock contention in TaskQueue, r=xpcom-reviewers,jstutte" for causing multiple failures
This reverts commit deb16dbc30.
2025-08-29 17:49:39 +00:00
Nika Layzell deb16dbc30 Bug 1983309 - Reduce lock contention in TaskQueue, r=xpcom-reviewers,jstutte
This patch aims to reduce lock contention when dispatching to TaskQueue, by reducing the frequency with which the runner thread needs to acquire the TaskQueue monitor.
Prior to this change, if there is a backlog of queued runnables, TaskQueue::Runner would acquire mQueueMonitor 3 times per event. After this change, mQueueMonitor will only be acquired when the set of tasks read the last time the monitor was held have all been processed.
TaskQueue would need to change to use an unbounded lock-free MPSC queue in order to further reduce contention when dispatching. Doing so is a much larger project, and would require more substantial changes to the TaskQueue type to make state management (especially around shutdown) avoid locking.

Differential Revision: https://phabricator.services.mozilla.com/D261278
2025-08-29 16:23:36 +00:00
Nika Layzell b66d532c27 Bug 1824189 - Add a NS_DISPATCH_FALLIBLE flag to specify that events should not be leaked on error, r=xpcom-reviewers,necko-reviewers,geckoview-reviewers,media-playback-reviewers,webrtc-reviewers,bwc,padenot,emilio,jstutte,dom-worker-reviewers,asuth,kershaw,ohall
Differential Revision: https://phabricator.services.mozilla.com/D258327
2025-08-26 16:47:30 +00:00
Atila Butkovits a906e9e172 Revert "Bug 1824189 - Add a NS_DISPATCH_FALLIBLE flag to specify that events should not be leaked on error, r=xpcom-reviewers,necko-reviewers,geckoview-reviewers,media-playback-reviewers,webrtc-reviewers,bwc,padenot,emilio,jstutte,dom-worker-reviewers,asuth,kershaw,ohall" for causing leaks complaining about MediaTransportHandlerSTS.
This reverts commit 381d5dd6f0.
2025-08-26 00:43:59 +00:00
Nika Layzell 381d5dd6f0 Bug 1824189 - Add a NS_DISPATCH_FALLIBLE flag to specify that events should not be leaked on error, r=xpcom-reviewers,necko-reviewers,geckoview-reviewers,media-playback-reviewers,webrtc-reviewers,bwc,padenot,emilio,jstutte,dom-worker-reviewers,asuth,kershaw,ohall
Differential Revision: https://phabricator.services.mozilla.com/D258327
2025-08-25 23:20:08 +00:00
Andreas Pehrson 794b587e3c Bug 1968812 - Add an Observer to TaskQueue. r=xpcom-reviewers,nika
This way our WebrtcTaskQueueWrapper can natively set up the RAII class
webrtc::CurrentTaskQueueSetter on the thread the TaskQueue runs on.
Then all tasks running on the TaskQueue can identify as being on the correct
webrtc::TaskQueueBase, regardless of how they were dispatched.

Differential Revision: https://phabricator.services.mozilla.com/D251427
2025-06-19 14:17:32 +00:00
Atila Butkovits 861d860e35 Revert "Bug 1968812 - Remove the CallWorker thread and use TaskQueue::Observer instead. r=bwc" for causing failures complaining about mutexLock.
This reverts commit d53f26b530.

Revert "Bug 1968812 - Copy WebrtcTaskQueueWrapper.h to WebrtcTaskQueueWrapper.cpp. r=bwc"

This reverts commit b0d97303dc.

Revert "Bug 1968812 - In WebrtcTaskQueueWrapper, inject the CurrentTaskQueueSetter through the TaskQueue::Observer interface instead of wrapping tasks. r=bwc"

This reverts commit 9b6c76197d.

Revert "Bug 1968812 - Add an Observer to TaskQueue. r=xpcom-reviewers,nika"

This reverts commit 6d63b62958.

Revert "Bug 1968812 - Rename TaskQueueWrapper to WebrtcTaskQueueWrapper to better indicate what it wraps. r=bwc"

This reverts commit 087b7fd11e.

Revert "Bug 1968812 - Add gtest. r=bwc"

This reverts commit 85928698b2.
2025-06-11 20:29:40 +00:00
Andreas Pehrson 6d63b62958 Bug 1968812 - Add an Observer to TaskQueue. r=xpcom-reviewers,nika
This way our WebrtcTaskQueueWrapper can natively set up the RAII class
webrtc::CurrentTaskQueueSetter on the thread the TaskQueue runs on.
Then all tasks running on the TaskQueue can identify as being on the correct
webrtc::TaskQueueBase, regardless of how they were dispatched.

Differential Revision: https://phabricator.services.mozilla.com/D251427
2025-06-11 13:39:46 +00:00
Andreas Pehrson 937787cce5 Bug 1971198 - Make GetCurrentSerialEventTarget() valid during TaskQueue direct tasks. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D253124
2025-06-11 08:47:24 +00:00
Sylvestre Ledru 8ae54ea4f9 Bug 1519636 - Reformat recent changes to the Google coding style r=geckoview-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,nalexander,gstoll,tcampbell,janv,julienw
Updated with clang-format version 19.1.7 (taskcluster-DYvBxDZJRVqTi8E7pTSJAQ)

Differential Revision: https://phabricator.services.mozilla.com/D249880
2025-05-17 19:11:13 +00:00
Karl Tomlinson f8f446b788 Bug 1965992 Support do_QueryObject to TaskQueue r=xpcom-reviewers,emilio
This allows TaskQueue::AwaitIdle() to be used in GTests that identify the
TaskQueue via AbstractThread::GetCurrent().

Differential Revision: https://phabricator.services.mozilla.com/D249212
2025-05-15 04:58:34 +00:00
Jeff Muizelaar 52a79d9c33 Bug 1947266 - Use PROFILER_MARKER instead of profiler_add_marker
This cleans up the callsite a little.

Differential Revision: https://phabricator.services.mozilla.com/D237609
2025-02-11 14:29:51 +00:00
Jeff Muizelaar 5deabacd64 Bug 1933335 - Annotate Runnable profiler markers with flows r=profiler-reviewers,mstange
Differential Revision: https://phabricator.services.mozilla.com/D230181
2024-11-29 15:37:56 +00:00
Karl Tomlinson 25447d4be1 Bug 1840313 fetch and remove the first element of queue in one operation r=emilio
The two-step logic was left over from a previous std::queue implementation.
https://hg.mozilla.org/mozilla-central/rev/4534179de22c013eb97e8226a538096d7a648721#l2.36

Depends on D181966

Differential Revision: https://phabricator.services.mozilla.com/D181967
2023-06-26 21:52:50 +00:00
Karl Tomlinson 39b84e7e1a Bug 1840313 remove declaration of non-existent TaskQueue::CancelDelayedRunnables() r=emilio
Gone since https://hg.mozilla.org/mozilla-central/rev/ad682061ae5c#l26.116

Differential Revision: https://phabricator.services.mozilla.com/D181965
2023-06-26 21:52:50 +00:00
Nika Layzell bcebb32f5d Bug 1738106 - Part 5: Track TaskQueue lifetimes to avoid leaking TaskQueues, r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D142606
2022-05-02 20:37:35 +00:00
Nika Layzell 5d5537e48b Bug 1738106 - Part 4: Support ThreadSafeWeakPtr in TaskQueue, r=xpcom-reviewers,mccr8
This will be used to allow the BackgroundEventTarget to safely hold weak
references to active TaskQueues managed by it.

Differential Revision: https://phabricator.services.mozilla.com/D142605
2022-05-02 20:37:35 +00:00
Nika Layzell 260ebb1412 Bug 1738106 - Part 3: Switch to TaskQueue::Create, r=xpcom-reviewers,necko-reviewers,media-playback-reviewers,dragana,alwu,barret
In future parts, TaskQueue will require extra initialization to be performed
which cannot happen in a constructor, as it takes references to the TaskQueue
object itself, which will require the introduction of a helper method. This
patch switches all callers of the TaskQueue constructor to use the new method.

Differential Revision: https://phabricator.services.mozilla.com/D142604
2022-05-02 20:37:34 +00:00
Nika Layzell c320f56d5b Bug 1738103 - Part 4: Add XPCOM support for shutdown tasks, r=necko-reviewers,KrisWright
Tasks registered with shutdown tasks are called when the target
nsISerialEventTarget is about to be destroyed.

Differential Revision: https://phabricator.services.mozilla.com/D129840
2022-03-23 22:22:04 +00:00
Nika Layzell 9fcf4a2290 Bug 1738103 - Part 2: Accept messages for TaskQueue until queue is exhausted during shutdown, r=xpcom-reviewers,KrisWright
This makes the behaviour of TaskQueue more in-line with nsThread, which may be
useful when converting code to using taskqueue instead of threads.

Differential Revision: https://phabricator.services.mozilla.com/D129838
2022-03-23 22:22:03 +00:00
Andreas Pehrson 2c8b545c62 Bug 1746361 - Gecko Profiler: Track wrapped runnables throughout the tree. r=gerald
The Runnable markers in the profilers are handy, but miss many types of
runnables. This includes most of those that wrap another runnable and run that
at a (possibly) later time.

AbstractThread, TaskDispatcher and TaskQueue does this for e.g. tail dispatched
tasks.

TaskQueueWrapper does this when wrapping webrtc tasks (and Mozilla Runnables) to
be run in a Mozilla TaskQueue with some overhead on the stack.

DelayedRunnable wraps a runnable to be run after a timeout.

It would perhaps be better in many cases to ignore the intermediate runnables,
but I haven't seen a straight forward way to achieve this.

More detailed data could be added on a case by case basis, for instance the
delay for a DelayedRunnable (incl. actual vs. target delay) or the scope of a
task in which a tail-dispatched runnable was dispatched. But this is also true
for the status quo (for instance the time from dispatch to run) so I leave these
ideas as future work.

Differential Revision: https://phabricator.services.mozilla.com/D135027
2022-01-05 15:26:24 +00:00
Butkovits Atila 4b43d05ec4 Backed out 7 changesets (bug 1746361, bug 1748280, bug 1746347) for causing failures at browser_interaction-between-interfaces.js. CLOSED TREE
Backed out changeset eccba94506f0 (bug 1748280)
Backed out changeset baf39ae53772 (bug 1748280)
Backed out changeset 775843562f7e (bug 1748280)
Backed out changeset 0987c68e9683 (bug 1748280)
Backed out changeset 58dd008520da (bug 1746361)
Backed out changeset 6f9e800877a6 (bug 1746347)
Backed out changeset f78e794a9c2f (bug 1746347)
2022-01-05 13:53:57 +02:00
Andreas Pehrson a9289e0244 Bug 1746361 - Gecko Profiler: Track wrapped runnables throughout the tree. r=gerald
The Runnable markers in the profilers are handy, but miss many types of
runnables. This includes most of those that wrap another runnable and run that
at a (possibly) later time.

AbstractThread, TaskDispatcher and TaskQueue does this for e.g. tail dispatched
tasks.

TaskQueueWrapper does this when wrapping webrtc tasks (and Mozilla Runnables) to
be run in a Mozilla TaskQueue with some overhead on the stack.

DelayedRunnable wraps a runnable to be run after a timeout.

It would perhaps be better in many cases to ignore the intermediate runnables,
but I haven't seen a straight forward way to achieve this.

More detailed data could be added on a case by case basis, for instance the
delay for a DelayedRunnable (incl. actual vs. target delay) or the scope of a
task in which a tail-dispatched runnable was dispatched. But this is also true
for the status quo (for instance the time from dispatch to run) so I leave these
ideas as future work.

Differential Revision: https://phabricator.services.mozilla.com/D135027
2022-01-05 10:54:20 +00:00
Randell Jesup 8167318db4 Bug 1743895: Add names to all TaskQueues, remove no-name constructor r=nika,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D132638
2021-12-03 03:16:15 +00:00
kriswright eba3b4de71 Bug 1678149 - Use a mozilla::Queue in TaskQueue r=xpcom-reviewers,mccr8
It looks like we can do a mostly direct swap from `std::Queue` to `mozilla::Queue` without needing to expose any new API, so that's what I've done here.

Differential Revision: https://phabricator.services.mozilla.com/D123523
2021-08-25 14:10:06 +00:00
Kris Wright 7f6e31498f Bug 1704887 - Discard results of RemoveElement for DelayedRunnable r=necko-reviewers,xpcom-reviewers,mccr8,valentin
This silences a lint error on the previous patches in the series.

Differential Revision: https://phabricator.services.mozilla.com/D113160
2021-05-28 19:05:29 +00:00
Andreas Pehrson ec63d0f3e4 Bug 1704887 - Remove assertions in OnDelayedRunnableRan. r=KrisWright,necko-reviewers,valentin
DelayedDispatch, in all current implementations, will set up a timer sync and
then Dispatch() a runnable. Since the timer is set up before the Dispatch, there
is a theoretical chance that the timer fires and dispatches a TimerEvent to the
target thread before DelayedDispatch managed to do so. When this happens the
internal DelayedDispatch runnable exits early, i.e., in practice it never runs.

The chance increases dramatically if the Dispatch() to the target in question is
tail dispatched, since the time between DelayedDispatch and the tail could be
non-trivial.

This patch removes the assert that checks that all DelayedRunnables that have
run have also been scheduled, since per the above no such guarantee exists.

Differential Revision: https://phabricator.services.mozilla.com/D112876
2021-05-28 19:05:29 +00:00
Dorel Luca fc1039e2a9 Backed out 2 changesets (bug 1707924) for multiple failures with crash [@ BackgroundEventTarget::CreateBackgroundTaskQueue(char const*)]. CLOSED TREE
Backed out changeset 7fda47840322 (bug 1707924)
Backed out changeset c6213e0b8024 (bug 1707924)
2021-04-30 06:20:24 +03:00
kriswright 2387a2e14e Bug 1707924 - Assert on DelayedRunnable dispatch on non debug builds. r=xpcom-reviewers,nika
This assertion currently only happens on debug builds, but attempts to dispatch delayed runnables after we have started or finished cancelling all delayed runnables in a TaskQueue may be causing shutdown hangs.

Differential Revision: https://phabricator.services.mozilla.com/D113839
2021-04-30 00:58:48 +00:00
Andreea Pavel 79c809c265 Backed out 3 changesets (bug 1704887) for Gtest failures on a CLOSED TREE
Backed out changeset 211dcc933514 (bug 1704887)
Backed out changeset bde076bfca7e (bug 1704887)
Backed out changeset 34e875f85b88 (bug 1704887)
2021-04-23 03:40:57 +03:00
Kris Wright 05d1049acb Bug 1704887 - Discard results of RemoveElement for DelayedRunnable r=necko-reviewers,xpcom-reviewers,mccr8,valentin
This silences a lint error on the previous patches in the series.

Differential Revision: https://phabricator.services.mozilla.com/D113160
2021-04-22 21:32:39 +00:00
Andreas Pehrson 6f44e0e8d2 Bug 1704887 - Remove assertions in OnDelayedRunnableRan. r=KrisWright,necko-reviewers,valentin
DelayedDispatch, in all current implementations, will set up a timer sync and
then Dispatch() a runnable. Since the timer is set up before the Dispatch, there
is a theoretical chance that the timer fires and dispatches a TimerEvent to the
target thread before DelayedDispatch managed to do so. When this happens the
internal DelayedDispatch runnable exits early, i.e., in practice it never runs.

The chance increases dramatically if the Dispatch() to the target in question is
tail dispatched, since the time between DelayedDispatch and the tail could be
non-trivial.

This patch removes the assert that checks that all DelayedRunnables that have
run have also been scheduled, since per the above no such guarantee exists.

Differential Revision: https://phabricator.services.mozilla.com/D112876
2021-04-22 21:32:39 +00:00
Andreas Pehrson 6b5a6f5a8a Bug 1695580 - In xpcom, cancel pending DelayedRunnable timers on shutdown. r=KrisWright
Because DelayedRunnables are fire-and-forget, there is no way for a targeted
EventTarget to clean them up on shutdown. Thus if a timer fires after
EventTarget shutdown it will fail to dispatch the timer event, and avoid
releasing the timer callback because it's not on the targeted thread. This
causes a leak as there is a ref-cycle between nsTimerImpl::mCallback and
DelayedRunnable::mTimer.

This patch adds nsIDelayedRunnableObserver for a target to observe which
DelayedRunnables are relying on their timer to run them. This allows the target
to schedule a shutdown task to cancel those timers and release the runnables on
the target thread.

Supported DelayedRunnable targets with this patch are TaskQueues,
eventqueue-based nsThreads and XPCOMThreadWrappers that wrap a supported
nsThread.

An assertion makes sure at runtime that future new uses of DelayedRunnable
target nsIDelayedRunnableObserver-supported event targets.

Differential Revision: https://phabricator.services.mozilla.com/D109781
2021-04-06 20:15:11 +00:00
Brindusan Cristian 13b2a5f0b2 Backed out 8 changesets (bug 1695580) for causing build bustages on DataMutex.h. CLOSED TREE
Backed out changeset ec0b0fcc8d88 (bug 1695580)
Backed out changeset 982a46056fcb (bug 1695580)
Backed out changeset e38e8b90f119 (bug 1695580)
Backed out changeset 6fdd154aa151 (bug 1695580)
Backed out changeset d04f7a7ec375 (bug 1695580)
Backed out changeset 2103cd9e58b7 (bug 1695580)
Backed out changeset de9a7dd7fc79 (bug 1695580)
Backed out changeset ae16f09be41b (bug 1695580)
2021-04-06 17:41:19 +03:00
Andreas Pehrson 42799c4a6e Bug 1695580 - In xpcom, cancel pending DelayedRunnable timers on shutdown. r=KrisWright
Because DelayedRunnables are fire-and-forget, there is no way for a targeted
EventTarget to clean them up on shutdown. Thus if a timer fires after
EventTarget shutdown it will fail to dispatch the timer event, and avoid
releasing the timer callback because it's not on the targeted thread. This
causes a leak as there is a ref-cycle between nsTimerImpl::mCallback and
DelayedRunnable::mTimer.

This patch adds nsIDelayedRunnableObserver for a target to observe which
DelayedRunnables are relying on their timer to run them. This allows the target
to schedule a shutdown task to cancel those timers and release the runnables on
the target thread.

Supported DelayedRunnable targets with this patch are TaskQueues,
eventqueue-based nsThreads and XPCOMThreadWrappers that wrap a supported
nsThread.

An assertion makes sure at runtime that future new uses of DelayedRunnable
target nsIDelayedRunnableObserver-supported event targets.

Differential Revision: https://phabricator.services.mozilla.com/D109781
2021-04-06 12:16:11 +00:00
Honza Bambas e1aac42566 Bug 1638925 - Ensure that the event gets destroyed within the guards r=jya
Differential Revision: https://phabricator.services.mozilla.com/D80171
2020-06-24 13:51:25 +00:00
Jean-Yves Avenard 1d05f87c1f Bug 1637500 - P1. Have GetCurrentThreadSerialEventTarget returns the currently running TaskQueue if any. r=froydnj
In the future, we may want to extend GetCurrentThreadSerialEventTarget to return the actual nsISerialEventTarget used to dispatch the task.

Differential Revision: https://phabricator.services.mozilla.com/D80353
2020-06-23 05:02:39 +00:00
Jean-Yves Avenard d28bc98c76 Bug 1646054 - P2. Always retain dispatch flags r=froydnj
When TaskQueue was first conceived; it was only used with AbstractThreads and with tail dispatch.
By default, AbstractThread::Dispatch dropped the flags , as it was dispatching all tasks via the tail dispatcher.

It was an oversight, there's no use-case where we wouldn't want the dispatch flags to be carried forward.

It also simplifies the code and TaskQueue's use.

Depends on D80351

Differential Revision: https://phabricator.services.mozilla.com/D80352
2020-06-22 13:55:23 +00:00
Jean-Yves Avenard a5c6bb8904 Bug 1646054 - P1. Remove EventTargetWrapper class. r=froydnj
We also establish the intent of bug 1602167 on the TaskQueue object

Differential Revision: https://phabricator.services.mozilla.com/D80351
2020-06-22 13:55:21 +00:00
Jean-Yves Avenard 962915402f Bug 1644009 - P9. Add nsIDirectTaskDispatcher interface. r=froydnj
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.

Differential Revision: https://phabricator.services.mozilla.com/D79093
2020-06-12 05:10:25 +00:00