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

Unified Diff: Source/core/dom/MutationObserver.cpp

Issue 796913002: Use C++11 range-based loop for core/clipboard, core/dom and core/testing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/IdTargetObserverRegistry.cpp ('k') | Source/core/dom/MutationObserverInterestGroup.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/MutationObserver.cpp
diff --git a/Source/core/dom/MutationObserver.cpp b/Source/core/dom/MutationObserver.cpp
index 848ad09584c35928a15bc0449eb79cb95c03231c..d06103e098b6389b07cfcc377e5ed6735f8c864b 100644
--- a/Source/core/dom/MutationObserver.cpp
+++ b/Source/core/dom/MutationObserver.cpp
@@ -156,8 +156,8 @@ void MutationObserver::disconnect()
m_records.clear();
InspectorInstrumentation::didClearAllMutationRecords(m_callback->executionContext(), this);
MutationObserverRegistrationSet registrations(m_registrations);
- for (MutationObserverRegistrationSet::iterator iter = registrations.begin(); iter != registrations.end(); ++iter)
- (*iter)->unregister();
+ for (auto& registration : registrations)
+ registration->unregister();
ASSERT(m_registrations.isEmpty());
}
@@ -210,8 +210,8 @@ void MutationObserver::setHasTransientRegistration()
WillBeHeapHashSet<RawPtrWillBeMember<Node> > MutationObserver::getObservedNodes() const
{
WillBeHeapHashSet<RawPtrWillBeMember<Node> > observedNodes;
- for (MutationObserverRegistrationSet::const_iterator iter = m_registrations.begin(); iter != m_registrations.end(); ++iter)
- (*iter)->addRegistrationNodesToSet(observedNodes);
+ for (const auto& registration : m_registrations)
+ registration->addRegistrationNodesToSet(observedNodes);
return observedNodes;
}
@@ -227,9 +227,9 @@ void MutationObserver::deliver()
// Calling clearTransientRegistrations() can modify m_registrations, so it's necessary
// to make a copy of the transient registrations before operating on them.
WillBeHeapVector<RawPtrWillBeMember<MutationObserverRegistration>, 1> transientRegistrations;
- for (MutationObserverRegistrationSet::iterator iter = m_registrations.begin(); iter != m_registrations.end(); ++iter) {
- if ((*iter)->hasTransientRegistrations())
- transientRegistrations.append(*iter);
+ for (auto& registration : m_registrations) {
+ if (registration->hasTransientRegistrations())
+ transientRegistrations.append(registration);
}
for (size_t i = 0; i < transientRegistrations.size(); ++i)
transientRegistrations[i]->clearTransientRegistrations();
« no previous file with comments | « Source/core/dom/IdTargetObserverRegistry.cpp ('k') | Source/core/dom/MutationObserverInterestGroup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698