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

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

Issue 332493002: DevTools: Support async call stacks for scripted animation events (like scroll). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 for (size_t i = 0; i < events.size(); ++i) { 117 for (size_t i = 0; i < events.size(); ++i) {
118 EventTarget* eventTarget = events[i]->target(); 118 EventTarget* eventTarget = events[i]->target();
119 // FIXME: we should figure out how to make dispatchEvent properly virtua l to avoid 119 // FIXME: we should figure out how to make dispatchEvent properly virtua l to avoid
120 // special casting window. 120 // special casting window.
121 // FIXME: We should not fire events for nodes that are no longer in the tree. 121 // FIXME: We should not fire events for nodes that are no longer in the tree.
122 if (DOMWindow* window = eventTarget->toDOMWindow()) 122 if (DOMWindow* window = eventTarget->toDOMWindow())
123 window->dispatchEvent(events[i], nullptr); 123 window->dispatchEvent(events[i], nullptr);
124 else 124 else
125 eventTarget->dispatchEvent(events[i]); 125 eventTarget->dispatchEvent(events[i]);
126
127 InspectorInstrumentation::didDispatchEvent(eventTarget, events[i].get()) ;
126 } 128 }
127 } 129 }
128 130
129 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) 131 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow)
130 { 132 {
131 // dispatchEvents() runs script which can cause the document to be destroyed . 133 // dispatchEvents() runs script which can cause the document to be destroyed .
132 if (!m_document) 134 if (!m_document)
133 return; 135 return;
134 136
135 double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTime ToZeroBasedDocumentTime(monotonicTimeNow); 137 double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTime ToZeroBasedDocumentTime(monotonicTimeNow);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 RefPtr<ScriptedAnimationController> protect(this); 171 RefPtr<ScriptedAnimationController> protect(this);
170 172
171 dispatchEvents(); 173 dispatchEvents();
172 executeCallbacks(monotonicTimeNow); 174 executeCallbacks(monotonicTimeNow);
173 175
174 scheduleAnimationIfNeeded(); 176 scheduleAnimationIfNeeded();
175 } 177 }
176 178
177 void ScriptedAnimationController::enqueueEvent(PassRefPtrWillBeRawPtr<Event> eve nt) 179 void ScriptedAnimationController::enqueueEvent(PassRefPtrWillBeRawPtr<Event> eve nt)
178 { 180 {
181 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get());
179 m_eventQueue.append(event); 182 m_eventQueue.append(event);
180 scheduleAnimationIfNeeded(); 183 scheduleAnimationIfNeeded();
181 } 184 }
182 185
183 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Ev ent> event) 186 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Ev ent> event)
184 { 187 {
185 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) 188 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry)
186 return; 189 return;
187 enqueueEvent(event); 190 enqueueEvent(event);
188 } 191 }
189 192
190 void ScriptedAnimationController::scheduleAnimationIfNeeded() 193 void ScriptedAnimationController::scheduleAnimationIfNeeded()
191 { 194 {
192 if (!m_document) 195 if (!m_document)
193 return; 196 return;
194 197
195 if (m_suspendCount) 198 if (m_suspendCount)
196 return; 199 return;
197 200
198 if (!m_callbacks.size() && !m_eventQueue.size()) 201 if (!m_callbacks.size() && !m_eventQueue.size())
199 return; 202 return;
200 203
201 if (FrameView* frameView = m_document->view()) 204 if (FrameView* frameView = m_document->view())
202 frameView->scheduleAnimation(); 205 frameView->scheduleAnimation();
203 } 206 }
204 207
205 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698