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

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

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 m_observer->setHasTransientRegistration(); 80 m_observer->setHasTransientRegistration();
81 81
82 if (!m_transientRegistrationNodes) { 82 if (!m_transientRegistrationNodes) {
83 m_transientRegistrationNodes = new NodeHashSet; 83 m_transientRegistrationNodes = new NodeHashSet;
84 84
85 DCHECK(m_registrationNode); 85 DCHECK(m_registrationNode);
86 DCHECK(!m_registrationNodeKeepAlive); 86 DCHECK(!m_registrationNodeKeepAlive);
87 m_registrationNodeKeepAlive = 87 m_registrationNodeKeepAlive =
88 m_registrationNode.get(); // Balanced in clearTransientRegistrations. 88 m_registrationNode.get(); // Balanced in clearTransientRegistrations.
89 } 89 }
90 m_transientRegistrationNodes->add(&node); 90 m_transientRegistrationNodes->insert(&node);
91 } 91 }
92 92
93 void MutationObserverRegistration::clearTransientRegistrations() { 93 void MutationObserverRegistration::clearTransientRegistrations() {
94 if (!m_transientRegistrationNodes) { 94 if (!m_transientRegistrationNodes) {
95 DCHECK(!m_registrationNodeKeepAlive); 95 DCHECK(!m_registrationNodeKeepAlive);
96 return; 96 return;
97 } 97 }
98 98
99 for (auto& node : *m_transientRegistrationNodes) 99 for (auto& node : *m_transientRegistrationNodes)
100 node->unregisterTransientMutationObserver(this); 100 node->unregisterTransientMutationObserver(this);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 if (!attributeName->namespaceURI().isNull()) 133 if (!attributeName->namespaceURI().isNull())
134 return false; 134 return false;
135 135
136 return m_attributeFilter.contains(attributeName->localName()); 136 return m_attributeFilter.contains(attributeName->localName());
137 } 137 }
138 138
139 void MutationObserverRegistration::addRegistrationNodesToSet( 139 void MutationObserverRegistration::addRegistrationNodesToSet(
140 HeapHashSet<Member<Node>>& nodes) const { 140 HeapHashSet<Member<Node>>& nodes) const {
141 DCHECK(m_registrationNode); 141 DCHECK(m_registrationNode);
142 nodes.add(m_registrationNode.get()); 142 nodes.insert(m_registrationNode.get());
143 if (!m_transientRegistrationNodes) 143 if (!m_transientRegistrationNodes)
144 return; 144 return;
145 for (NodeHashSet::const_iterator iter = m_transientRegistrationNodes->begin(); 145 for (NodeHashSet::const_iterator iter = m_transientRegistrationNodes->begin();
146 iter != m_transientRegistrationNodes->end(); ++iter) 146 iter != m_transientRegistrationNodes->end(); ++iter)
147 nodes.add(iter->get()); 147 nodes.insert(iter->get());
148 } 148 }
149 149
150 DEFINE_TRACE(MutationObserverRegistration) { 150 DEFINE_TRACE(MutationObserverRegistration) {
151 visitor->trace(m_observer); 151 visitor->trace(m_observer);
152 visitor->trace(m_registrationNode); 152 visitor->trace(m_registrationNode);
153 visitor->trace(m_registrationNodeKeepAlive); 153 visitor->trace(m_registrationNodeKeepAlive);
154 visitor->trace(m_transientRegistrationNodes); 154 visitor->trace(m_transientRegistrationNodes);
155 } 155 }
156 156
157 DEFINE_TRACE_WRAPPERS(MutationObserverRegistration) { 157 DEFINE_TRACE_WRAPPERS(MutationObserverRegistration) {
158 visitor->traceWrappers(m_observer); 158 visitor->traceWrappers(m_observer);
159 } 159 }
160 160
161 } // namespace blink 161 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/MutationObserver.cpp ('k') | third_party/WebKit/Source/core/dom/NodeRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698