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

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

Issue 2696183002: Migrate WTF::HashSet::remove() to ::erase() [part 1] (Closed)
Patch Set: one more platform-specific reference 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 void MutationObserver::observationStarted( 157 void MutationObserver::observationStarted(
158 MutationObserverRegistration* registration) { 158 MutationObserverRegistration* registration) {
159 DCHECK(!m_registrations.contains(registration)); 159 DCHECK(!m_registrations.contains(registration));
160 m_registrations.insert(registration); 160 m_registrations.insert(registration);
161 } 161 }
162 162
163 void MutationObserver::observationEnded( 163 void MutationObserver::observationEnded(
164 MutationObserverRegistration* registration) { 164 MutationObserverRegistration* registration) {
165 DCHECK(m_registrations.contains(registration)); 165 DCHECK(m_registrations.contains(registration));
166 m_registrations.remove(registration); 166 m_registrations.erase(registration);
167 } 167 }
168 168
169 static MutationObserverSet& activeMutationObservers() { 169 static MutationObserverSet& activeMutationObservers() {
170 DEFINE_STATIC_LOCAL(MutationObserverSet, activeObservers, 170 DEFINE_STATIC_LOCAL(MutationObserverSet, activeObservers,
171 (new MutationObserverSet)); 171 (new MutationObserverSet));
172 return activeObservers; 172 return activeObservers;
173 } 173 }
174 174
175 using SlotChangeList = HeapVector<Member<HTMLSlotElement>>; 175 using SlotChangeList = HeapVector<Member<HTMLSlotElement>>;
176 176
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 void MutationObserver::resumeSuspendedObservers() { 274 void MutationObserver::resumeSuspendedObservers() {
275 DCHECK(isMainThread()); 275 DCHECK(isMainThread());
276 if (suspendedMutationObservers().isEmpty()) 276 if (suspendedMutationObservers().isEmpty())
277 return; 277 return;
278 278
279 MutationObserverVector suspended; 279 MutationObserverVector suspended;
280 copyToVector(suspendedMutationObservers(), suspended); 280 copyToVector(suspendedMutationObservers(), suspended);
281 for (const auto& observer : suspended) { 281 for (const auto& observer : suspended) {
282 if (!observer->shouldBeSuspended()) { 282 if (!observer->shouldBeSuspended()) {
283 suspendedMutationObservers().remove(observer); 283 suspendedMutationObservers().erase(observer);
284 activateObserver(observer); 284 activateObserver(observer);
285 } 285 }
286 } 286 }
287 } 287 }
288 288
289 void MutationObserver::deliverMutations() { 289 void MutationObserver::deliverMutations() {
290 // These steps are defined in DOM Standard's "notify mutation observers". 290 // These steps are defined in DOM Standard's "notify mutation observers".
291 // https://dom.spec.whatwg.org/#notify-mutation-observers 291 // https://dom.spec.whatwg.org/#notify-mutation-observers
292 DCHECK(isMainThread()); 292 DCHECK(isMainThread());
293 293
(...skipping 18 matching lines...) Expand all
312 } 312 }
313 313
314 DEFINE_TRACE(MutationObserver) { 314 DEFINE_TRACE(MutationObserver) {
315 visitor->trace(m_callback); 315 visitor->trace(m_callback);
316 visitor->trace(m_records); 316 visitor->trace(m_records);
317 visitor->trace(m_registrations); 317 visitor->trace(m_registrations);
318 visitor->trace(m_callback); 318 visitor->trace(m_callback);
319 } 319 }
320 320
321 } // namespace blink 321 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/IdTargetObserverRegistry.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