| 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/frame/PerformanceMonitor.h" | 8 #include "core/frame/PerformanceMonitor.h" |
| 9 #include "core/inspector/InspectorInstrumentation.h" | 9 #include "core/inspector/InspectorInstrumentation.h" |
| 10 #include "core/inspector/InspectorTraceEvents.h" | 10 #include "core/inspector/InspectorTraceEvents.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 FrameRequestCallbackCollection::FrameRequestCallbackCollection( | 14 FrameRequestCallbackCollection::FrameRequestCallbackCollection( |
| 15 ExecutionContext* context) | 15 ExecutionContext* context) |
| 16 : m_context(context) {} | 16 : m_context(context) {} |
| 17 | 17 |
| 18 FrameRequestCallbackCollection::CallbackId | 18 FrameRequestCallbackCollection::CallbackId |
| 19 FrameRequestCallbackCollection::registerCallback( | 19 FrameRequestCallbackCollection::registerCallback( |
| 20 FrameRequestCallback* callback) { | 20 FrameRequestCallback* callback) { |
| 21 FrameRequestCallbackCollection::CallbackId id = ++m_nextCallbackId; | 21 FrameRequestCallbackCollection::CallbackId id = ++m_nextCallbackId; |
| 22 callback->m_cancelled = false; | 22 callback->m_cancelled = false; |
| 23 callback->m_id = id; | 23 callback->m_id = id; |
| 24 m_callbacks.append(callback); | 24 m_callbacks.push_back(callback); |
| 25 | 25 |
| 26 TRACE_EVENT_INSTANT1("devtools.timeline", "RequestAnimationFrame", | 26 TRACE_EVENT_INSTANT1("devtools.timeline", "RequestAnimationFrame", |
| 27 TRACE_EVENT_SCOPE_THREAD, "data", | 27 TRACE_EVENT_SCOPE_THREAD, "data", |
| 28 InspectorAnimationFrameEvent::data(m_context, id)); | 28 InspectorAnimationFrameEvent::data(m_context, id)); |
| 29 InspectorInstrumentation::asyncTaskScheduled( | 29 InspectorInstrumentation::asyncTaskScheduled( |
| 30 m_context, "requestAnimationFrame", callback); | 30 m_context, "requestAnimationFrame", callback); |
| 31 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint( | 31 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint( |
| 32 m_context, "requestAnimationFrame", true); | 32 m_context, "requestAnimationFrame", true); |
| 33 return id; | 33 return id; |
| 34 } | 34 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 m_callbacksToInvoke.clear(); | 92 m_callbacksToInvoke.clear(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 DEFINE_TRACE(FrameRequestCallbackCollection) { | 95 DEFINE_TRACE(FrameRequestCallbackCollection) { |
| 96 visitor->trace(m_callbacks); | 96 visitor->trace(m_callbacks); |
| 97 visitor->trace(m_callbacksToInvoke); | 97 visitor->trace(m_callbacksToInvoke); |
| 98 visitor->trace(m_context); | 98 visitor->trace(m_context); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace blink | 101 } // namespace blink |
| OLD | NEW |