OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/dom/FrameRequestCallbackCollection.h" | 5 #include "core/dom/FrameRequestCallbackCollection.h" |
6 | 6 |
7 #include "core/dom/FrameRequestCallback.h" | 7 #include "core/dom/FrameRequestCallback.h" |
8 #include "core/inspector/InspectorInstrumentation.h" | 8 #include "core/inspector/InspectorInstrumentation.h" |
9 #include "core/inspector/InspectorTraceEvents.h" | 9 #include "core/inspector/InspectorTraceEvents.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 probe::asyncTaskScheduledBreakable(m_context, "requestAnimationFrame", | 28 probe::asyncTaskScheduledBreakable(m_context, "requestAnimationFrame", |
29 callback); | 29 callback); |
30 return id; | 30 return id; |
31 } | 31 } |
32 | 32 |
33 void FrameRequestCallbackCollection::cancelCallback(CallbackId id) { | 33 void FrameRequestCallbackCollection::cancelCallback(CallbackId id) { |
34 for (size_t i = 0; i < m_callbacks.size(); ++i) { | 34 for (size_t i = 0; i < m_callbacks.size(); ++i) { |
35 if (m_callbacks[i]->m_id == id) { | 35 if (m_callbacks[i]->m_id == id) { |
36 probe::asyncTaskCanceledBreakable(m_context, "cancelAnimationFrame", | 36 probe::asyncTaskCanceledBreakable(m_context, "cancelAnimationFrame", |
37 m_callbacks[i]); | 37 m_callbacks[i]); |
38 m_callbacks.remove(i); | 38 m_callbacks.erase(i); |
39 TRACE_EVENT_INSTANT1("devtools.timeline", "CancelAnimationFrame", | 39 TRACE_EVENT_INSTANT1("devtools.timeline", "CancelAnimationFrame", |
40 TRACE_EVENT_SCOPE_THREAD, "data", | 40 TRACE_EVENT_SCOPE_THREAD, "data", |
41 InspectorAnimationFrameEvent::data(m_context, id)); | 41 InspectorAnimationFrameEvent::data(m_context, id)); |
42 return; | 42 return; |
43 } | 43 } |
44 } | 44 } |
45 for (const auto& callback : m_callbacksToInvoke) { | 45 for (const auto& callback : m_callbacksToInvoke) { |
46 if (callback->m_id == id) { | 46 if (callback->m_id == id) { |
47 probe::asyncTaskCanceledBreakable(m_context, "cancelAnimationFrame", | 47 probe::asyncTaskCanceledBreakable(m_context, "cancelAnimationFrame", |
48 callback); | 48 callback); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 m_callbacksToInvoke.clear(); | 82 m_callbacksToInvoke.clear(); |
83 } | 83 } |
84 | 84 |
85 DEFINE_TRACE(FrameRequestCallbackCollection) { | 85 DEFINE_TRACE(FrameRequestCallbackCollection) { |
86 visitor->trace(m_callbacks); | 86 visitor->trace(m_callbacks); |
87 visitor->trace(m_callbacksToInvoke); | 87 visitor->trace(m_callbacksToInvoke); |
88 visitor->trace(m_context); | 88 visitor->trace(m_context); |
89 } | 89 } |
90 | 90 |
91 } // namespace blink | 91 } // namespace blink |
OLD | NEW |