| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/custom/CustomElementReactionStack.h" | 5 #include "core/dom/custom/CustomElementReactionStack.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/Microtask.h" | 7 #include "bindings/core/v8/Microtask.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/dom/custom/CEReactionsScope.h" | 9 #include "core/dom/custom/CEReactionsScope.h" |
| 10 #include "core/dom/custom/CustomElementReactionQueue.h" | 10 #include "core/dom/custom/CustomElementReactionQueue.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 invokeReactions(*queue); | 50 invokeReactions(*queue); |
| 51 m_stack.pop_back(); | 51 m_stack.pop_back(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void CustomElementReactionStack::invokeReactions(ElementQueue& queue) { | 54 void CustomElementReactionStack::invokeReactions(ElementQueue& queue) { |
| 55 for (size_t i = 0; i < queue.size(); ++i) { | 55 for (size_t i = 0; i < queue.size(); ++i) { |
| 56 Element* element = queue[i]; | 56 Element* element = queue[i]; |
| 57 if (CustomElementReactionQueue* reactions = m_map.get(element)) { | 57 if (CustomElementReactionQueue* reactions = m_map.get(element)) { |
| 58 reactions->invokeReactions(element); | 58 reactions->invokeReactions(element); |
| 59 CHECK(reactions->isEmpty()); | 59 CHECK(reactions->isEmpty()); |
| 60 m_map.remove(element); | 60 m_map.erase(element); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 void CustomElementReactionStack::enqueueToCurrentQueue( | 65 void CustomElementReactionStack::enqueueToCurrentQueue( |
| 66 Element* element, | 66 Element* element, |
| 67 CustomElementReaction* reaction) { | 67 CustomElementReaction* reaction) { |
| 68 enqueue(m_stack.back(), element, reaction); | 68 enqueue(m_stack.back(), element, reaction); |
| 69 } | 69 } |
| 70 | 70 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 CustomElementReactionStack* | 121 CustomElementReactionStack* |
| 122 CustomElementReactionStackTestSupport::setCurrentForTest( | 122 CustomElementReactionStackTestSupport::setCurrentForTest( |
| 123 CustomElementReactionStack* newStack) { | 123 CustomElementReactionStack* newStack) { |
| 124 Persistent<CustomElementReactionStack>& stack = customElementReactionStack(); | 124 Persistent<CustomElementReactionStack>& stack = customElementReactionStack(); |
| 125 CustomElementReactionStack* oldStack = stack.get(); | 125 CustomElementReactionStack* oldStack = stack.get(); |
| 126 stack = newStack; | 126 stack = newStack; |
| 127 return oldStack; | 127 return oldStack; |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |