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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueue.cpp

Issue 2574773002: Migrate WTF::Vector::append() to ::push_back() [part 4 of N] (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
OLDNEW
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/CustomElementReactionQueue.h" 5 #include "core/dom/custom/CustomElementReactionQueue.h"
6 6
7 #include "core/dom/Element.h" 7 #include "core/dom/Element.h"
8 #include "core/dom/custom/CustomElementReaction.h" 8 #include "core/dom/custom/CustomElementReaction.h"
9 #include "platform/tracing/TraceEvent.h" 9 #include "platform/tracing/TraceEvent.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 CustomElementReactionQueue::CustomElementReactionQueue() : m_index(0u) {} 13 CustomElementReactionQueue::CustomElementReactionQueue() : m_index(0u) {}
14 14
15 CustomElementReactionQueue::~CustomElementReactionQueue() {} 15 CustomElementReactionQueue::~CustomElementReactionQueue() {}
16 16
17 DEFINE_TRACE(CustomElementReactionQueue) { 17 DEFINE_TRACE(CustomElementReactionQueue) {
18 visitor->trace(m_reactions); 18 visitor->trace(m_reactions);
19 } 19 }
20 20
21 void CustomElementReactionQueue::add(CustomElementReaction* reaction) { 21 void CustomElementReactionQueue::add(CustomElementReaction* reaction) {
22 m_reactions.append(reaction); 22 m_reactions.push_back(reaction);
23 } 23 }
24 24
25 // There is one queue per element, so this could be invoked 25 // There is one queue per element, so this could be invoked
26 // recursively. 26 // recursively.
27 void CustomElementReactionQueue::invokeReactions(Element* element) { 27 void CustomElementReactionQueue::invokeReactions(Element* element) {
28 TRACE_EVENT1("blink", "CustomElementReactionQueue::invokeReactions", "name", 28 TRACE_EVENT1("blink", "CustomElementReactionQueue::invokeReactions", "name",
29 element->localName().utf8()); 29 element->localName().utf8());
30 while (m_index < m_reactions.size()) { 30 while (m_index < m_reactions.size()) {
31 CustomElementReaction* reaction = m_reactions[m_index]; 31 CustomElementReaction* reaction = m_reactions[m_index];
32 m_reactions[m_index++] = nullptr; 32 m_reactions[m_index++] = nullptr;
33 reaction->invoke(element); 33 reaction->invoke(element);
34 } 34 }
35 // Unlike V0CustomElementsCallbackQueue, reactions are always 35 // Unlike V0CustomElementsCallbackQueue, reactions are always
36 // inserted by steps which bump the global element queue. This 36 // inserted by steps which bump the global element queue. This
37 // means we do not need queue "owner" guards. 37 // means we do not need queue "owner" guards.
38 // https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reacti ons 38 // https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reacti ons
39 clear(); 39 clear();
40 } 40 }
41 41
42 void CustomElementReactionQueue::clear() { 42 void CustomElementReactionQueue::clear() {
43 m_index = 0; 43 m_index = 0;
44 m_reactions.resize(0); 44 m_reactions.resize(0);
45 } 45 }
46 46
47 } // namespace blink 47 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698