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

This commit is contained in:
Bill McCloskey 2012-05-08 11:11:09 -07:00
Родитель 878265a2e8
Коммит 5ff5ac98f6
2 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -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();

Просмотреть файл

@ -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)