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

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: rename variable Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/MutationObserver.cpp
diff --git a/Source/core/dom/MutationObserver.cpp b/Source/core/dom/MutationObserver.cpp
index 570ee3b9737c0eab300b48ae24b305ff189d302b..11077b44d2b37060edfd57185a59d759093c9cb9 100644
--- a/Source/core/dom/MutationObserver.cpp
+++ b/Source/core/dom/MutationObserver.cpp
@@ -148,8 +148,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)
dcheng 2014/12/16 19:52:51 Similar comment for all the remaining autos. I wou
+ registration->unregister();
ASSERT(m_registrations.isEmpty());
}
@@ -202,8 +202,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;
}
@@ -219,9 +219,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();

Powered by Google App Engine
This is Rietveld 408576698