mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 716067 - UnmarkGray more often (r=bent)
This commit is contained in:
parent
76d7532951
commit
03499f06a0
@ -582,11 +582,19 @@ inline void XPCNativeSet::ASSERT_NotMarked()
|
|||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
inline
|
inline
|
||||||
JSObject* XPCWrappedNativeTearOff::GetJSObject() const
|
JSObject* XPCWrappedNativeTearOff::GetJSObjectPreserveColor() const
|
||||||
{
|
{
|
||||||
return mJSObject;
|
return mJSObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
JSObject* XPCWrappedNativeTearOff::GetJSObject()
|
||||||
|
{
|
||||||
|
JSObject *obj = GetJSObjectPreserveColor();
|
||||||
|
xpc_UnmarkGrayObject(obj);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
void XPCWrappedNativeTearOff::SetJSObject(JSObject* JSObj)
|
void XPCWrappedNativeTearOff::SetJSObject(JSObject* JSObj)
|
||||||
{
|
{
|
||||||
@ -596,7 +604,7 @@ void XPCWrappedNativeTearOff::SetJSObject(JSObject* JSObj)
|
|||||||
inline
|
inline
|
||||||
XPCWrappedNativeTearOff::~XPCWrappedNativeTearOff()
|
XPCWrappedNativeTearOff::~XPCWrappedNativeTearOff()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!(GetInterface()||GetNative()||GetJSObject()), "tearoff not empty in dtor");
|
NS_ASSERTION(!(GetInterface()||GetNative()||GetJSObjectPreserveColor()), "tearoff not empty in dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
@ -621,7 +629,7 @@ XPCWrappedNative::SweepTearOffs()
|
|||||||
|
|
||||||
// If this tearoff does not have a live dedicated JSObject,
|
// If this tearoff does not have a live dedicated JSObject,
|
||||||
// then let's recycle it.
|
// then let's recycle it.
|
||||||
if (!to->GetJSObject()) {
|
if (!to->GetJSObjectPreserveColor()) {
|
||||||
nsISupports* obj = to->GetNative();
|
nsISupports* obj = to->GetNative();
|
||||||
if (obj) {
|
if (obj) {
|
||||||
obj->Release();
|
obj->Release();
|
||||||
|
@ -171,7 +171,7 @@ XPCWrappedNative::NoteTearoffs(nsCycleCollectionTraversalCallback& cb)
|
|||||||
for (chunk = &mFirstChunk; chunk; chunk = chunk->mNextChunk) {
|
for (chunk = &mFirstChunk; chunk; chunk = chunk->mNextChunk) {
|
||||||
XPCWrappedNativeTearOff* to = chunk->mTearOffs;
|
XPCWrappedNativeTearOff* to = chunk->mTearOffs;
|
||||||
for (int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK-1; i >= 0; i--, to++) {
|
for (int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK-1; i >= 0; i--, to++) {
|
||||||
JSObject* jso = to->GetJSObject();
|
JSObject* jso = to->GetJSObjectPreserveColor();
|
||||||
if (!jso) {
|
if (!jso) {
|
||||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "tearoff's mNative");
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "tearoff's mNative");
|
||||||
cb.NoteXPCOMChild(to->GetNative());
|
cb.NoteXPCOMChild(to->GetNative());
|
||||||
@ -1259,7 +1259,7 @@ XPCWrappedNative::FlatJSObjectFinalized()
|
|||||||
for (chunk = &mFirstChunk; chunk; chunk = chunk->mNextChunk) {
|
for (chunk = &mFirstChunk; chunk; chunk = chunk->mNextChunk) {
|
||||||
XPCWrappedNativeTearOff* to = chunk->mTearOffs;
|
XPCWrappedNativeTearOff* to = chunk->mTearOffs;
|
||||||
for (int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK-1; i >= 0; i--, to++) {
|
for (int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK-1; i >= 0; i--, to++) {
|
||||||
JSObject* jso = to->GetJSObject();
|
JSObject* jso = to->GetJSObjectPreserveColor();
|
||||||
if (jso) {
|
if (jso) {
|
||||||
NS_ASSERTION(JS_IsAboutToBeFinalized(jso), "bad!");
|
NS_ASSERTION(JS_IsAboutToBeFinalized(jso), "bad!");
|
||||||
JS_SetPrivate(jso, nsnull);
|
JS_SetPrivate(jso, nsnull);
|
||||||
@ -1363,8 +1363,8 @@ XPCWrappedNative::SystemIsBeingShutDown()
|
|||||||
for (chunk = &mFirstChunk; chunk; chunk = chunk->mNextChunk) {
|
for (chunk = &mFirstChunk; chunk; chunk = chunk->mNextChunk) {
|
||||||
XPCWrappedNativeTearOff* to = chunk->mTearOffs;
|
XPCWrappedNativeTearOff* to = chunk->mTearOffs;
|
||||||
for (int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK-1; i >= 0; i--, to++) {
|
for (int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK-1; i >= 0; i--, to++) {
|
||||||
if (to->GetJSObject()) {
|
if (JSObject *jso = to->GetJSObjectPreserveColor()) {
|
||||||
JS_SetPrivate(to->GetJSObject(), nsnull);
|
JS_SetPrivate(jso, nsnull);
|
||||||
to->SetJSObject(nsnull);
|
to->SetJSObject(nsnull);
|
||||||
}
|
}
|
||||||
// We leak the tearoff mNative
|
// We leak the tearoff mNative
|
||||||
@ -1777,7 +1777,7 @@ XPCWrappedNative::FindTearOff(XPCCallContext& ccx,
|
|||||||
to < end;
|
to < end;
|
||||||
to++) {
|
to++) {
|
||||||
if (to->GetInterface() == aInterface) {
|
if (to->GetInterface() == aInterface) {
|
||||||
if (needJSObject && !to->GetJSObject()) {
|
if (needJSObject && !to->GetJSObjectPreserveColor()) {
|
||||||
AutoMarkingWrappedNativeTearOffPtr tearoff(ccx, to);
|
AutoMarkingWrappedNativeTearOffPtr tearoff(ccx, to);
|
||||||
JSBool ok = InitTearOffJSObject(ccx, to);
|
JSBool ok = InitTearOffJSObject(ccx, to);
|
||||||
// During shutdown, we don't sweep tearoffs. So make sure
|
// During shutdown, we don't sweep tearoffs. So make sure
|
||||||
|
@ -327,6 +327,8 @@ XPCWrappedNativeScope::GetPrototypeNoHelper(XPCCallContext& ccx)
|
|||||||
|
|
||||||
NS_ASSERTION(mPrototypeNoHelper,
|
NS_ASSERTION(mPrototypeNoHelper,
|
||||||
"Failed to create prototype for wrappers w/o a helper");
|
"Failed to create prototype for wrappers w/o a helper");
|
||||||
|
} else {
|
||||||
|
xpc_UnmarkGrayObject(mPrototypeNoHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mPrototypeNoHelper;
|
return mPrototypeNoHelper;
|
||||||
|
@ -491,8 +491,10 @@ ListBase<LC>::getPrototype(JSContext *cx, XPCWrappedNativeScope *scope)
|
|||||||
|
|
||||||
JSObject *interfacePrototype;
|
JSObject *interfacePrototype;
|
||||||
if (cache.IsInitialized()) {
|
if (cache.IsInitialized()) {
|
||||||
if (cache.Get(sInterfaceClass.name, &interfacePrototype))
|
if (cache.Get(sInterfaceClass.name, &interfacePrototype)) {
|
||||||
|
xpc_UnmarkGrayObject(interfacePrototype);
|
||||||
return interfacePrototype;
|
return interfacePrototype;
|
||||||
|
}
|
||||||
} else if (!cache.Init()) {
|
} else if (!cache.Init()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2382,7 +2382,8 @@ public:
|
|||||||
|
|
||||||
XPCNativeInterface* GetInterface() const {return mInterface;}
|
XPCNativeInterface* GetInterface() const {return mInterface;}
|
||||||
nsISupports* GetNative() const {return mNative;}
|
nsISupports* GetNative() const {return mNative;}
|
||||||
JSObject* GetJSObject() const;
|
JSObject* GetJSObject();
|
||||||
|
JSObject* GetJSObjectPreserveColor() const;
|
||||||
void SetInterface(XPCNativeInterface* Interface) {mInterface = Interface;}
|
void SetInterface(XPCNativeInterface* Interface) {mInterface = Interface;}
|
||||||
void SetNative(nsISupports* Native) {mNative = Native;}
|
void SetNative(nsISupports* Native) {mNative = Native;}
|
||||||
void SetJSObject(JSObject* JSObj);
|
void SetJSObject(JSObject* JSObj);
|
||||||
|
@ -103,8 +103,10 @@ WrapperFactory::WaiveXray(JSContext *cx, JSObject *obj)
|
|||||||
CompartmentPrivate *priv =
|
CompartmentPrivate *priv =
|
||||||
(CompartmentPrivate *)JS_GetCompartmentPrivate(cx, js::GetObjectCompartment(obj));
|
(CompartmentPrivate *)JS_GetCompartmentPrivate(cx, js::GetObjectCompartment(obj));
|
||||||
JSObject *wobj = nsnull;
|
JSObject *wobj = nsnull;
|
||||||
if (priv && priv->waiverWrapperMap)
|
if (priv && priv->waiverWrapperMap) {
|
||||||
wobj = priv->waiverWrapperMap->Find(obj);
|
wobj = priv->waiverWrapperMap->Find(obj);
|
||||||
|
xpc_UnmarkGrayObject(wobj);
|
||||||
|
}
|
||||||
|
|
||||||
// No wrapper yet, make one.
|
// No wrapper yet, make one.
|
||||||
if (!wobj) {
|
if (!wobj) {
|
||||||
|
Loading…
Reference in New Issue
Block a user