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

Unified Diff: third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.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/FrameRequestCallbackCollection.cpp
diff --git a/third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp b/third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp
index 8ecc1e3779176311a622f9906791d40f3fc254a2..5002f3d4b8308f73b4e7cf49fd3afd275da086eb 100644
--- a/third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp
+++ b/third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp
@@ -46,16 +46,15 @@ void FrameRequestCallbackCollection::cancelCallback(CallbackId id) {
return;
}
}
- for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) {
- if (m_callbacksToInvoke[i]->m_id == id) {
- InspectorInstrumentation::asyncTaskCanceled(m_context,
- m_callbacksToInvoke[i]);
+ for (const auto& callback : m_callbacksToInvoke) {
+ if (callback->m_id == id) {
+ InspectorInstrumentation::asyncTaskCanceled(m_context, callback);
InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(
m_context, "cancelAnimationFrame", true);
TRACE_EVENT_INSTANT1("devtools.timeline", "CancelAnimationFrame",
TRACE_EVENT_SCOPE_THREAD, "data",
InspectorAnimationFrameEvent::data(m_context, id));
- m_callbacksToInvoke[i]->m_cancelled = true;
+ callback->m_cancelled = true;
// will be removed at the end of executeCallbacks()
return;
}
@@ -70,8 +69,7 @@ void FrameRequestCallbackCollection::executeCallbacks(
DCHECK(m_callbacksToInvoke.isEmpty());
m_callbacksToInvoke.swap(m_callbacks);
- for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) {
- FrameRequestCallback* callback = m_callbacksToInvoke[i].get();
+ for (const auto& callback : m_callbacksToInvoke) {
if (!callback->m_cancelled) {
TRACE_EVENT1(
"devtools.timeline", "FireAnimationFrame", "data",
« no previous file with comments | « third_party/WebKit/Source/core/dom/DOMTokenList.cpp ('k') | third_party/WebKit/Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698