mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1856087 - Bypass assertion if NS_DISPATCH_IGNORE_BLOCK_DISPATCH is set, r=xpcom-reviewers,jstutte
The `gXPCOMThreadsShutDownNotified` assertion exists to discourage dispatching to a background thread after xpcom-shutdown-threads. This unfortunately poorly interacts with the nsThreadPool implementation. We use nsThreadPools all of the way until threads are fully shut down during ShutdownNonMainThreads, and they dispatch a runnable to a background thread when starting a new thread. This patch disables the assertion when NS_DISPATCH_IGNORE_BLOCK_DISPATCH is specified. This flag already effectively indicates "trust me I am dispatching to a thread which is in a weird state, this dispatch must succeed", so seems appropriate to use in this situation, and will avoid the underlying issue. The nsThreadPool runnable is already dispatched with this flag set. Differential Revision: https://phabricator.services.mozilla.com/D190303
This commit is contained in:
parent
51c68d3e2a
commit
04650d926f
@ -73,7 +73,8 @@ ThreadEventTarget::Dispatch(already_AddRefed<nsIRunnable> aEvent,
|
||||
}
|
||||
|
||||
NS_ASSERTION(!gXPCOMThreadsShutDownNotified || mIsMainThread ||
|
||||
PR_GetCurrentThread() == mThread,
|
||||
PR_GetCurrentThread() == mThread ||
|
||||
(aFlags & NS_DISPATCH_IGNORE_BLOCK_DISPATCH),
|
||||
"Dispatch to non-main thread after xpcom-shutdown-threads");
|
||||
|
||||
if (mBlockDispatch && !(aFlags & NS_DISPATCH_IGNORE_BLOCK_DISPATCH)) {
|
||||
|
Loading…
Reference in New Issue
Block a user