Bug 751454 - Use automarker for XPCNativeScriptableInfo (r=bholley)

This commit is contained in:
Bill McCloskey 2012-05-08 11:11:09 -07:00
parent f4f2e1efb0
commit 1ca53de65f
2 changed files with 11 additions and 9 deletions

View File

@ -348,8 +348,9 @@ XPCWrappedNative::WrapNewGlobal(XPCCallContext &ccx, xpcObjectHelper &nativeHelp
// ...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.
XPCNativeScriptableInfo *si = XPCNativeScriptableInfo::Construct(ccx, &sciWrapper);
MOZ_ASSERT(si);
AutoMarkingNativeScriptableInfoPtr
si(ccx, XPCNativeScriptableInfo::Construct(ccx, &sciWrapper));
MOZ_ASSERT(si.get());
// Finally, we get to the JSClass.
JSClass *clasp = si->GetJSClass();

View File

@ -2203,7 +2203,13 @@ public:
void
SetScriptableShared(XPCNativeScriptableShared* shared) {mShared = shared;}
void Mark() {if (mShared) mShared->Mark();}
void Mark() {
if (mShared)
mShared->Mark();
}
void TraceJS(JSTracer *trc) {}
void AutoTrace(JSTracer *trc) {}
protected:
XPCNativeScriptableInfo(nsIXPCScriptable* scriptable = nsnull,
@ -4229,6 +4235,7 @@ typedef TypedAutoMarkingPtr<XPCWrappedNative> AutoMarkingWrappedNativePtr;
typedef TypedAutoMarkingPtr<XPCWrappedNativeTearOff> AutoMarkingWrappedNativeTearOffPtr;
typedef TypedAutoMarkingPtr<XPCWrappedNativeProto> AutoMarkingWrappedNativeProtoPtr;
typedef TypedAutoMarkingPtr<XPCMarkableJSVal> AutoMarkingJSVal;
typedef TypedAutoMarkingPtr<XPCNativeScriptableInfo> AutoMarkingNativeScriptableInfoPtr;
template<class T>
class ArrayAutoMarkingPtr : public AutoMarkingPtr
@ -4280,12 +4287,6 @@ class ArrayAutoMarkingPtr : public AutoMarkingPtr
typedef ArrayAutoMarkingPtr<XPCNativeInterface> AutoMarkingNativeInterfacePtrArrayPtr;
// Note: It looked like I would need one of these AutoMarkingPtr types for
// XPCNativeScriptableInfo in order to manage marking its
// XPCNativeScriptableShared member during construction. But AFAICT we build
// these and bind them to rooted things so immediately that this just is not
// needed.
#define AUTO_MARK_JSVAL_HELPER2(tok, line) tok##line
#define AUTO_MARK_JSVAL_HELPER(tok, line) AUTO_MARK_JSVAL_HELPER2(tok, line)