gecko-dev/xpcom
Andreas Pehrson f9c6ad1082 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
..
base Backed out 24 changesets (bug 1682030) for bustage on ProcessHangMonitor.cpp and nsCOMPtr.h. CLOSED TREE 2021-04-06 03:54:12 +03:00
build Bug 1695580 - In xpcom, cancel pending DelayedRunnable timers on shutdown. r=KrisWright 2021-04-06 12:16:11 +00:00
components Backed out 24 changesets (bug 1682030) for bustage on ProcessHangMonitor.cpp and nsCOMPtr.h. CLOSED TREE 2021-04-06 03:54:12 +03:00
docs Bug 1702245 - Expand XPCOM's in-tree documentation, r=xpcom-reviewers,kmag 2021-04-05 15:56:18 +00:00
ds Backed out 24 changesets (bug 1682030) for bustage on ProcessHangMonitor.cpp and nsCOMPtr.h. CLOSED TREE 2021-04-06 03:54:12 +03:00
glue Bug 1698388 - Fix static-analysis warnings in NetLinkService.cpp r=necko-reviewers,kershaw 2021-03-15 10:28:32 +00:00
idl-parser Bug 1647259 - Replace unsubscriptable value 'list' with 'attlist' r=nika 2021-02-01 15:57:44 +00:00
io Bug 1697721 - Have nsLocalFile::CreateAllAncestors make each path component. r=xpcom-reviewers,kmag 2021-04-06 11:49:24 +00:00
libxpt/xptcall
reflect Bug 1690152 - on ppc64 properly skip parameter slots if we overflow GPRs while still having FPRs to burn. r=tcampbell 2021-02-02 02:04:20 +00:00
rust Bug 1678330: Ensure nested SpinEventLoopUntil(OrShutdown) calls are traceable to the originating source in case of crash. r=nika,extension-reviewers 2021-03-02 22:11:58 +00:00
string Bug 1696261 - Optimize nsDataHandler and nsSimpleURI::SetSpec to do fewer passes r=necko-reviewers,kershaw 2021-04-06 08:37:40 +00:00
system Backed out 24 changesets (bug 1682030) for bustage on ProcessHangMonitor.cpp and nsCOMPtr.h. CLOSED TREE 2021-04-06 03:54:12 +03:00
tests Bug 1695580 - Add gtests. r=xpcom-reviewers,nika 2021-04-06 12:16:10 +00:00
threads Bug 1695580 - In xpcom, cancel pending DelayedRunnable timers on shutdown. r=KrisWright 2021-04-06 12:16:11 +00:00
windbgdlg
xpidl
moz.build Bug 1695954: Move Gecko Logging MDN Page In-tree r=nika 2021-03-09 16:27:29 +00:00
xpcom-config.h.in