mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 736563 - mark global objects held by live windows black during GC. r=smaug
This commit is contained in:
parent
280bbd5154
commit
d1c47fdce5
@ -378,3 +378,29 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
TraceActiveWindowGlobal(const PRUint64& aId, nsGlobalWindow*& aWindow, void* aClosure)
|
||||
{
|
||||
if (aWindow->GetDocShell() && aWindow->IsOuterWindow()) {
|
||||
if (JSObject* global = aWindow->FastGetGlobalJSObject()) {
|
||||
JSTracer* trc = static_cast<JSTracer *>(aClosure);
|
||||
JS_CALL_OBJECT_TRACER(trc, global, "active window global");
|
||||
}
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
mozilla::dom::TraceBlackJS(JSTracer* aTrc)
|
||||
{
|
||||
if (!nsCCUncollectableMarker::sGeneration) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark globals of active windows black.
|
||||
nsGlobalWindow::WindowByIdTable* windowsById =
|
||||
nsGlobalWindow::GetWindowsTable();
|
||||
if (windowsById) {
|
||||
windowsById->Enumerate(TraceActiveWindowGlobal, aTrc);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,8 @@
|
||||
#include "nsIObserver.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
struct JSTracer;
|
||||
|
||||
class nsCCUncollectableMarker : public nsIObserver
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -56,10 +58,10 @@ class nsCCUncollectableMarker : public nsIObserver
|
||||
return aGeneration && aGeneration == sGeneration;
|
||||
}
|
||||
|
||||
static bool InGeneration(nsCycleCollectionTraversalCallback &cb,
|
||||
static bool InGeneration(nsCycleCollectionTraversalCallback& aCb,
|
||||
PRUint32 aGeneration)
|
||||
{
|
||||
return InGeneration(aGeneration) && !cb.WantAllTraces();
|
||||
return InGeneration(aGeneration) && !aCb.WantAllTraces();
|
||||
}
|
||||
|
||||
static PRUint32 sGeneration;
|
||||
@ -68,3 +70,9 @@ private:
|
||||
nsCCUncollectableMarker() {}
|
||||
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
void TraceBlackJS(JSTracer* aTrc);
|
||||
}
|
||||
}
|
||||
|
@ -347,6 +347,9 @@ void XPCJSRuntime::TraceBlackJS(JSTracer* trc, void* data)
|
||||
for (e = self->mObjectHolderRoots; e; e = e->GetNextRoot())
|
||||
static_cast<XPCJSObjectHolder*>(e)->TraceJS(trc);
|
||||
}
|
||||
|
||||
dom::TraceBlackJS(trc);
|
||||
|
||||
}
|
||||
|
||||
// static
|
||||
|
Loading…
Reference in New Issue
Block a user