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

Unified Diff: third_party/WebKit/Source/core/events/EventTarget.cpp

Issue 2554953005: Avoid WTF::Vector::at() and operator[] in core/events. (Closed)
Patch Set: _ Created 4 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: third_party/WebKit/Source/core/events/EventTarget.cpp
diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp
index 4b272b815d8d1ef8c4b6e19c9ce8d380cd0f98e8..a125d77160ca4b119ff44e2d16172b7f283eb566 100644
--- a/third_party/WebKit/Source/core/events/EventTarget.cpp
+++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -367,8 +367,7 @@ bool EventTarget::removeEventListenerInternal(
// Notify firing events planning to invoke the listener at 'index' that
// they have one less listener to invoke.
if (d->firingEventIterators) {
- for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
- FiringEventIterator& firingIterator = d->firingEventIterators->at(i);
+ for (const auto& firingIterator : *d->firingEventIterators) {
if (eventType != firingIterator.eventType)
continue;
@@ -750,9 +749,9 @@ void EventTarget::removeAllEventListeners() {
// Notify firing events planning to invoke the listener at 'index' that
// they have one less listener to invoke.
if (d->firingEventIterators) {
- for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
- d->firingEventIterators->at(i).iterator = 0;
- d->firingEventIterators->at(i).end = 0;
+ for (const auto& iterator : *d->firingEventIterators) {
+ iterator.iterator = 0;
+ iterator.end = 0;
}
}
}
« no previous file with comments | « third_party/WebKit/Source/core/events/EventSender.h ('k') | third_party/WebKit/Source/core/events/ScopedEventQueue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698