зеркало из https://github.com/mozilla/pjs.git
Bug 368869, suspect all native wrappers for cycle collection. Nth attempt, slightly safer.
r=brendan, sr=jst
This commit is contained in:
Родитель
ebe2b46d68
Коммит
381a5bcaf3
|
@ -633,6 +633,13 @@ XPCWrappedNative::~XPCWrappedNative()
|
||||||
|
|
||||||
XPCWrappedNativeProto* proto = GetProto();
|
XPCWrappedNativeProto* proto = GetProto();
|
||||||
|
|
||||||
|
if (proto &&
|
||||||
|
proto->ClassIsMainThreadOnly() &&
|
||||||
|
NS_IsMainThread())
|
||||||
|
{
|
||||||
|
nsCycleCollector_forget(this);
|
||||||
|
}
|
||||||
|
|
||||||
if(mScriptableInfo &&
|
if(mScriptableInfo &&
|
||||||
(!HasProto() ||
|
(!HasProto() ||
|
||||||
(proto && proto->GetScriptableInfo() != mScriptableInfo)))
|
(proto && proto->GetScriptableInfo() != mScriptableInfo)))
|
||||||
|
|
|
@ -272,13 +272,17 @@ WrappedNativeJSGCThingTracer(JSDHashTable *table, JSDHashEntryHdr *hdr,
|
||||||
JS_CALL_OBJECT_TRACER(trc, wrapper->GetFlatJSObject(),
|
JS_CALL_OBJECT_TRACER(trc, wrapper->GetFlatJSObject(),
|
||||||
"XPCWrappedNative::mFlatJSObject");
|
"XPCWrappedNative::mFlatJSObject");
|
||||||
|
|
||||||
// FIXME: this call appears to do more harm than good, but
|
if (JS_IsGCMarkingTracer(trc))
|
||||||
// there is reason to imagine it might clean up some cycles
|
{
|
||||||
// formed by a poor order between C++ and JS garbage cycle
|
XPCWrappedNativeProto* proto = wrapper->GetProto();
|
||||||
// formations. See Bug 368869.
|
if (proto &&
|
||||||
//
|
proto->ClassIsMainThreadOnly())
|
||||||
// if (JS_IsGCMarkingTracer(trc))
|
{
|
||||||
// nsCycleCollector_suspectCurrent(wrapper);
|
NS_ASSERTION(NS_IsMainThread(),
|
||||||
|
"Tracing wrapped natives from non-main thread");
|
||||||
|
nsCycleCollector_suspectCurrent(wrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return JS_DHASH_NEXT;
|
return JS_DHASH_NEXT;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче