summaryrefslogtreecommitdiffstats
path: root/dom/base/CustomElementRegistry.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-04 10:34:36 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:15 -0500
commitd8109fa9a0aae6ee09eca1d6b5cfab285af318f9 (patch)
tree0fa205b178976873c535ca2763dba3c9ba932bf3 /dom/base/CustomElementRegistry.cpp
parente0557470385b6f7c1ab8e277b2b72a5146856fe6 (diff)
downloadUXP-d8109fa9a0aae6ee09eca1d6b5cfab285af318f9.tar
UXP-d8109fa9a0aae6ee09eca1d6b5cfab285af318f9.tar.gz
UXP-d8109fa9a0aae6ee09eca1d6b5cfab285af318f9.tar.lz
UXP-d8109fa9a0aae6ee09eca1d6b5cfab285af318f9.tar.xz
UXP-d8109fa9a0aae6ee09eca1d6b5cfab285af318f9.zip
Bug 1309147 - Part 5: Eliminate performance cliff when accessing CEReactions code.
Tag UXP Issue #1344
Diffstat (limited to 'dom/base/CustomElementRegistry.cpp')
-rw-r--r--dom/base/CustomElementRegistry.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp
index b50a1345e..c3d25465e 100644
--- a/dom/base/CustomElementRegistry.cpp
+++ b/dom/base/CustomElementRegistry.cpp
@@ -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