Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: Source/core/dom/ScriptedAnimationController.cpp

Issue 369793003: Make the web-animations engine use the passed in blink::WebFrameTime values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing the tests under the release build. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // FIXME: We should not fire events for nodes that are no longer in the tree. 132 // FIXME: We should not fire events for nodes that are no longer in the tree.
133 if (LocalDOMWindow* window = eventTarget->toDOMWindow()) 133 if (LocalDOMWindow* window = eventTarget->toDOMWindow())
134 window->dispatchEvent(events[i], nullptr); 134 window->dispatchEvent(events[i], nullptr);
135 else 135 else
136 eventTarget->dispatchEvent(events[i]); 136 eventTarget->dispatchEvent(events[i]);
137 137
138 InspectorInstrumentation::didRemoveEvent(eventTarget, events[i].get()); 138 InspectorInstrumentation::didRemoveEvent(eventTarget, events[i].get());
139 } 139 }
140 } 140 }
141 141
142 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) 142 void ScriptedAnimationController::executeCallbacks(blink::WebFrameTime frameTime )
143 { 143 {
144 // dispatchEvents() runs script which can cause the document to be destroyed . 144 // dispatchEvents() runs script which can cause the document to be destroyed .
145 if (!m_document) 145 if (!m_document)
146 return; 146 return;
147 147
148 double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTime ToZeroBasedDocumentTime(monotonicTimeNow); 148 double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTime ToZeroBasedDocumentTime(frameTime.lastFrameTime);
jamesr 2014/07/08 05:00:35 ... and this value do not appear to be the same to
149 double legacyHighResNowMs = 1000.0 * m_document->loader()->timing()->monoton icTimeToPseudoWallTime(monotonicTimeNow); 149 double legacyHighResNowMs = 1000.0 * m_document->loader()->timing()->monoton icTimeToPseudoWallTime(frameTime.lastFrameTime);
150 150
151 // First, generate a list of callbacks to consider. Callbacks registered fr om this point 151 // First, generate a list of callbacks to consider. Callbacks registered fr om this point
152 // on are considered only for the "next" frame, not this one. 152 // on are considered only for the "next" frame, not this one.
153 ASSERT(m_callbacksToInvoke.isEmpty()); 153 ASSERT(m_callbacksToInvoke.isEmpty());
154 m_callbacksToInvoke.swap(m_callbacks); 154 m_callbacksToInvoke.swap(m_callbacks);
155 155
156 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { 156 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) {
157 RequestAnimationFrameCallback* callback = m_callbacksToInvoke[i].get(); 157 RequestAnimationFrameCallback* callback = m_callbacksToInvoke[i].get();
158 if (!callback->m_cancelled) { 158 if (!callback->m_cancelled) {
159 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FireAn imationFrame", "data", InspectorAnimationFrameEvent::data(m_document, callback-> m_id)); 159 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FireAn imationFrame", "data", InspectorAnimationFrameEvent::data(m_document, callback-> m_id));
(...skipping 15 matching lines...) Expand all
175 { 175 {
176 MediaQueryListListeners listeners; 176 MediaQueryListListeners listeners;
177 listeners.swap(m_mediaQueryListListeners); 177 listeners.swap(m_mediaQueryListListeners);
178 178
179 for (MediaQueryListListeners::const_iterator it = listeners.begin(), end = l isteners.end(); 179 for (MediaQueryListListeners::const_iterator it = listeners.begin(), end = l isteners.end();
180 it != end; ++it) { 180 it != end; ++it) {
181 (*it)->call(); 181 (*it)->call();
182 } 182 }
183 } 183 }
184 184
185 void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTime Now) 185 void ScriptedAnimationController::serviceScriptedAnimations(blink::WebFrameTime frameTime)
186 { 186 {
187 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener s.size()) 187 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener s.size())
188 return; 188 return;
189 189
190 if (m_suspendCount) 190 if (m_suspendCount)
191 return; 191 return;
192 192
193 RefPtrWillBeRawPtr<ScriptedAnimationController> protect(this); 193 RefPtrWillBeRawPtr<ScriptedAnimationController> protect(this);
194 194
195 callMediaQueryListListeners(); 195 callMediaQueryListListeners();
196 dispatchEvents(); 196 dispatchEvents();
197 executeCallbacks(monotonicTimeNow); 197 executeCallbacks(frameTime);
198 198
199 scheduleAnimationIfNeeded(); 199 scheduleAnimationIfNeeded();
200 } 200 }
201 201
202 void ScriptedAnimationController::enqueueEvent(PassRefPtrWillBeRawPtr<Event> eve nt) 202 void ScriptedAnimationController::enqueueEvent(PassRefPtrWillBeRawPtr<Event> eve nt)
203 { 203 {
204 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get()); 204 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get());
205 m_eventQueue.append(event); 205 m_eventQueue.append(event);
206 scheduleAnimationIfNeeded(); 206 scheduleAnimationIfNeeded();
207 } 207 }
(...skipping 22 matching lines...) Expand all
230 return; 230 return;
231 231
232 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener s.size()) 232 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener s.size())
233 return; 233 return;
234 234
235 if (FrameView* frameView = m_document->view()) 235 if (FrameView* frameView = m_document->view())
236 frameView->scheduleAnimation(); 236 frameView->scheduleAnimation();
237 } 237 }
238 238
239 } 239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698