| 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 23 matching lines...) Expand all Loading... |
| 34 visitor->trace(m_backupQueue); | 34 visitor->trace(m_backupQueue); |
| 35 } | 35 } |
| 36 | 36 |
| 37 DEFINE_TRACE_WRAPPERS(CustomElementReactionStack) { | 37 DEFINE_TRACE_WRAPPERS(CustomElementReactionStack) { |
| 38 for (auto key : m_map.keys()) { | 38 for (auto key : m_map.keys()) { |
| 39 visitor->traceWrappers(key); | 39 visitor->traceWrappers(key); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 void CustomElementReactionStack::push() { | 43 void CustomElementReactionStack::push() { |
| 44 m_stack.append(nullptr); | 44 m_stack.push_back(nullptr); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void CustomElementReactionStack::popInvokingReactions() { | 47 void CustomElementReactionStack::popInvokingReactions() { |
| 48 ElementQueue* queue = m_stack.back(); | 48 ElementQueue* queue = m_stack.back(); |
| 49 if (queue) | 49 if (queue) |
| 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) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 |
| 71 void CustomElementReactionStack::enqueue(Member<ElementQueue>& queue, | 71 void CustomElementReactionStack::enqueue(Member<ElementQueue>& queue, |
| 72 Element* element, | 72 Element* element, |
| 73 CustomElementReaction* reaction) { | 73 CustomElementReaction* reaction) { |
| 74 if (!queue) | 74 if (!queue) |
| 75 queue = new ElementQueue(); | 75 queue = new ElementQueue(); |
| 76 queue->append(element); | 76 queue->push_back(element); |
| 77 | 77 |
| 78 CustomElementReactionQueue* reactions = m_map.get(element); | 78 CustomElementReactionQueue* reactions = m_map.get(element); |
| 79 if (!reactions) { | 79 if (!reactions) { |
| 80 reactions = new CustomElementReactionQueue(); | 80 reactions = new CustomElementReactionQueue(); |
| 81 m_map.add(TraceWrapperMember<Element>(this, element), reactions); | 81 m_map.add(TraceWrapperMember<Element>(this, element), reactions); |
| 82 } | 82 } |
| 83 | 83 |
| 84 reactions->add(reaction); | 84 reactions->add(reaction); |
| 85 } | 85 } |
| 86 | 86 |
| (...skipping 34 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 |