gecko-dev/xpcom/threads
Nika Layzell 3e323b7d7a Bug 1739727 - Part 2: Improve rust async support in moz_task, r=emilio
This patch contains changes to moz_task to improve it's support for
async execution on multiple threads. Unlike the previous executor
implementation, this new implementation reduces the amount of unsafe
code substantially by depending on the async-task crate
(https://crates.io/crates/async-task) for the core task implementation.
This adds a few additional features:

 * Both local (no Send bound) and non-local (with Send bound) execution support,
 * Support for spawning on arbitrary nsIEventTargets or the background task pool,
 * Returned Task objects from runnables which may be .await-ed on or detach()-ed,
 * Support for spawning with the NS_DISPATCH_EVENT_MAY_BLOCK flag set,
 * Automatic use of NS_DISPATCH_AT_END when required,
 * Support for specifying the runnable priority for runnables.

There are also some correctness improvements, and exposed a better API
for dispatching normal runnable functions to background threads.

After these changes the TaskRunnable API should no longer be necessary.
It is re-implemented on top of the executor and kept in-place to avoid
rewriting all consumers.

Differential Revision: https://phabricator.services.mozilla.com/D130705
2021-12-07 20:01:41 +00:00
..
AbstractThread.cpp
AbstractThread.h
BlockingResourceBase.cpp Bug 1727563 - Implement TryLock methods and RAII helpers for RWLock. r=xpcom-reviewers,nika 2021-09-08 10:40:07 +00:00
BlockingResourceBase.h
CPUUsageWatcher.cpp Bug 1733308 - Fix non-unified builds errors in xpcom/threads. r=xpcom-reviewers,mccr8 2021-10-01 01:49:18 +00:00
CPUUsageWatcher.h
CondVar.h
DataMutex.h
DeadlockDetector.h
DelayedRunnable.cpp
DelayedRunnable.h
EventQueue.cpp Bug 1738627 - Store distinct profiling features of individual threads - r=canaltinova 2021-11-08 23:59:35 +00:00
EventQueue.h Bug 1734809 - add a new task priority between vsync and control, r=bas 2021-10-08 19:29:36 +00:00
IdlePeriodState.cpp
IdlePeriodState.h
IdleTaskRunner.cpp Backed out 5 changesets (bug 1672121) for various crashes on mozalloc_handle_oom. CLOSED TREE 2021-11-30 02:59:20 +02:00
IdleTaskRunner.h Backed out 5 changesets (bug 1672121) for various crashes on mozalloc_handle_oom. CLOSED TREE 2021-11-30 02:59:20 +02:00
InputEventStatistics.cpp Bug 1733308 - Fix non-unified builds errors in xpcom/threads. r=xpcom-reviewers,mccr8 2021-10-01 01:49:18 +00:00
InputEventStatistics.h
InputTaskManager.cpp Bug 1733308 - Fix non-unified builds errors in xpcom/threads. r=xpcom-reviewers,mccr8 2021-10-01 01:49:18 +00:00
InputTaskManager.h Bug 1733729: Fix non-unified build bustage in xpcom directory. r=mccr8 2021-10-05 00:29:56 +00:00
LazyIdleThread.cpp
LazyIdleThread.h
LeakRefPtr.h
MainThreadIdlePeriod.cpp Bug 1733308 - Fix non-unified builds errors in xpcom/threads. r=xpcom-reviewers,mccr8 2021-10-01 01:49:18 +00:00
MainThreadIdlePeriod.h
MainThreadUtils.h
Monitor.h
MozPromise.h
MozPromiseInlines.h Bug 1729458 - Part 1: Simplify DomPromiseListener, r=smaug,rpl 2021-09-14 15:02:58 +00:00
Mutex.h
PerformanceCounter.cpp
PerformanceCounter.h
Queue.h Bug 1733308 - Fix non-unified builds errors in xpcom/tests/gtest. r=xpcom-reviewers,mccr8 2021-10-01 01:49:19 +00:00
RWLock.cpp Bug 1727563 - Implement TryLock methods and RAII helpers for RWLock. r=xpcom-reviewers,nika 2021-09-08 10:40:07 +00:00
RWLock.h Bug 1727563 - Implement TryLock methods and RAII helpers for RWLock. r=xpcom-reviewers,nika 2021-09-08 10:40:07 +00:00
RecursiveMutex.cpp
RecursiveMutex.h
ReentrantMonitor.h
SchedulerGroup.cpp
SchedulerGroup.h
SharedThreadPool.cpp Bug 1731564: Use motivated SpinEventLoopUntil inside xpcom/*. r=xpcom-reviewers,nika 2021-10-07 08:06:16 +00:00
SharedThreadPool.h
SpinEventLoopUntil.h Bug 1731564: Add nested event loop stack to nsTerminator stderr output. r=xpcom-reviewers,nika 2021-10-07 08:06:17 +00:00
StateMirroring.h
StateWatching.h Backed out 2 changesets (bug 1738931) for causing mochitest failures on VideoConduit and WatchManager CLOSED TREE 2021-11-11 14:06:57 +02:00
SyncRunnable.h
SynchronizedEventQueue.cpp
SynchronizedEventQueue.h
TaskCategory.h
TaskController.cpp Bug 1738285 - move AUTO_PROFILE_FOLLOWING_RUNNABLE to its own header, r=gerald. 2021-10-28 20:35:06 +00:00
TaskController.h
TaskDispatcher.h
TaskQueue.cpp Bug 1743895: Add names to all TaskQueues, remove no-name constructor r=nika,necko-reviewers 2021-12-03 03:16:15 +00:00
TaskQueue.h Bug 1743895: Add names to all TaskQueues, remove no-name constructor r=nika,necko-reviewers 2021-12-03 03:16:15 +00:00
ThreadBound.h
ThreadDelay.cpp
ThreadDelay.h
ThreadEventQueue.cpp Bug 1736751 - Use swap in ThreadEventQueue::SetObserver. r=KrisWright 2021-11-08 17:37:02 +00:00
ThreadEventQueue.h
ThreadEventTarget.cpp Bug 1731564: Use motivated SpinEventLoopUntil inside xpcom/*. r=xpcom-reviewers,nika 2021-10-07 08:06:16 +00:00
ThreadEventTarget.h
ThreadLocalVariables.cpp
ThrottledEventQueue.cpp
ThrottledEventQueue.h
TimerThread.cpp Bug 1738627 - profiler_thread_is_being_profiled_for_markers - r=canaltinova 2021-11-08 23:59:35 +00:00
TimerThread.h Bug 1729964 - Move timer-release threading assert from TimerThread to nsTimerImpl. r=xpcom-reviewers,nika 2021-10-06 14:33:41 +00:00
VsyncTaskManager.cpp
VsyncTaskManager.h Bug 1733308 - Fix non-unified builds errors in xpcom/threads. r=xpcom-reviewers,mccr8 2021-10-01 01:49:18 +00:00
components.conf
moz.build Bug 1733308 - Fix non-unified builds errors in xpcom/threads. r=xpcom-reviewers,mccr8 2021-10-01 01:49:18 +00:00
nsEnvironment.cpp
nsEnvironment.h
nsICancelableRunnable.h
nsIDelayedRunnableObserver.h
nsIDirectTaskDispatcher.idl
nsIDiscardableRunnable.h
nsIEnvironment.idl
nsIEventTarget.idl
nsIIdlePeriod.idl
nsIIdleRunnable.h
nsINamed.idl
nsIProcess.idl
nsIRunnable.idl Bug 1734809 - add a new task priority between vsync and control, r=bas 2021-10-08 19:29:36 +00:00
nsISerialEventTarget.idl
nsISupportsPriority.idl
nsIThread.idl
nsIThreadInternal.idl
nsIThreadManager.idl
nsIThreadPool.idl
nsITimer.idl Bug 1529581 - Introduce initHighResolutionWithNamedFuncCallback for nsITimer. r=xpcom-reviewers,nika 2021-11-03 15:23:27 +00:00
nsMemoryPressure.cpp Bug 1733308 - Fix non-unified builds errors in xpcom/threads. r=xpcom-reviewers,mccr8 2021-10-01 01:49:18 +00:00
nsMemoryPressure.h
nsProcess.h Bug 1734262 - Suppress thread leak reports for the monitor thread. r=decoder 2021-10-16 16:29:32 +00:00
nsProcessCommon.cpp Bug 1519636 - Reformat recent changes to the Google coding style. r=firefox-build-system-reviewers,mhentges,sylvestre 2021-11-16 08:07:29 +00:00
nsProxyRelease.cpp Bug 1727497 - Return Dispatch result from NS_ProxyRelease; r=dom-storage-reviewers,xpcom-reviewers,nika,janv 2021-09-14 13:17:55 +00:00
nsProxyRelease.h Bug 1735299 - Remove last use of unnammed NS_ReleaseOnMainThread r=extension-reviewers,rpl,nhnt11 2021-10-19 13:44:25 +00:00
nsThread.cpp Bug 1741377: Add a check to verify the successful dispatch of the nsThread shutdown ack event. r=xpcom-reviewers,nika 2021-11-17 19:25:28 +00:00
nsThread.h Bug 1735129: Add thread-safe name getter to nsThread. r=xpcom-reviewers,nika 2021-10-21 11:51:08 +00:00
nsThreadManager.cpp Bug 1741131: Be explicit about the process type in the XPCOMSpinEventLoopStack annotation. r=xpcom-reviewers,nika 2021-11-23 17:47:59 +00:00
nsThreadManager.h Bug 1731564: Introduce a motivated SpinEventLoopUntil for direct use from C++. r=xpcom-reviewers,nika,necko-reviewers 2021-10-07 08:06:10 +00:00
nsThreadPool.cpp Bug 1740899: Make nsThreadPool::Shutdown(WithTimeout) return an error on re-entrance. r=xpcom-reviewers,nika 2021-11-19 18:00:52 +00:00
nsThreadPool.h
nsThreadSyncDispatch.h
nsThreadUtils.cpp Bug 1739727 - Part 2: Improve rust async support in moz_task, r=emilio 2021-12-07 20:01:41 +00:00
nsThreadUtils.h Bug 1734811 - consider to use higher priority for the imglib tasks r=tnikkel 2021-10-08 19:29:37 +00:00
nsTimerImpl.cpp Bug 1739421: Use kungFuDeathGrip when firing a timer r=bwc 2021-11-08 23:00:30 +00:00
nsTimerImpl.h Bug 1529581 - Introduce initHighResolutionWithNamedFuncCallback for nsITimer. r=xpcom-reviewers,nika 2021-11-03 15:23:27 +00:00