Otherwise, we might enter JS, decide to GC, and deadlock because we were
trying to dispatch tasks to the main thread's event queue while holding
the lock for the event queue.
This enables having a const nsMainThreadPtrHandle<T> member which we want to
ensure doesn't get assigned to, but whose (the `T`'s) non-const methods are
still usable on main thread. Similar to how RefPtr<T> works.
MozReview-Commit-ID: 8CG0MwIZmLc
--HG--
extra : rebase_source : f0e897d3bf4f9a4d752e964ef63de73a9e710752
Currently nsIThreadManager::spinEventLoopUntil doesn't monitor the shutting
down. Firefox shutting down can be blocked by a 'broken' use of
nsIThreadManager::spinEventLoopUntil.
nsIThreadManager::spinEventLoopUntilOrShutdown should be used instead.
It was decided in bug 1430669 that we won't enable gcc's -Wsuggest-override warnings at this time, so these ugly pragmas from bug 1428535 won't be necessary.
--HG--
extra : rebase_source : 221b1f40bb071933ad3e320ce2fa491b2a5917fb
extra : amend_source : 7fc3e6ff067aa5ae8d728e1751de3d2590d31493
The NS_IMPL_NAMED_* macros rely on the mName field, which are not
defined on beta or release, so don't use them on those branches, so
that Firefox will build.
MozReview-Commit-ID: 9wEnPqshBJ8
--HG--
extra : rebase_source : 1ee201c1f0049b02fb57679908915920226592a2
Most subclasses of Runnable don't bother to override AddRef and
Release, so XPCOM leak checking ends up reporting Runnable, which
makes it impossible to know what is actually leaking.
Each subclass of Runnable is already required to pass in the name of
the class, which is stored in the field mName. This patch changes
Runnable to use mName as the class name for XPCOM leak checking, thus
giving each subclass a specific name without needing to change the
hundreds of existing subclasses of Runnable.
The limitation of this approach is the classes that DO use
NS_IMPL_ADDREF/RELEASE_INHERITED end up using the same class name that
is used by the superclass AddRef/Release, but with a different size,
which causes assertions in the leak checker. To work around this, I
change NS_IMPL_ADDREF/RELEASE_INHERITED to not call into
NS_LOG_ADDREF/RELEASE for classes that are a subclass of
Runnable. This needs to use IsConvertible<> and not IsBaseOf<> because
the latter requires the classes involved to be defined, and headers
can use nsISupportsImpl.h without nsThreadUtils.h.
MozReview-Commit-ID: H0pgvwQSZAE
--HG--
extra : rebase_source : 0be13fe2e649e62be1f9471fc03fac43024eb0aa
Make unlabeled runnables be the runnables we tag with extra
information, since they're the ones we want to decrease.
Note: This changes values gathered for telemetry!
If any of the promises gets resolved/rejected prior MozPromise::All completing, it would return nullptr
MozReview-Commit-ID: Lqhv2t2upvF
--HG--
extra : rebase_source : 0c85172958c00a2ac3aa0bd33e4e50dd1893c3ba
This removes an unnecessary level of indirection by replacing all
nsStringGlue.h instances with just nsString.h.
--HG--
extra : rebase_source : 340989240af4018f3ebfd92826ae11b0cb46d019
There's no good reason why these can't be code constants.
Especially given that, due to a bug, changes to the
"idle_queue.{min,long}_period" constants were not being passed onto the C++
code!
Here's why: those two prefs were specified as integers in all.js. But we used
AddFloatVarCache() to set up the reading of those prefs. libpref fakes floats
by storing them as strings and then converting them to floats when they are
read.
Which means that AddFloatVarCache() used to fail to get the value from all.js
-- because there's a type mismatch, int vs. string -- and instead use the
fallback default. That value is the same as the one in all.js, which is lucky.
But if someone changed the value in about:config to 100 (an integer), a similar
failure would have occured and the value used by the C++ code wouldn't be
updated!
Also note that idle_queue.max_timer_thread_bound did not have a value in
all.js.
What a mess!
--HG--
extra : rebase_source : 86f8fa905163803eb95007609c029e18c2c4f586
We can save the entry in the hashtable, and then re-use that entry as a
starting point for removing from the hashtable, should that become
necessary. This saves us having to rehash things, at a minimum.
Defining Get() in the declaration of InputEventStatistics implicitly
sticks an "inline" on the function, which is not what we want: inlining
it spreads around a lot of static initialization code. Providing an
out-of-line definition is much better in terms of code size.
We were extracting elements from the queue and unnecessarily refcounting
them, rather than transferring the owning reference out of the queue and
out to the caller.
This lets us replace moz_xstrdup() of string literals with AssignLiteral(),
among other improvements.
--HG--
extra : rebase_source : 9994d8ccb4f196cf63564b0dac2ae6c4370defb4