зеркало из https://github.com/mozilla/gecko-dev.git
Bug 947336, part 1 - Make nsXPCWrappedJS::mOuter into a smart pointer. r=bholley
This commit is contained in:
Родитель
1b9c2b2ca6
Коммит
ab84e1442b
|
@ -424,8 +424,7 @@ nsXPCWrappedJS::nsXPCWrappedJS(JSContext* cx,
|
||||||
: mJSObj(aJSObj),
|
: mJSObj(aJSObj),
|
||||||
mClass(aClass),
|
mClass(aClass),
|
||||||
mRoot(root ? root : MOZ_THIS_IN_INITIALIZER_LIST()),
|
mRoot(root ? root : MOZ_THIS_IN_INITIALIZER_LIST()),
|
||||||
mNext(nullptr),
|
mNext(nullptr)
|
||||||
mOuter(nullptr)
|
|
||||||
{
|
{
|
||||||
InitStub(GetClass()->GetIID());
|
InitStub(GetClass()->GetIID());
|
||||||
|
|
||||||
|
@ -501,10 +500,9 @@ nsXPCWrappedJS::Unlink()
|
||||||
if (mOuter) {
|
if (mOuter) {
|
||||||
XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
|
XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
|
||||||
if (rt->GCIsRunning()) {
|
if (rt->GCIsRunning()) {
|
||||||
nsContentUtils::DeferredFinalize(mOuter);
|
nsContentUtils::DeferredFinalize(mOuter.forget().get());
|
||||||
mOuter = nullptr;
|
|
||||||
} else {
|
} else {
|
||||||
NS_RELEASE(mOuter);
|
mOuter = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2515,7 +2515,7 @@ public:
|
||||||
"Only one aggregated native can be set");
|
"Only one aggregated native can be set");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NS_ADDREF(mRoot->mOuter = aNative);
|
mRoot->mOuter = aNative;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceJS(JSTracer* trc);
|
void TraceJS(JSTracer* trc);
|
||||||
|
@ -2538,7 +2538,7 @@ private:
|
||||||
nsXPCWrappedJSClass* mClass;
|
nsXPCWrappedJSClass* mClass;
|
||||||
nsXPCWrappedJS* mRoot;
|
nsXPCWrappedJS* mRoot;
|
||||||
nsXPCWrappedJS* mNext;
|
nsXPCWrappedJS* mNext;
|
||||||
nsISupports* mOuter; // only set in root
|
nsCOMPtr<nsISupports> mOuter; // only set in root
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче