зеркало из https://github.com/mozilla/gecko-dev.git
Bug 868139 - Don't redo unmarking work in nsGlobalWindow::CanSkip if we already did it. r=smaug
This causes quadratic behavior in forgetSkippable when there are many timeouts. To avoid this, we mark the CC generation of the last time we ran CanSkip on the window, and don't do it again if it hasn't changed.
This commit is contained in:
Родитель
6bdc5e8dd6
Коммит
4d45062daf
|
@ -1132,7 +1132,8 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
|||
#endif
|
||||
mCleanedUp(false),
|
||||
mDialogAbuseCount(0),
|
||||
mAreDialogsEnabled(true)
|
||||
mAreDialogsEnabled(true),
|
||||
mCanSkipCCGeneration(0)
|
||||
{
|
||||
nsLayoutStatics::AddRef();
|
||||
|
||||
|
@ -1683,6 +1684,10 @@ MarkXBLHandlers(nsXBLPrototypeHandler* aKey, JS::Heap<JSObject*>& aData, void* a
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindow)
|
||||
if (tmp->IsBlackForCC(false)) {
|
||||
if (nsCCUncollectableMarker::InGeneration(tmp->mCanSkipCCGeneration)) {
|
||||
return true;
|
||||
}
|
||||
tmp->mCanSkipCCGeneration = nsCCUncollectableMarker::sGeneration;
|
||||
if (tmp->mCachedXBLPrototypeHandlers) {
|
||||
tmp->mCachedXBLPrototypeHandlers->Enumerate(MarkXBLHandlers, nullptr);
|
||||
}
|
||||
|
|
|
@ -1628,6 +1628,9 @@ protected:
|
|||
nsRefPtr<mozilla::dom::SpeechSynthesis> mSpeechSynthesis;
|
||||
#endif
|
||||
|
||||
// This is the CC generation the last time we called CanSkip.
|
||||
uint32_t mCanSkipCCGeneration;
|
||||
|
||||
friend class nsDOMScriptableHelper;
|
||||
friend class nsDOMWindowUtils;
|
||||
friend class PostMessageEvent;
|
||||
|
|
Загрузка…
Ссылка в новой задаче