| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 remaining.swap(m_eventQueue); | 107 remaining.swap(m_eventQueue); |
| 108 } | 108 } |
| 109 | 109 |
| 110 for (const auto& event : events) { | 110 for (const auto& event : events) { |
| 111 EventTarget* eventTarget = event->target(); | 111 EventTarget* eventTarget = event->target(); |
| 112 // FIXME: we should figure out how to make dispatchEvent properly virtual to | 112 // FIXME: we should figure out how to make dispatchEvent properly virtual to |
| 113 // avoid special casting window. | 113 // avoid special casting window. |
| 114 // FIXME: We should not fire events for nodes that are no longer in the | 114 // FIXME: We should not fire events for nodes that are no longer in the |
| 115 // tree. | 115 // tree. |
| 116 InspectorInstrumentation::AsyncTask asyncTask( | 116 probe::AsyncTask asyncTask(eventTarget->getExecutionContext(), event); |
| 117 eventTarget->getExecutionContext(), event); | |
| 118 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow()) | 117 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow()) |
| 119 window->dispatchEvent(event, nullptr); | 118 window->dispatchEvent(event, nullptr); |
| 120 else | 119 else |
| 121 eventTarget->dispatchEvent(event); | 120 eventTarget->dispatchEvent(event); |
| 122 } | 121 } |
| 123 } | 122 } |
| 124 | 123 |
| 125 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) { | 124 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) { |
| 126 // dispatchEvents() runs script which can cause the document to be destroyed. | 125 // dispatchEvents() runs script which can cause the document to be destroyed. |
| 127 if (!m_document) | 126 if (!m_document) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 scheduleAnimationIfNeeded(); | 167 scheduleAnimationIfNeeded(); |
| 169 } | 168 } |
| 170 | 169 |
| 171 void ScriptedAnimationController::enqueueTask( | 170 void ScriptedAnimationController::enqueueTask( |
| 172 std::unique_ptr<WTF::Closure> task) { | 171 std::unique_ptr<WTF::Closure> task) { |
| 173 m_taskQueue.push_back(std::move(task)); | 172 m_taskQueue.push_back(std::move(task)); |
| 174 scheduleAnimationIfNeeded(); | 173 scheduleAnimationIfNeeded(); |
| 175 } | 174 } |
| 176 | 175 |
| 177 void ScriptedAnimationController::enqueueEvent(Event* event) { | 176 void ScriptedAnimationController::enqueueEvent(Event* event) { |
| 178 InspectorInstrumentation::asyncTaskScheduled( | 177 probe::asyncTaskScheduled(event->target()->getExecutionContext(), |
| 179 event->target()->getExecutionContext(), event->type(), event); | 178 event->type(), event); |
| 180 m_eventQueue.push_back(event); | 179 m_eventQueue.push_back(event); |
| 181 scheduleAnimationIfNeeded(); | 180 scheduleAnimationIfNeeded(); |
| 182 } | 181 } |
| 183 | 182 |
| 184 void ScriptedAnimationController::enqueuePerFrameEvent(Event* event) { | 183 void ScriptedAnimationController::enqueuePerFrameEvent(Event* event) { |
| 185 if (!m_perFrameEvents.insert(eventTargetKey(event)).isNewEntry) | 184 if (!m_perFrameEvents.insert(eventTargetKey(event)).isNewEntry) |
| 186 return; | 185 return; |
| 187 enqueueEvent(event); | 186 enqueueEvent(event); |
| 188 } | 187 } |
| 189 | 188 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 200 return; | 199 return; |
| 201 | 200 |
| 202 if (!m_document) | 201 if (!m_document) |
| 203 return; | 202 return; |
| 204 | 203 |
| 205 if (FrameView* frameView = m_document->view()) | 204 if (FrameView* frameView = m_document->view()) |
| 206 frameView->scheduleAnimation(); | 205 frameView->scheduleAnimation(); |
| 207 } | 206 } |
| 208 | 207 |
| 209 } // namespace blink | 208 } // namespace blink |
| OLD | NEW |