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

Unified Diff: Source/core/events/GenericEventQueue.cpp

Issue 637223008: Use C++11 range-based loop in core/events (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/events/GenericEventQueue.h ('k') | Source/core/events/ScopedEventQueue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/events/GenericEventQueue.cpp
diff --git a/Source/core/events/GenericEventQueue.cpp b/Source/core/events/GenericEventQueue.cpp
index 75900f84e781685e04c0725a8c8820bbdeaa633d..d0051394d4817243bf67e91843cb708049305cca 100644
--- a/Source/core/events/GenericEventQueue.cpp
+++ b/Source/core/events/GenericEventQueue.cpp
@@ -95,16 +95,16 @@ void GenericEventQueue::timerFired(Timer<GenericEventQueue>*)
ASSERT(!m_timer.isActive());
ASSERT(!m_pendingEvents.isEmpty());
- WillBeHeapVector<RefPtrWillBeMember<Event> > pendingEvents;
+ WillBeHeapVector<RefPtrWillBeMember<Event>> pendingEvents;
m_pendingEvents.swap(pendingEvents);
RefPtrWillBeRawPtr<EventTarget> protect(m_owner.get());
- for (size_t i = 0; i < pendingEvents.size(); ++i) {
- Event* event = pendingEvents[i].get();
+ for (const auto& pendingEvent : pendingEvents) {
+ Event* event = pendingEvent.get();
EventTarget* target = event->target() ? event->target() : m_owner.get();
CString type(event->type().ascii());
TRACE_EVENT_ASYNC_STEP_INTO1("event", "GenericEventQueue:enqueueEvent", event, "dispatch", "type", type);
- target->dispatchEvent(pendingEvents[i]);
+ target->dispatchEvent(pendingEvent);
TRACE_EVENT_ASYNC_END1("event", "GenericEventQueue:enqueueEvent", event, "type", type);
InspectorInstrumentation::didRemoveEvent(target, event);
}
@@ -120,8 +120,8 @@ void GenericEventQueue::cancelAllEvents()
{
m_timer.stop();
- for (size_t i = 0; i < m_pendingEvents.size(); ++i) {
- Event* event = m_pendingEvents[i].get();
+ for (const auto& pendingEvent : m_pendingEvents) {
+ Event* event = pendingEvent.get();
TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii(), "status", "cancelled");
InspectorInstrumentation::didRemoveEvent(event->target() ? event->target() : m_owner.get(), event);
}
« no previous file with comments | « Source/core/events/GenericEventQueue.h ('k') | Source/core/events/ScopedEventQueue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698