| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // will be removed at the end of executeCallbacks() | 48 // will be removed at the end of executeCallbacks() |
| 49 return; | 49 return; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 void FrameRequestCallbackCollection::executeCallbacks(double highResNowMs, doubl
e highResNowMsLegacy) | 54 void FrameRequestCallbackCollection::executeCallbacks(double highResNowMs, doubl
e highResNowMsLegacy) |
| 55 { | 55 { |
| 56 // First, generate a list of callbacks to consider. Callbacks registered fr
om this point | 56 // First, generate a list of callbacks to consider. Callbacks registered fr
om this point |
| 57 // on are considered only for the "next" frame, not this one. | 57 // on are considered only for the "next" frame, not this one. |
| 58 ASSERT(m_callbacksToInvoke.isEmpty()); | 58 DCHECK(m_callbacksToInvoke.isEmpty()); |
| 59 m_callbacksToInvoke.swap(m_callbacks); | 59 m_callbacksToInvoke.swap(m_callbacks); |
| 60 | 60 |
| 61 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { | 61 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { |
| 62 FrameRequestCallback* callback = m_callbacksToInvoke[i].get(); | 62 FrameRequestCallback* callback = m_callbacksToInvoke[i].get(); |
| 63 if (!callback->m_cancelled) { | 63 if (!callback->m_cancelled) { |
| 64 TRACE_EVENT1("devtools.timeline", "FireAnimationFrame", "data", Insp
ectorAnimationFrameEvent::data(m_context, callback->m_id)); | 64 TRACE_EVENT1("devtools.timeline", "FireAnimationFrame", "data", Insp
ectorAnimationFrameEvent::data(m_context, callback->m_id)); |
| 65 InspectorInstrumentation::allowNativeBreakpoint(m_context, "animatio
nFrameFired", false); | 65 InspectorInstrumentation::allowNativeBreakpoint(m_context, "animatio
nFrameFired", false); |
| 66 InspectorInstrumentation::AsyncTask asyncTask(m_context, callback); | 66 InspectorInstrumentation::AsyncTask asyncTask(m_context, callback); |
| 67 if (callback->m_useLegacyTimeBase) | 67 if (callback->m_useLegacyTimeBase) |
| 68 callback->handleEvent(highResNowMsLegacy); | 68 callback->handleEvent(highResNowMsLegacy); |
| 69 else | 69 else |
| 70 callback->handleEvent(highResNowMs); | 70 callback->handleEvent(highResNowMs); |
| 71 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
"UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEven
t::data()); | 71 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
"UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEven
t::data()); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 m_callbacksToInvoke.clear(); | 75 m_callbacksToInvoke.clear(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 DEFINE_TRACE(FrameRequestCallbackCollection) | 78 DEFINE_TRACE(FrameRequestCallbackCollection) |
| 79 { | 79 { |
| 80 visitor->trace(m_callbacks); | 80 visitor->trace(m_callbacks); |
| 81 visitor->trace(m_callbacksToInvoke); | 81 visitor->trace(m_callbacksToInvoke); |
| 82 visitor->trace(m_context); | 82 visitor->trace(m_context); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |