| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCal
lback(PassOwnPtr<RequestAnimationFrameCallback> callback) | 84 ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCal
lback(PassOwnPtr<RequestAnimationFrameCallback> callback) |
| 85 { | 85 { |
| 86 ScriptedAnimationController::CallbackId id = ++m_nextCallbackId; | 86 ScriptedAnimationController::CallbackId id = ++m_nextCallbackId; |
| 87 WTF_LOG(ScriptedAnimationController, "registerCallback: id = %d", id); | 87 WTF_LOG(ScriptedAnimationController, "registerCallback: id = %d", id); |
| 88 callback->m_cancelled = false; | 88 callback->m_cancelled = false; |
| 89 callback->m_id = id; | 89 callback->m_id = id; |
| 90 m_callbacks.append(callback); | 90 m_callbacks.append(callback); |
| 91 scheduleAnimationIfNeeded(); | 91 scheduleAnimationIfNeeded(); |
| 92 | 92 |
| 93 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Reques
tAnimationFrame", "data", InspectorAnimationFrameEvent::data(m_document, id)); | 93 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Reques
tAnimationFrame", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorAnimationFrameEven
t::data(m_document, id)); |
| 94 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 94 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 95 | 95 |
| 96 return id; | 96 return id; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ScriptedAnimationController::cancelCallback(CallbackId id) | 99 void ScriptedAnimationController::cancelCallback(CallbackId id) |
| 100 { | 100 { |
| 101 WTF_LOG(ScriptedAnimationController, "cancelCallback: id = %d", id); | 101 WTF_LOG(ScriptedAnimationController, "cancelCallback: id = %d", id); |
| 102 for (size_t i = 0; i < m_callbacks.size(); ++i) { | 102 for (size_t i = 0; i < m_callbacks.size(); ++i) { |
| 103 if (m_callbacks[i]->m_id == id) { | 103 if (m_callbacks[i]->m_id == id) { |
| 104 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
"CancelAnimationFrame", "data", InspectorAnimationFrameEvent::data(m_document,
id)); | 104 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
"CancelAnimationFrame", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorAnimationFr
ameEvent::data(m_document, id)); |
| 105 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.st
ack"), "CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 105 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.st
ack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent:
:currentCallStack()); |
| 106 m_callbacks.remove(i); | 106 m_callbacks.remove(i); |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { | 110 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { |
| 111 if (m_callbacksToInvoke[i]->m_id == id) { | 111 if (m_callbacksToInvoke[i]->m_id == id) { |
| 112 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
"CancelAnimationFrame", "data", InspectorAnimationFrameEvent::data(m_document,
id)); | 112 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
"CancelAnimationFrame", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorAnimationFr
ameEvent::data(m_document, id)); |
| 113 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.st
ack"), "CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 113 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.st
ack"), "CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent:
:currentCallStack()); |
| 114 m_callbacksToInvoke[i]->m_cancelled = true; | 114 m_callbacksToInvoke[i]->m_cancelled = true; |
| 115 // will be removed at the end of executeCallbacks() | 115 // will be removed at the end of executeCallbacks() |
| 116 return; | 116 return; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ScriptedAnimationController::dispatchEvents() | 121 void ScriptedAnimationController::dispatchEvents() |
| 122 { | 122 { |
| 123 Vector<RefPtr<Event> > events; | 123 Vector<RefPtr<Event> > events; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 151 m_callbacksToInvoke.swap(m_callbacks); | 151 m_callbacksToInvoke.swap(m_callbacks); |
| 152 | 152 |
| 153 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { | 153 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { |
| 154 RequestAnimationFrameCallback* callback = m_callbacksToInvoke[i].get(); | 154 RequestAnimationFrameCallback* callback = m_callbacksToInvoke[i].get(); |
| 155 if (!callback->m_cancelled) { | 155 if (!callback->m_cancelled) { |
| 156 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FireAn
imationFrame", "data", InspectorAnimationFrameEvent::data(m_document, callback->
m_id)); | 156 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FireAn
imationFrame", "data", InspectorAnimationFrameEvent::data(m_document, callback->
m_id)); |
| 157 if (callback->m_useLegacyTimeBase) | 157 if (callback->m_useLegacyTimeBase) |
| 158 callback->handleEvent(legacyHighResNowMs); | 158 callback->handleEvent(legacyHighResNowMs); |
| 159 else | 159 else |
| 160 callback->handleEvent(highResNowMs); | 160 callback->handleEvent(highResNowMs); |
| 161 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
"UpdateCounters", "data", InspectorUpdateCountersEvent::data()); | 161 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
"UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEve
nt::data()); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 m_callbacksToInvoke.clear(); | 165 m_callbacksToInvoke.clear(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void ScriptedAnimationController::callMediaQueryListListeners() | 168 void ScriptedAnimationController::callMediaQueryListListeners() |
| 169 { | 169 { |
| 170 MediaQueryListListeners listeners; | 170 MediaQueryListListeners listeners; |
| 171 listeners.swap(m_mediaQueryListListeners); | 171 listeners.swap(m_mediaQueryListListeners); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 return; | 236 return; |
| 237 | 237 |
| 238 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener
s.size()) | 238 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener
s.size()) |
| 239 return; | 239 return; |
| 240 | 240 |
| 241 if (FrameView* frameView = m_document->view()) | 241 if (FrameView* frameView = m_document->view()) |
| 242 frameView->scheduleAnimation(); | 242 frameView->scheduleAnimation(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } | 245 } |
| OLD | NEW |