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

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

Issue 674553002: Move parts of core/dom to C++11 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make Windows shut up when I just try following the style guide Created 6 years, 2 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/ContainerNode.cpp ('k') | Source/core/dom/DatasetDOMStringMap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContextLifecycleNotifier.cpp
diff --git a/Source/core/dom/ContextLifecycleNotifier.cpp b/Source/core/dom/ContextLifecycleNotifier.cpp
index 5a86d45ada67e7748488b69b6eea37c70fb234c2..9ef0d5824ab4690f3b5459d48faa03dac4fd8b8f 100644
--- a/Source/core/dom/ContextLifecycleNotifier.cpp
+++ b/Source/core/dom/ContextLifecycleNotifier.cpp
@@ -68,17 +68,17 @@ void ContextLifecycleNotifier::notifyResumingActiveDOMObjects()
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects);
Vector<ActiveDOMObject*> snapshotOfActiveDOMObjects;
copyToVector(m_activeDOMObjects, snapshotOfActiveDOMObjects);
- for (Vector<ActiveDOMObject*>::iterator iter = snapshotOfActiveDOMObjects.begin(); iter != snapshotOfActiveDOMObjects.end(); iter++) {
+ for (ActiveDOMObject* obj : snapshotOfActiveDOMObjects) {
// FIXME: Oilpan: At the moment, it's possible that the ActiveDOMObject is destructed
// during the iteration. Once we move ActiveDOMObject to the heap and
// make m_activeDOMObjects a HeapHashSet<WeakMember<ActiveDOMObject>>,
// it's no longer possible that ActiveDOMObject is destructed during the iteration,
// so we can remove the hack (i.e., we can just iterate m_activeDOMObjects without
// taking a snapshot). For more details, see https://codereview.chromium.org/247253002/.
- if (m_activeDOMObjects.contains(*iter)) {
- ASSERT((*iter)->executionContext() == context());
- ASSERT((*iter)->suspendIfNeededCalled());
- (*iter)->resume();
+ if (m_activeDOMObjects.contains(obj)) {
+ ASSERT(obj->executionContext() == context());
+ ASSERT(obj->suspendIfNeededCalled());
+ obj->resume();
}
}
}
@@ -88,13 +88,13 @@ void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects()
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects);
Vector<ActiveDOMObject*> snapshotOfActiveDOMObjects;
copyToVector(m_activeDOMObjects, snapshotOfActiveDOMObjects);
- for (Vector<ActiveDOMObject*>::iterator iter = snapshotOfActiveDOMObjects.begin(); iter != snapshotOfActiveDOMObjects.end(); iter++) {
+ for (ActiveDOMObject* obj : snapshotOfActiveDOMObjects) {
// It's possible that the ActiveDOMObject is already destructed.
// See a FIXME above.
- if (m_activeDOMObjects.contains(*iter)) {
- ASSERT((*iter)->executionContext() == context());
- ASSERT((*iter)->suspendIfNeededCalled());
- (*iter)->suspend();
+ if (m_activeDOMObjects.contains(obj)) {
+ ASSERT(obj->executionContext() == context());
+ ASSERT(obj->suspendIfNeededCalled());
+ obj->suspend();
}
}
}
@@ -104,21 +104,21 @@ void ContextLifecycleNotifier::notifyStoppingActiveDOMObjects()
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects);
Vector<ActiveDOMObject*> snapshotOfActiveDOMObjects;
copyToVector(m_activeDOMObjects, snapshotOfActiveDOMObjects);
- for (Vector<ActiveDOMObject*>::iterator iter = snapshotOfActiveDOMObjects.begin(); iter != snapshotOfActiveDOMObjects.end(); iter++) {
+ for (ActiveDOMObject* obj : snapshotOfActiveDOMObjects) {
// It's possible that the ActiveDOMObject is already destructed.
// See a FIXME above.
- if (m_activeDOMObjects.contains(*iter)) {
- ASSERT((*iter)->executionContext() == context());
- ASSERT((*iter)->suspendIfNeededCalled());
- (*iter)->stop();
+ if (m_activeDOMObjects.contains(obj)) {
+ ASSERT(obj->executionContext() == context());
+ ASSERT(obj->suspendIfNeededCalled());
+ obj->stop();
}
}
}
bool ContextLifecycleNotifier::hasPendingActivity() const
{
- for (ActiveDOMObjectSet::const_iterator iter = m_activeDOMObjects.begin(); iter != m_activeDOMObjects.end(); ++iter) {
- if ((*iter)->hasPendingActivity())
+ for (ActiveDOMObject* obj : m_activeDOMObjects) {
+ if (obj->hasPendingActivity())
return true;
}
return false;
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/DatasetDOMStringMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698