| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 m_callbacksToInvoke[i]->m_cancelled = true; | 57 m_callbacksToInvoke[i]->m_cancelled = true; |
| 58 // will be removed at the end of executeCallbacks() | 58 // will be removed at the end of executeCallbacks() |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 void FrameRequestCallbackCollection::executeCallbacks( | 64 void FrameRequestCallbackCollection::executeCallbacks( |
| 65 double highResNowMs, | 65 double highResNowMs, |
| 66 double highResNowMsLegacy) { | 66 double highResNowMsLegacy) { |
| 67 // First, generate a list of callbacks to consider. Callbacks registered from
this point | 67 // First, generate a list of callbacks to consider. Callbacks registered from |
| 68 // on are considered only for the "next" frame, not this one. | 68 // this point on are considered only for the "next" frame, not this one. |
| 69 DCHECK(m_callbacksToInvoke.isEmpty()); | 69 DCHECK(m_callbacksToInvoke.isEmpty()); |
| 70 m_callbacksToInvoke.swap(m_callbacks); | 70 m_callbacksToInvoke.swap(m_callbacks); |
| 71 | 71 |
| 72 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { | 72 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { |
| 73 FrameRequestCallback* callback = m_callbacksToInvoke[i].get(); | 73 FrameRequestCallback* callback = m_callbacksToInvoke[i].get(); |
| 74 if (!callback->m_cancelled) { | 74 if (!callback->m_cancelled) { |
| 75 TRACE_EVENT1( | 75 TRACE_EVENT1( |
| 76 "devtools.timeline", "FireAnimationFrame", "data", | 76 "devtools.timeline", "FireAnimationFrame", "data", |
| 77 InspectorAnimationFrameEvent::data(m_context, callback->m_id)); | 77 InspectorAnimationFrameEvent::data(m_context, callback->m_id)); |
| 78 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint( | 78 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 m_callbacksToInvoke.clear(); | 91 m_callbacksToInvoke.clear(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 DEFINE_TRACE(FrameRequestCallbackCollection) { | 94 DEFINE_TRACE(FrameRequestCallbackCollection) { |
| 95 visitor->trace(m_callbacks); | 95 visitor->trace(m_callbacks); |
| 96 visitor->trace(m_callbacksToInvoke); | 96 visitor->trace(m_callbacksToInvoke); |
| 97 visitor->trace(m_context); | 97 visitor->trace(m_context); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace blink | 100 } // namespace blink |
| OLD | NEW |