| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 remaining.swap(m_eventQueue); | 110 remaining.swap(m_eventQueue); |
| 111 } | 111 } |
| 112 | 112 |
| 113 | 113 |
| 114 for (size_t i = 0; i < events.size(); ++i) { | 114 for (size_t i = 0; i < events.size(); ++i) { |
| 115 EventTarget* eventTarget = events[i]->target(); | 115 EventTarget* eventTarget = events[i]->target(); |
| 116 // FIXME: we should figure out how to make dispatchEvent properly virtua
l to avoid | 116 // FIXME: we should figure out how to make dispatchEvent properly virtua
l to avoid |
| 117 // special casting window. | 117 // special casting window. |
| 118 // FIXME: We should not fire events for nodes that are no longer in the
tree. | 118 // FIXME: We should not fire events for nodes that are no longer in the
tree. |
| 119 InspectorInstrumentation::AsyncTask asyncTask(eventTarget->getExecutionC
ontext(), events[i]); |
| 119 if (LocalDOMWindow* window = eventTarget->toDOMWindow()) | 120 if (LocalDOMWindow* window = eventTarget->toDOMWindow()) |
| 120 window->dispatchEvent(events[i], nullptr); | 121 window->dispatchEvent(events[i], nullptr); |
| 121 else | 122 else |
| 122 eventTarget->dispatchEvent(events[i]); | 123 eventTarget->dispatchEvent(events[i]); |
| 123 | |
| 124 InspectorInstrumentation::didRemoveEvent(eventTarget, events[i].get()); | |
| 125 } | 124 } |
| 126 } | 125 } |
| 127 | 126 |
| 128 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) | 127 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) |
| 129 { | 128 { |
| 130 // dispatchEvents() runs script which can cause the document to be destroyed
. | 129 // dispatchEvents() runs script which can cause the document to be destroyed
. |
| 131 if (!m_document) | 130 if (!m_document) |
| 132 return; | 131 return; |
| 133 | 132 |
| 134 double highResNowMs = 1000.0 * m_document->loader()->timing().monotonicTimeT
oZeroBasedDocumentTime(monotonicTimeNow); | 133 double highResNowMs = 1000.0 * m_document->loader()->timing().monotonicTimeT
oZeroBasedDocumentTime(monotonicTimeNow); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 163 | 162 |
| 164 callMediaQueryListListeners(); | 163 callMediaQueryListListeners(); |
| 165 dispatchEvents(); | 164 dispatchEvents(); |
| 166 executeCallbacks(monotonicTimeNow); | 165 executeCallbacks(monotonicTimeNow); |
| 167 | 166 |
| 168 scheduleAnimationIfNeeded(); | 167 scheduleAnimationIfNeeded(); |
| 169 } | 168 } |
| 170 | 169 |
| 171 void ScriptedAnimationController::enqueueEvent(Event* event) | 170 void ScriptedAnimationController::enqueueEvent(Event* event) |
| 172 { | 171 { |
| 173 InspectorInstrumentation::didEnqueueEvent(event->target(), event); | 172 InspectorInstrumentation::asyncTaskScheduled(event->target()->getExecutionCo
ntext(), event->type(), event); |
| 174 m_eventQueue.append(event); | 173 m_eventQueue.append(event); |
| 175 scheduleAnimationIfNeeded(); | 174 scheduleAnimationIfNeeded(); |
| 176 } | 175 } |
| 177 | 176 |
| 178 void ScriptedAnimationController::enqueuePerFrameEvent(RawPtr<Event> event) | 177 void ScriptedAnimationController::enqueuePerFrameEvent(RawPtr<Event> event) |
| 179 { | 178 { |
| 180 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) | 179 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) |
| 181 return; | 180 return; |
| 182 enqueueEvent(event); | 181 enqueueEvent(event); |
| 183 } | 182 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 196 return; | 195 return; |
| 197 | 196 |
| 198 if (!m_document) | 197 if (!m_document) |
| 199 return; | 198 return; |
| 200 | 199 |
| 201 if (FrameView* frameView = m_document->view()) | 200 if (FrameView* frameView = m_document->view()) |
| 202 frameView->scheduleAnimation(); | 201 frameView->scheduleAnimation(); |
| 203 } | 202 } |
| 204 | 203 |
| 205 } // namespace blink | 204 } // namespace blink |
| OLD | NEW |