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

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

Issue 216523002: Oilpan: Replace most of RefPtrs for Event objects with oilpan's transition types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 InspectorInstrumentation::didCancelAnimationFrame(m_document, id); 93 InspectorInstrumentation::didCancelAnimationFrame(m_document, id);
94 m_callbacksToInvoke[i]->m_cancelled = true; 94 m_callbacksToInvoke[i]->m_cancelled = true;
95 // will be removed at the end of executeCallbacks() 95 // will be removed at the end of executeCallbacks()
96 return; 96 return;
97 } 97 }
98 } 98 }
99 } 99 }
100 100
101 void ScriptedAnimationController::dispatchEvents() 101 void ScriptedAnimationController::dispatchEvents()
102 { 102 {
103 Vector<RefPtr<Event> > events; 103 WillBeHeapVector<RefPtrWillBeMember<Event> > events;
104 events.swap(m_eventQueue); 104 events.swap(m_eventQueue);
105 m_perFrameEvents.clear(); 105 m_perFrameEvents.clear();
106 106
107 for (size_t i = 0; i < events.size(); ++i) { 107 for (size_t i = 0; i < events.size(); ++i) {
108 EventTarget* eventTarget = events[i]->target(); 108 EventTarget* eventTarget = events[i]->target();
109 // FIXME: we should figure out how to make dispatchEvent properly virtua l to avoid 109 // FIXME: we should figure out how to make dispatchEvent properly virtua l to avoid
110 // special casting window. 110 // special casting window.
111 // FIXME: We should not fire events for nodes that are no longer in the tree. 111 // FIXME: We should not fire events for nodes that are no longer in the tree.
112 if (DOMWindow* window = eventTarget->toDOMWindow()) 112 if (DOMWindow* window = eventTarget->toDOMWindow())
113 window->dispatchEvent(events[i], nullptr); 113 window->dispatchEvent(events[i], nullptr);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return; 154 return;
155 155
156 RefPtr<ScriptedAnimationController> protect(this); 156 RefPtr<ScriptedAnimationController> protect(this);
157 157
158 dispatchEvents(); 158 dispatchEvents();
159 executeCallbacks(monotonicTimeNow); 159 executeCallbacks(monotonicTimeNow);
160 160
161 scheduleAnimationIfNeeded(); 161 scheduleAnimationIfNeeded();
162 } 162 }
163 163
164 void ScriptedAnimationController::enqueueEvent(PassRefPtr<Event> event) 164 void ScriptedAnimationController::enqueueEvent(PassRefPtrWillBeRawPtr<Event> eve nt)
165 { 165 {
166 m_eventQueue.append(event); 166 m_eventQueue.append(event);
167 scheduleAnimationIfNeeded(); 167 scheduleAnimationIfNeeded();
168 } 168 }
169 169
170 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtr<Event> event) 170 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Ev ent> event)
171 { 171 {
172 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) 172 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry)
173 return; 173 return;
174 enqueueEvent(event); 174 enqueueEvent(event);
175 } 175 }
176 176
177 void ScriptedAnimationController::scheduleAnimationIfNeeded() 177 void ScriptedAnimationController::scheduleAnimationIfNeeded()
178 { 178 {
179 if (!m_document) 179 if (!m_document)
180 return; 180 return;
181 181
182 if (m_suspendCount) 182 if (m_suspendCount)
183 return; 183 return;
184 184
185 if (!m_callbacks.size() && !m_eventQueue.size()) 185 if (!m_callbacks.size() && !m_eventQueue.size())
186 return; 186 return;
187 187
188 if (FrameView* frameView = m_document->view()) 188 if (FrameView* frameView = m_document->view())
189 frameView->scheduleAnimation(); 189 frameView->scheduleAnimation();
190 } 190 }
191 191
192 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698