mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 801719 - Unmark certainly alive event listener and message managers, r=mccr8
--HG-- extra : rebase_source : 0637559f37143a21583afe3c06d1464de8fc665b
This commit is contained in:
parent
696273ce6e
commit
4ec16f4336
@ -1237,7 +1237,7 @@ FragmentOrElement::MarkNodeChildren(nsINode* aNode)
|
||||
|
||||
nsEventListenerManager* elm = aNode->GetListenerManager(false);
|
||||
if (elm) {
|
||||
elm->UnmarkGrayJSListeners();
|
||||
elm->MarkForCC();
|
||||
}
|
||||
|
||||
if (aNode->HasProperties()) {
|
||||
|
@ -585,7 +585,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(WebSocket)
|
||||
bool isBlack = tmp->IsBlack();
|
||||
if (isBlack|| tmp->mKeepingAlive) {
|
||||
if (tmp->mListenerManager) {
|
||||
tmp->mListenerManager->UnmarkGrayJSListeners();
|
||||
tmp->mListenerManager->MarkForCC();
|
||||
}
|
||||
if (!isBlack && tmp->PreservingWrapper()) {
|
||||
xpc_UnmarkGrayObject(tmp->GetWrapperPreserveColor());
|
||||
|
@ -92,11 +92,13 @@ MarkUserDataHandler(void* aNode, nsIAtom* aKey, void* aValue, void* aData)
|
||||
static void
|
||||
MarkMessageManagers()
|
||||
{
|
||||
nsCOMPtr<nsIMessageBroadcaster> globalMM =
|
||||
nsCOMPtr<nsIMessageBroadcaster> strongGlobalMM =
|
||||
do_GetService("@mozilla.org/globalmessagemanager;1");
|
||||
if (!globalMM) {
|
||||
if (!strongGlobalMM) {
|
||||
return;
|
||||
}
|
||||
nsIMessageBroadcaster* globalMM = strongGlobalMM;
|
||||
strongGlobalMM = nullptr;
|
||||
|
||||
globalMM->MarkForCC();
|
||||
uint32_t childCount = 0;
|
||||
@ -107,7 +109,10 @@ MarkMessageManagers()
|
||||
if (!childMM) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIMessageBroadcaster> windowMM = do_QueryInterface(childMM);
|
||||
nsCOMPtr<nsIMessageBroadcaster> strongWindowMM = do_QueryInterface(childMM);
|
||||
nsIMessageBroadcaster* windowMM = strongWindowMM;
|
||||
childMM = nullptr;
|
||||
strongWindowMM = nullptr;
|
||||
windowMM->MarkForCC();
|
||||
uint32_t tabChildCount = 0;
|
||||
windowMM->GetChildCount(&tabChildCount);
|
||||
@ -117,12 +122,15 @@ MarkMessageManagers()
|
||||
if (!childMM) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIMessageSender> tabMM = do_QueryInterface(childMM);
|
||||
nsCOMPtr<nsIMessageSender> strongTabMM = do_QueryInterface(childMM);
|
||||
nsIMessageSender* tabMM = strongTabMM;
|
||||
childMM = nullptr;
|
||||
strongTabMM = nullptr;
|
||||
tabMM->MarkForCC();
|
||||
//XXX hack warning, but works, since we know that
|
||||
// callback is frameloader.
|
||||
mozilla::dom::ipc::MessageManagerCallback* cb =
|
||||
static_cast<nsFrameMessageManager*>(tabMM.get())->GetCallback();
|
||||
static_cast<nsFrameMessageManager*>(tabMM)->GetCallback();
|
||||
if (cb) {
|
||||
nsFrameLoader* fl = static_cast<nsFrameLoader*>(cb);
|
||||
nsIDOMEventTarget* et = fl->GetTabChildGlobalAsEventTarget();
|
||||
@ -132,11 +140,33 @@ MarkMessageManagers()
|
||||
static_cast<nsInProcessTabChildGlobal*>(et)->MarkForCC();
|
||||
nsEventListenerManager* elm = et->GetListenerManager(false);
|
||||
if (elm) {
|
||||
elm->UnmarkGrayJSListeners();
|
||||
elm->MarkForCC();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nsFrameMessageManager::sParentProcessManager) {
|
||||
nsFrameMessageManager::sParentProcessManager->MarkForCC();
|
||||
uint32_t childCount = 0;
|
||||
nsFrameMessageManager::sParentProcessManager->GetChildCount(&childCount);
|
||||
for (uint32_t i = 0; i < childCount; ++i) {
|
||||
nsCOMPtr<nsIMessageListenerManager> childMM;
|
||||
nsFrameMessageManager::sParentProcessManager->
|
||||
GetChildAt(i, getter_AddRefs(childMM));
|
||||
if (!childMM) {
|
||||
continue;
|
||||
}
|
||||
nsIMessageListenerManager* child = childMM;
|
||||
childMM = nullptr;
|
||||
child->MarkForCC();
|
||||
}
|
||||
}
|
||||
if (nsFrameMessageManager::sSameProcessParentManager) {
|
||||
nsFrameMessageManager::sSameProcessParentManager->MarkForCC();
|
||||
}
|
||||
if (nsFrameMessageManager::sChildProcessManager) {
|
||||
nsFrameMessageManager::sChildProcessManager->MarkForCC();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -154,13 +184,13 @@ MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
|
||||
if (aCleanupJS) {
|
||||
nsEventListenerManager* elm = doc->GetListenerManager(false);
|
||||
if (elm) {
|
||||
elm->UnmarkGrayJSListeners();
|
||||
elm->MarkForCC();
|
||||
}
|
||||
nsCOMPtr<nsIDOMEventTarget> win = do_QueryInterface(doc->GetInnerWindow());
|
||||
if (win) {
|
||||
elm = win->GetListenerManager(false);
|
||||
if (elm) {
|
||||
elm->UnmarkGrayJSListeners();
|
||||
elm->MarkForCC();
|
||||
}
|
||||
static_cast<nsGlobalWindow*>(win.get())->UnmarkGrayTimers();
|
||||
}
|
||||
|
@ -3918,7 +3918,7 @@ ListenerEnumerator(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
|
||||
nsINode* n = static_cast<nsINode*>(entry->mListenerManager->GetTarget());
|
||||
if (n && n->IsInDoc() &&
|
||||
nsCCUncollectableMarker::InGeneration(n->OwnerDoc()->GetMarkedCCGeneration())) {
|
||||
entry->mListenerManager->UnmarkGrayJSListeners();
|
||||
entry->mListenerManager->MarkForCC();
|
||||
}
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
|
@ -1717,7 +1717,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDocument)
|
||||
if (nsGenericElement::CanSkip(tmp, aRemovingAllowed)) {
|
||||
nsEventListenerManager* elm = tmp->GetListenerManager(false);
|
||||
if (elm) {
|
||||
elm->UnmarkGrayJSListeners();
|
||||
elm->MarkForCC();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsEventSource)
|
||||
bool isBlack = tmp->IsBlack();
|
||||
if (isBlack || tmp->mWaitingForOnStopRequest) {
|
||||
if (tmp->mListenerManager) {
|
||||
tmp->mListenerManager->UnmarkGrayJSListeners();
|
||||
tmp->mListenerManager->MarkForCC();
|
||||
}
|
||||
if (!isBlack && tmp->PreservingWrapper()) {
|
||||
xpc_UnmarkGrayObject(tmp->GetWrapperPreserveColor());
|
||||
|
@ -1326,5 +1326,8 @@ nsFrameMessageManager::MarkForCC()
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
xpc_TryUnmarkWrappedGrayObject(mListeners[i].mListener);
|
||||
}
|
||||
if (mRefCnt.IsPurple()) {
|
||||
mRefCnt.RemovePurple();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsXMLHttpRequest)
|
||||
bool isBlack = tmp->IsBlack();
|
||||
if (isBlack || tmp->mWaitingForOnStopRequest) {
|
||||
if (tmp->mListenerManager) {
|
||||
tmp->mListenerManager->UnmarkGrayJSListeners();
|
||||
tmp->mListenerManager->MarkForCC();
|
||||
}
|
||||
if (!isBlack && tmp->PreservingWrapper()) {
|
||||
xpc_UnmarkGrayObject(tmp->GetWrapperPreserveColor());
|
||||
|
@ -47,7 +47,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDOMEventTargetHelper)
|
||||
if (tmp->IsBlack()) {
|
||||
if (tmp->mListenerManager) {
|
||||
tmp->mListenerManager->UnmarkGrayJSListeners();
|
||||
tmp->mListenerManager->MarkForCC();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ nsEventListenerManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
|
||||
}
|
||||
|
||||
void
|
||||
nsEventListenerManager::UnmarkGrayJSListeners()
|
||||
nsEventListenerManager::MarkForCC()
|
||||
{
|
||||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
@ -1192,4 +1192,7 @@ nsEventListenerManager::UnmarkGrayJSListeners()
|
||||
xpc_TryUnmarkWrappedGrayObject(ls.mListener);
|
||||
}
|
||||
}
|
||||
if (mRefCnt.IsPurple()) {
|
||||
mRefCnt.RemovePurple();
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
void UnmarkGrayJSListeners();
|
||||
void MarkForCC();
|
||||
|
||||
nsISupports* GetTarget() { return mTarget; }
|
||||
protected:
|
||||
|
@ -1269,7 +1269,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow)
|
||||
}
|
||||
nsEventListenerManager* elm = tmp->GetListenerManager(false);
|
||||
if (elm) {
|
||||
elm->UnmarkGrayJSListeners();
|
||||
elm->MarkForCC();
|
||||
}
|
||||
tmp->UnmarkGrayTimers();
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user