Bug 1288817, part 3 - Stop calling XPCNativeScriptableInfo::Mark() from various places because it doesn't do anything. r=billm
MozReview-Commit-ID: IcjcFti2k7A
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -166,18 +166,18 @@ XPCWrappedNative::WrapNewGlobal(xpcObjec
XPCNativeScriptableCreateInfo sciProto;
XPCNativeScriptableCreateInfo sciMaybe;
const XPCNativeScriptableCreateInfo& sciWrapper =
GatherScriptableCreateInfo(identity, nativeHelper.GetClassInfo(),
sciProto, sciMaybe);
// ...and then ScriptableInfo. We need all this stuff now because it's going
// to tell us the JSClass of the object we're going to create.
- AutoMarkingNativeScriptableInfoPtr si(cx, XPCNativeScriptableInfo::Construct(&sciWrapper));
- MOZ_ASSERT(si.get());
+ XPCNativeScriptableInfo* si = XPCNativeScriptableInfo::Construct(&sciWrapper);
+ MOZ_ASSERT(si);
// Finally, we get to the JSClass.
const JSClass* clasp = si->GetJSClass();
MOZ_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL);
// Create the global.
aOptions.creationOptions().setTrace(XPCWrappedNative::Trace);
if (xpc::SharedMemoryEnabled())
@@ -617,22 +617,16 @@ XPCWrappedNative::Destroy()
mMaybeScope = nullptr;
}
void
XPCWrappedNative::UpdateScriptableInfo(XPCNativeScriptableInfo* si)
{
MOZ_ASSERT(mScriptableInfo, "UpdateScriptableInfo expects an existing scriptable info");
-
- // Write barrier for incremental GC.
- JSContext* cx = GetRuntime()->Context();
- if (IsIncrementalBarrierNeeded(cx))
- mScriptableInfo->Mark();
-
mScriptableInfo = si;
}
void
XPCWrappedNative::SetProto(XPCWrappedNativeProto* p)
{
MOZ_ASSERT(!IsWrapperExpired(), "bad ptr!");
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -1537,20 +1537,16 @@ public:
GetFlags() const { return mShared->GetFlags(); }
const JSClass*
GetJSClass() { return mShared->GetJSClass(); }
void
SetScriptableShared(already_AddRefed<XPCNativeScriptableShared>&& shared) { mShared = shared; }
- void Mark() {}
- void TraceJS(JSTracer* trc) {}
- void AutoTrace(JSTracer* trc) {}
-
protected:
explicit XPCNativeScriptableInfo(nsIXPCScriptable* scriptable)
: mCallback(scriptable)
{
MOZ_COUNT_CTOR(XPCNativeScriptableInfo);
}
public:
~XPCNativeScriptableInfo()
@@ -1651,18 +1647,16 @@ public:
void TraceSelf(JSTracer* trc) {
if (mJSProtoObject)
mJSProtoObject.trace(trc, "XPCWrappedNativeProto::mJSProtoObject");
}
void TraceInside(JSTracer* trc) {
if (trc->isMarkingTracer()) {
mSet->Mark();
- if (mScriptableInfo)
- mScriptableInfo->Mark();
}
GetScope()->TraceSelf(trc);
}
void TraceJS(JSTracer* trc) {
TraceSelf(trc);
TraceInside(trc);
@@ -1672,20 +1666,17 @@ public:
{
if (JS::IsIncrementalBarrierNeeded(cx) && mJSProtoObject)
mJSProtoObject.writeBarrierPre(cx);
}
// NOP. This is just here to make the AutoMarkingPtr code compile.
inline void AutoTrace(JSTracer* trc) {}
- // Yes, we *do* need to mark the mScriptableInfo in both cases.
- void Mark() const
- {mSet->Mark();
- if (mScriptableInfo) mScriptableInfo->Mark();}
+ void Mark() const {mSet->Mark();}
#ifdef DEBUG
void ASSERT_SetNotMarked() const {mSet->ASSERT_NotMarked();}
#endif
~XPCWrappedNativeProto();
protected:
@@ -1935,26 +1926,22 @@ public:
XPCWrappedNativeTearOff* FindTearOff(XPCNativeInterface* aInterface,
bool needJSObject = false,
nsresult* pError = nullptr);
XPCWrappedNativeTearOff* FindTearOff(const nsIID& iid);
void Mark() const
{
mSet->Mark();
- if (mScriptableInfo) mScriptableInfo->Mark();
if (HasProto()) GetProto()->Mark();
}
- // Yes, we *do* need to mark the mScriptableInfo in both cases.
inline void TraceInside(JSTracer* trc) {
if (trc->isMarkingTracer()) {
mSet->Mark();
- if (mScriptableInfo)
- mScriptableInfo->Mark();
}
if (HasProto())
GetProto()->TraceSelf(trc);
else
GetScope()->TraceSelf(trc);
if (mFlatJSObject && JS_IsGlobalObject(mFlatJSObject))
{
xpc::TraceXPCGlobal(trc, mFlatJSObject);
@@ -2891,17 +2878,16 @@ class TypedAutoMarkingPtr : public AutoM
T* mPtr;
};
typedef TypedAutoMarkingPtr<XPCNativeInterface> AutoMarkingNativeInterfacePtr;
typedef TypedAutoMarkingPtr<XPCNativeSet> AutoMarkingNativeSetPtr;
typedef TypedAutoMarkingPtr<XPCWrappedNative> AutoMarkingWrappedNativePtr;
typedef TypedAutoMarkingPtr<XPCWrappedNativeTearOff> AutoMarkingWrappedNativeTearOffPtr;
typedef TypedAutoMarkingPtr<XPCWrappedNativeProto> AutoMarkingWrappedNativeProtoPtr;
-typedef TypedAutoMarkingPtr<XPCNativeScriptableInfo> AutoMarkingNativeScriptableInfoPtr;
template<class T>
class ArrayAutoMarkingPtr : public AutoMarkingPtr
{
public:
ArrayAutoMarkingPtr(JSContext* cx, nsTArray<T*>& ptr)
: AutoMarkingPtr(cx), mPtr(ptr)
{}