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