#ifndef ScriptedAnimationController_h
#define ScriptedAnimationController_h
+#include "platform/heap/Handle.h"
#include "wtf/ListHashSet.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
+#include "wtf/text/AtomicString.h"
#include "wtf/text/StringImpl.h"
-namespace WebCore {
+namespace blink {
class Document;
class Event;
class EventTarget;
+class MediaQueryListListener;
class RequestAnimationFrameCallback;
-class ScriptedAnimationController : public RefCounted<ScriptedAnimationController> {
+class ScriptedAnimationController : public RefCountedWillBeGarbageCollectedFinalized<ScriptedAnimationController> {
public:
- static PassRefPtr<ScriptedAnimationController> create(Document* document)
+ static PassRefPtrWillBeRawPtr<ScriptedAnimationController> create(Document* document)
{
- return adoptRef(new ScriptedAnimationController(document));
+ return adoptRefWillBeNoop(new ScriptedAnimationController(document));
}
~ScriptedAnimationController();
- void clearDocumentPointer() { m_document = 0; }
+ void trace(Visitor*);
+ void clearDocumentPointer() { m_document = nullptr; }
typedef int CallbackId;
- int registerCallback(PassRefPtr<RequestAnimationFrameCallback>);
+ int registerCallback(RequestAnimationFrameCallback*);
void cancelCallback(CallbackId);
void serviceScriptedAnimations(double monotonicTimeNow);
- void scheduleEvent(PassRefPtr<Event>);
+ void enqueueEvent(PassRefPtrWillBeRawPtr<Event>);
+ void enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Event>);
+ void enqueueMediaQueryChangeListeners(WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener> >&);
void suspend();
void resume();
+ void dispatchEventsAndCallbacksForPrinting();
private:
explicit ScriptedAnimationController(Document*);
void scheduleAnimationIfNeeded();
- void dispatchEvents();
+ void dispatchEvents(const AtomicString& eventInterfaceFilter = AtomicString());
void executeCallbacks(double monotonicTimeNow);
+ void callMediaQueryListListeners();
- typedef Vector<RefPtr<RequestAnimationFrameCallback> > CallbackList;
+ typedef PersistentHeapVectorWillBeHeapVector<Member<RequestAnimationFrameCallback> > CallbackList;
CallbackList m_callbacks;
+ CallbackList m_callbacksToInvoke; // only non-empty while inside executeCallbacks
- Document* m_document;
+ RawPtrWillBeMember<Document> m_document;
CallbackId m_nextCallbackId;
int m_suspendCount;
- Vector<RefPtr<Event> > m_eventQueue;
- ListHashSet<std::pair<const EventTarget*, const StringImpl*> > m_scheduledEventTargets;
+ WillBeHeapVector<RefPtrWillBeMember<Event> > m_eventQueue;
+ WillBeHeapListHashSet<std::pair<RawPtrWillBeMember<const EventTarget>, const StringImpl*> > m_perFrameEvents;
+ typedef WillBeHeapListHashSet<RefPtrWillBeMember<MediaQueryListListener> > MediaQueryListListeners;
+ MediaQueryListListeners m_mediaQueryListListeners;
};
}