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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return std::make_pair(event->target(), event->type().impl()); 43 return std::make_pair(event->target(), event->type().impl());
44 } 44 }
45 45
46 ScriptedAnimationController::ScriptedAnimationController(Document* document) 46 ScriptedAnimationController::ScriptedAnimationController(Document* document)
47 : m_document(document) 47 : m_document(document)
48 , m_callbackCollection(document) 48 , m_callbackCollection(document)
49 , m_suspendCount(0) 49 , m_suspendCount(0)
50 { 50 {
51 } 51 }
52 52
53 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ScriptedAnimationController);
54
55 DEFINE_TRACE(ScriptedAnimationController) 53 DEFINE_TRACE(ScriptedAnimationController)
56 { 54 {
57 #if ENABLE(OILPAN) 55 #if ENABLE(OILPAN)
58 visitor->trace(m_document); 56 visitor->trace(m_document);
59 visitor->trace(m_callbackCollection); 57 visitor->trace(m_callbackCollection);
60 visitor->trace(m_eventQueue); 58 visitor->trace(m_eventQueue);
61 visitor->trace(m_mediaQueryListListeners); 59 visitor->trace(m_mediaQueryListListeners);
62 visitor->trace(m_perFrameEvents); 60 visitor->trace(m_perFrameEvents);
63 #endif 61 #endif
64 } 62 }
(...skipping 25 matching lines...) Expand all
90 return id; 88 return id;
91 } 89 }
92 90
93 void ScriptedAnimationController::cancelCallback(CallbackId id) 91 void ScriptedAnimationController::cancelCallback(CallbackId id)
94 { 92 {
95 m_callbackCollection.cancelCallback(id); 93 m_callbackCollection.cancelCallback(id);
96 } 94 }
97 95
98 void ScriptedAnimationController::dispatchEvents(const AtomicString& eventInterf aceFilter) 96 void ScriptedAnimationController::dispatchEvents(const AtomicString& eventInterf aceFilter)
99 { 97 {
100 WillBeHeapVector<RefPtrWillBeMember<Event>> events; 98 HeapVector<Member<Event>> events;
101 if (eventInterfaceFilter.isEmpty()) { 99 if (eventInterfaceFilter.isEmpty()) {
102 events.swap(m_eventQueue); 100 events.swap(m_eventQueue);
103 m_perFrameEvents.clear(); 101 m_perFrameEvents.clear();
104 } else { 102 } else {
105 WillBeHeapVector<RefPtrWillBeMember<Event>> remaining; 103 HeapVector<Member<Event>> remaining;
106 for (auto& event : m_eventQueue) { 104 for (auto& event : m_eventQueue) {
107 if (event && event->interfaceName() == eventInterfaceFilter) { 105 if (event && event->interfaceName() == eventInterfaceFilter) {
108 m_perFrameEvents.remove(eventTargetKey(event.get())); 106 m_perFrameEvents.remove(eventTargetKey(event.get()));
109 events.append(event.release()); 107 events.append(event.release());
110 } else { 108 } else {
111 remaining.append(event.release()); 109 remaining.append(event.release());
112 } 110 }
113 } 111 }
114 remaining.swap(m_eventQueue); 112 remaining.swap(m_eventQueue);
115 } 113 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return false; 154 return false;
157 155
158 return !m_callbackCollection.isEmpty() || !m_eventQueue.isEmpty() || !m_medi aQueryListListeners.isEmpty(); 156 return !m_callbackCollection.isEmpty() || !m_eventQueue.isEmpty() || !m_medi aQueryListListeners.isEmpty();
159 } 157 }
160 158
161 void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTime Now) 159 void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTime Now)
162 { 160 {
163 if (!hasScheduledItems()) 161 if (!hasScheduledItems())
164 return; 162 return;
165 163
166 RefPtrWillBeRawPtr<ScriptedAnimationController> protect(this); 164 RawPtr<ScriptedAnimationController> protect(this);
167 165
168 callMediaQueryListListeners(); 166 callMediaQueryListListeners();
169 dispatchEvents(); 167 dispatchEvents();
170 executeCallbacks(monotonicTimeNow); 168 executeCallbacks(monotonicTimeNow);
171 169
172 scheduleAnimationIfNeeded(); 170 scheduleAnimationIfNeeded();
173 } 171 }
174 172
175 void ScriptedAnimationController::enqueueEvent(PassRefPtrWillBeRawPtr<Event> eve nt) 173 void ScriptedAnimationController::enqueueEvent(RawPtr<Event> event)
176 { 174 {
177 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get()); 175 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get());
178 m_eventQueue.append(event); 176 m_eventQueue.append(event);
179 scheduleAnimationIfNeeded(); 177 scheduleAnimationIfNeeded();
180 } 178 }
181 179
182 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Ev ent> event) 180 void ScriptedAnimationController::enqueuePerFrameEvent(RawPtr<Event> event)
183 { 181 {
184 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) 182 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry)
185 return; 183 return;
186 enqueueEvent(event); 184 enqueueEvent(event);
187 } 185 }
188 186
189 void ScriptedAnimationController::enqueueMediaQueryChangeListeners(WillBeHeapVec tor<RefPtrWillBeMember<MediaQueryListListener>>& listeners) 187 void ScriptedAnimationController::enqueueMediaQueryChangeListeners(HeapVector<Me mber<MediaQueryListListener>>& listeners)
190 { 188 {
191 for (size_t i = 0; i < listeners.size(); ++i) { 189 for (size_t i = 0; i < listeners.size(); ++i) {
192 m_mediaQueryListListeners.add(listeners[i]); 190 m_mediaQueryListListeners.add(listeners[i]);
193 } 191 }
194 scheduleAnimationIfNeeded(); 192 scheduleAnimationIfNeeded();
195 } 193 }
196 194
197 void ScriptedAnimationController::scheduleAnimationIfNeeded() 195 void ScriptedAnimationController::scheduleAnimationIfNeeded()
198 { 196 {
199 if (!hasScheduledItems()) 197 if (!hasScheduledItems())
200 return; 198 return;
201 199
202 if (!m_document) 200 if (!m_document)
203 return; 201 return;
204 202
205 if (FrameView* frameView = m_document->view()) 203 if (FrameView* frameView = m_document->view())
206 frameView->scheduleAnimation(); 204 frameView->scheduleAnimation();
207 } 205 }
208 206
209 } // namespace blink 207 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698