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

Unified Diff: third_party/WebKit/Source/core/dom/DOMStringList.cpp

Issue 2553343002: Avoid WTF::Vector::at() and operator[] in core/dom. (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/dom/DOMStringList.cpp
diff --git a/third_party/WebKit/Source/core/dom/DOMStringList.cpp b/third_party/WebKit/Source/core/dom/DOMStringList.cpp
index 03a312b805d0133159d2c8f3f136c5abb78a4f7e..4350e60bb53631d3e4391f4a8daa0a02163112ca 100644
--- a/third_party/WebKit/Source/core/dom/DOMStringList.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMStringList.cpp
@@ -72,9 +72,8 @@ bool DOMStringList::contains(ExecutionContext* context,
// FIXME: Currently, all consumers of DOMStringList store fairly small lists
// and thus an O(n) algorithm is OK. But this may need to be optimized if
// larger amounts of data are stored in m_strings.
- size_t count = m_strings.size();
- for (size_t i = 0; i < count; ++i) {
- if (m_strings[i] == string)
+ for (const auto& item : m_strings) {
+ if (item == string)
return true;
}
return false;
« no previous file with comments | « third_party/WebKit/Source/core/dom/CompositorProxy.cpp ('k') | third_party/WebKit/Source/core/dom/DOMTokenList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698