mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
Bug 1332322 part 1. Add an nsWrapperCache function to mark the wrapper as 'live' for GC purposes. r=mccr8
This commit is contained in:
parent
0cf16aa823
commit
b39cdf67a8
@ -2058,8 +2058,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(EventSource)
|
||||
tmp->mListenerManager->MarkForCC();
|
||||
}
|
||||
if (!isBlack && tmp->PreservingWrapper()) {
|
||||
// This marks the wrapper black.
|
||||
tmp->GetWrapper();
|
||||
tmp->MarkWrapperLive();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1436,8 +1436,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(WebSocket)
|
||||
tmp->mListenerManager->MarkForCC();
|
||||
}
|
||||
if (!isBlack && tmp->PreservingWrapper()) {
|
||||
// This marks the wrapper black.
|
||||
tmp->GetWrapper();
|
||||
tmp->MarkWrapperLive();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -174,6 +174,11 @@ public:
|
||||
|
||||
bool HasNothingToTrace(nsISupports* aThis);
|
||||
|
||||
/**
|
||||
* Mark our wrapper, if any, as live as far as the CC is concerned.
|
||||
*/
|
||||
void MarkWrapperLive();
|
||||
|
||||
// Only meant to be called by code that preserves a wrapper.
|
||||
void SetPreservingWrapper(bool aPreserve)
|
||||
{
|
||||
|
@ -53,4 +53,12 @@ nsWrapperCache::IsBlackAndDoesNotNeedTracing(nsISupports* aThis)
|
||||
return IsBlack() && HasNothingToTrace(aThis);
|
||||
}
|
||||
|
||||
inline void
|
||||
nsWrapperCache::MarkWrapperLive()
|
||||
{
|
||||
// Just call GetWrapper and ignore the return value. It will do the
|
||||
// gray-unmarking for us.
|
||||
GetWrapper();
|
||||
}
|
||||
|
||||
#endif /* nsWrapperCache_h___ */
|
||||
|
@ -57,8 +57,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(DOMEventTargetHelper)
|
||||
tmp->mListenerManager->MarkForCC();
|
||||
}
|
||||
if (!tmp->IsBlack() && tmp->PreservingWrapper()) {
|
||||
// This marks the wrapper black.
|
||||
tmp->GetWrapper();
|
||||
tmp->MarkWrapperLive();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -321,8 +321,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(XMLHttpRequestMainThread)
|
||||
tmp->mListenerManager->MarkForCC();
|
||||
}
|
||||
if (!isBlack && tmp->PreservingWrapper()) {
|
||||
// This marks the wrapper black.
|
||||
tmp->GetWrapper();
|
||||
tmp->MarkWrapperLive();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsDOMCSSAttributeDeclaration, mElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDOMCSSAttributeDeclaration)
|
||||
if (tmp->mElement && Element::CanSkip(tmp->mElement, true)) {
|
||||
if (tmp->PreservingWrapper()) {
|
||||
// This marks the wrapper black.
|
||||
tmp->GetWrapper();
|
||||
tmp->MarkWrapperLive();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user