CLOSED TREE
Backed out changeset 3ffbd71ee977 (bug 1290551)
Backed out changeset 77bda0e9caba (bug 1290551)
Backed out changeset 3763a23b6353 (bug 1290550)
There was a lot of manual management of the map's string values. By using
UniqueChars, everything happens automatically and at the right time in
destructors.
--HG--
extra : rebase_source : f4522c4cf5f67163726e0f1f8aca77e512e2fadd
The js::SPSProfiler::lock_ only existed to protect the js::SPSProfiler::strings
member[0], but it was not clear at all whether it protected all members or
what. Instead, let's wrap the strings member in a js::ExclusiveData so that
the *only* way to access it by taking the lock and so that it is clear what
members need locking.
And of course there were multiple places where the member wasn't getting locked
properly...
[0] See
http://searchfox.org/mozilla-central/diff/0df4a565cc0c7ce54d0f7628a87280a6dca140c4/js/src/vm/SPSProfiler.h#215
for the archaeology bits.
--HG--
extra : rebase_source : b157315e9975529a7553cb236980caa8acd48bf9
XPCNativeInterface::Mark(), Unmark() and IsMarked() don't do anything
any more, so anything that calls them can be deleted. This removes the
only use of XPCCallContext::CanGetInterface(), so delete that, too.
MozReview-Commit-ID: 4w3aPTVXNDI
There are four classes that call Root() on XPCNativeInterface, and
thus keep interfaces alive. Each of these gets converted to use a
RefPtr:
1. XPCCallContext. This could be on some kind of hot path, but the
FindMemberCall involves various string operations and hashtable
lookups, so adding a single AddRef shouldn't matter. One weirdness
here is that the context only roots the interface when |mState >=
HAVE_NAME|. With a RefPtr<>, this requires nulling out
mInterface. Fortunately, in most cases where it moves from rooting to
non-rooting, it already does this. The one case it does not is in
SystemIsBeingShutDown(), so my patch adds that.
2. XPCNativeSet. This holds an array of interfaces in a weird
placement new array at the end of the object. I wasn't sure how a
non-POD class would interact with the way the array is handled with
casting, so I manually AddRef and Release things put into or removed
from the array.
3. AutoMarkingNativeInterfacePtr simply becomes RefPtr<>. This is the
bulk of the patch, in terms of number of lines changed.
4. Similarly, the one AutoMarkingNativeInterfacePtrArrayPtr becomes
nsTArray<RefPtr<>>. This is the last use of the auto marking array
class, so I deleted it.
Here are some other notes on what the patch does:
- XPCNativeInterfaces are created with placement new. This requires a
special version of refcounting that calls DestroyInstance, defined in
the previous patch. The GetNewOrUsed methods used to explicitly call
DestroyInstance(), but with refcounting this is no longer needed.
- The Mark() etc. methods are gutted so they don't do anything and
mMarked is removed because it is no longer used. The methods will be
cleaned up in later patches in this bug.
- Interfaces are removed from mIID2NativeInterfaceMap in the dtor
instead of during sweeping, requiring an extra hash table lookup.
- All of the methods that can create a new interface (NewInstance,
GetISupports, GetNewOrUsed) now return an already_AddRefed<>, which
gives some static checking that we don't accidentally fail to hold
onto a newly created interface.
MozReview-Commit-ID: CrlH1ENAzvr
This patch introduces a small change in behavior: we now unconditionally
require libffi > 3.0.9 when using system ffi, rather than accepting 3.0.9
when using GCC, as 3.0.10 was released 5 years ago, and should be widely
available.
MozReview-Commit-ID: DtSDPoZSPcx