Skip to content

Commit

Permalink
Bug 1649974 - P1. Make WeakPtr work with generic taskqueue. r=froydnj
Browse files Browse the repository at this point in the history
It worked until now as IPC's MessageChannel was only used with background taskqueue; which use a threadpool made of a single thread only.

Differential Revision: https://phabricator.services.mozilla.com/D82499
  • Loading branch information
Jean-Yves Avenard committed Jul 10, 2020
1 parent 543079d commit bd648e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions js/src/devtools/rootAnalysis/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ var ignoreFunctions = {

// Calls MergeSort
"uint8 v8::internal::RegExpDisjunction::SortConsecutiveAtoms(v8::internal::RegExpCompiler*)": true,

// nsIEventTarget.IsOnCurrentThreadInfallible does not get resolved, and
// this is called on non-JS threads so cannot use AutoSuppressGCAnalysis.
"uint8 nsAutoOwningEventTarget::IsCurrentThread() const": true,
};

function extraGCFunctions() {
Expand Down
6 changes: 3 additions & 3 deletions mfbt/WeakPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@
// on a single thread. The following macros implement assertions for
// checking these conditions.
//
// We re-use XPCOM's nsAutoOwningThread checks when they are available. This has
// the advantage that it works with cooperative thread pools.
// We re-use XPCOM's nsAutoOwningEventTarget checks when they are available.
// This has the advantage that it works with cooperative thread pools.

# define MOZ_WEAKPTR_DECLARE_THREAD_SAFETY_CHECK \
/* Will be none if mPtr = nullptr. */ \
Maybe<nsAutoOwningThread> _owningThread;
Maybe<nsAutoOwningEventTarget> _owningThread;
# define MOZ_WEAKPTR_INIT_THREAD_SAFETY_CHECK() \
do { \
if (p) { \
Expand Down

0 comments on commit bd648e6

Please sign in to comment.