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

Unified Diff: third_party/WebKit/Source/core/events/EventSender.h

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/EventSender.h
diff --git a/third_party/WebKit/Source/core/events/EventSender.h b/third_party/WebKit/Source/core/events/EventSender.h
index 2da45cbc994df0bf858c20154548dd02496f4697..b6a2319d40d3953189603087d64ef1f6a4ea5780 100644
--- a/third_party/WebKit/Source/core/events/EventSender.h
+++ b/third_party/WebKit/Source/core/events/EventSender.h
@@ -85,15 +85,13 @@ template <typename T>
void EventSender<T>::cancelEvent(T* sender) {
// Remove instances of this sender from both lists.
// Use loops because we allow multiple instances to get into the lists.
- size_t size = m_dispatchSoonList.size();
- for (size_t i = 0; i < size; ++i) {
- if (m_dispatchSoonList[i] == sender)
- m_dispatchSoonList[i] = nullptr;
+ for (auto& senderInList : m_dispatchSoonList) {
+ if (senderInList == sender)
+ senderInList = nullptr;
}
- size = m_dispatchingList.size();
- for (size_t i = 0; i < size; ++i) {
- if (m_dispatchingList[i] == sender)
- m_dispatchingList[i] = nullptr;
+ for (auto& senderInList : m_dispatchingList) {
+ if (senderInList == sender)
+ senderInList = nullptr;
}
}
@@ -108,10 +106,9 @@ void EventSender<T>::dispatchPendingEvents() {
m_timer.stop();
m_dispatchingList.swap(m_dispatchSoonList);
- size_t size = m_dispatchingList.size();
- for (size_t i = 0; i < size; ++i) {
- if (T* sender = m_dispatchingList[i]) {
- m_dispatchingList[i] = nullptr;
+ for (auto& senderInList : m_dispatchingList) {
+ if (T* sender = senderInList) {
+ senderInList = nullptr;
sender->dispatchPendingEvent(this);
}
}
« no previous file with comments | « third_party/WebKit/Source/core/events/EventPath.cpp ('k') | third_party/WebKit/Source/core/events/EventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698