зеркало из https://github.com/mozilla/gecko-dev.git
f9c6ad1082
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 |
||
---|---|---|
.. | ||
base | ||
build | ||
components | ||
docs | ||
ds | ||
glue | ||
idl-parser | ||
io | ||
libxpt/xptcall | ||
reflect | ||
rust | ||
string | ||
system | ||
tests | ||
threads | ||
windbgdlg | ||
xpidl | ||
moz.build | ||
xpcom-config.h.in |