Bug 1309147 - Part 5: Eliminate performance cliff when accessing CEReactions code.

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC 2020-01-04 10:34:36 -05:00 committed by Roy Tam
commit f7154d573b
2 changed files with 19 additions and 5 deletions

View file

@ -905,7 +905,11 @@ CustomElementReactionsStack::PopAndInvokeElementQueue()
"Reaction stack shouldn't be empty");
ElementQueue& elementQueue = mReactionsStack.LastElement();
InvokeReactions(elementQueue);
// Check element queue size in order to reduce function call overhead.
if (!elementQueue.IsEmpty()) {
InvokeReactions(elementQueue);
}
DebugOnly<bool> isRemovedElement = mReactionsStack.RemoveElement(elementQueue);
MOZ_ASSERT(isRemovedElement,
"Reaction stack should have an element queue to remove");
@ -954,7 +958,10 @@ CustomElementReactionsStack::Enqueue(Element* aElement,
void
CustomElementReactionsStack::InvokeBackupQueue()
{
InvokeReactions(mBackupQueue);
// Check backup queue size in order to reduce function call overhead.
if (!mBackupQueue.IsEmpty()) {
InvokeReactions(mBackupQueue);
}
}
void