Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp

Issue 2456773002: Clear the custom element's reaction queue if upgrade fails. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp
index e7c473c234e6894c600c2053d00d979fc729e5ee..60515bd1d48bdc217d27858be7d0071646018184 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp
@@ -14,8 +14,9 @@ namespace blink {
namespace {
-CustomElementReactionStack& customElementReactionStack() {
- DEFINE_STATIC_LOCAL(CustomElementReactionStack, customElementReactionStack,
+Persistent<CustomElementReactionStack>& customElementReactionStack() {
+ DEFINE_STATIC_LOCAL(Persistent<CustomElementReactionStack>,
+ customElementReactionStack,
(new CustomElementReactionStack));
return customElementReactionStack;
}
@@ -96,6 +97,11 @@ void CustomElementReactionStack::enqueueToBackupQueue(
enqueue(m_backupQueue, element, reaction);
}
+void CustomElementReactionStack::clearQueue(Element* element) {
+ if (CustomElementReactionQueue* reactions = m_map.get(element))
+ reactions->clear();
+}
+
void CustomElementReactionStack::invokeBackupQueue() {
DCHECK(isMainThread());
invokeReactions(*m_backupQueue);
@@ -103,7 +109,16 @@ void CustomElementReactionStack::invokeBackupQueue() {
}
CustomElementReactionStack& CustomElementReactionStack::current() {
- return customElementReactionStack();
+ return *customElementReactionStack();
+}
+
+CustomElementReactionStack*
+CustomElementReactionStackTestSupport::setCurrentForTest(
+ CustomElementReactionStack* newStack) {
+ Persistent<CustomElementReactionStack>& stack = customElementReactionStack();
+ CustomElementReactionStack* oldStack = stack.get();
+ stack = newStack;
+ return oldStack;
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698