| 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 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 void CustomElementReactionStack::push() { | 37 void CustomElementReactionStack::push() { |
| 38 m_stack.append(nullptr); | 38 m_stack.append(nullptr); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void CustomElementReactionStack::popInvokingReactions() { | 41 void CustomElementReactionStack::popInvokingReactions() { |
| 42 ElementQueue* queue = m_stack.last(); | 42 ElementQueue* queue = m_stack.last(); |
| 43 if (queue) | 43 if (queue) |
| 44 invokeReactions(*queue); | 44 invokeReactions(*queue); |
| 45 m_stack.removeLast(); | 45 m_stack.pop_back(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void CustomElementReactionStack::invokeReactions(ElementQueue& queue) { | 48 void CustomElementReactionStack::invokeReactions(ElementQueue& queue) { |
| 49 for (size_t i = 0; i < queue.size(); ++i) { | 49 for (size_t i = 0; i < queue.size(); ++i) { |
| 50 Element* element = queue[i]; | 50 Element* element = queue[i]; |
| 51 if (CustomElementReactionQueue* reactions = m_map.get(element)) { | 51 if (CustomElementReactionQueue* reactions = m_map.get(element)) { |
| 52 reactions->invokeReactions(element); | 52 reactions->invokeReactions(element); |
| 53 CHECK(reactions->isEmpty()); | 53 CHECK(reactions->isEmpty()); |
| 54 m_map.remove(element); | 54 m_map.remove(element); |
| 55 } | 55 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 CustomElementReactionStack* | 115 CustomElementReactionStack* |
| 116 CustomElementReactionStackTestSupport::setCurrentForTest( | 116 CustomElementReactionStackTestSupport::setCurrentForTest( |
| 117 CustomElementReactionStack* newStack) { | 117 CustomElementReactionStack* newStack) { |
| 118 Persistent<CustomElementReactionStack>& stack = customElementReactionStack(); | 118 Persistent<CustomElementReactionStack>& stack = customElementReactionStack(); |
| 119 CustomElementReactionStack* oldStack = stack.get(); | 119 CustomElementReactionStack* oldStack = stack.get(); |
| 120 stack = newStack; | 120 stack = newStack; |
| 121 return oldStack; | 121 return oldStack; |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |