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 20 matching lines...) Expand all Loading... |
31 #include "wtf/RefCounted.h" | 31 #include "wtf/RefCounted.h" |
32 #include "wtf/RefPtr.h" | 32 #include "wtf/RefPtr.h" |
33 #include "wtf/Vector.h" | 33 #include "wtf/Vector.h" |
34 #include "wtf/text/StringImpl.h" | 34 #include "wtf/text/StringImpl.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class Document; | 38 class Document; |
39 class Event; | 39 class Event; |
40 class EventTarget; | 40 class EventTarget; |
41 class MediaQueryListListener; | |
42 class RequestAnimationFrameCallback; | 41 class RequestAnimationFrameCallback; |
43 | 42 |
44 class ScriptedAnimationController : public RefCountedWillBeGarbageCollectedFinal
ized<ScriptedAnimationController> { | 43 class ScriptedAnimationController : public RefCountedWillBeGarbageCollectedFinal
ized<ScriptedAnimationController> { |
45 public: | 44 public: |
46 static PassRefPtrWillBeRawPtr<ScriptedAnimationController> create(Document*
document) | 45 static PassRefPtrWillBeRawPtr<ScriptedAnimationController> create(Document*
document) |
47 { | 46 { |
48 return adoptRefWillBeNoop(new ScriptedAnimationController(document)); | 47 return adoptRefWillBeNoop(new ScriptedAnimationController(document)); |
49 } | 48 } |
50 ~ScriptedAnimationController(); | 49 ~ScriptedAnimationController(); |
51 void trace(Visitor*); | 50 void trace(Visitor*); |
52 void clearDocumentPointer() { m_document = nullptr; } | 51 void clearDocumentPointer() { m_document = nullptr; } |
53 | 52 |
54 typedef int CallbackId; | 53 typedef int CallbackId; |
55 | 54 |
56 int registerCallback(PassOwnPtr<RequestAnimationFrameCallback>); | 55 int registerCallback(PassOwnPtr<RequestAnimationFrameCallback>); |
57 void cancelCallback(CallbackId); | 56 void cancelCallback(CallbackId); |
58 void serviceScriptedAnimations(double monotonicTimeNow); | 57 void serviceScriptedAnimations(double monotonicTimeNow); |
59 | 58 |
60 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 59 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
61 void enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Event>); | 60 void enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Event>); |
62 void enqueueMediaQueryChangeListeners(WillBeHeapVector<RefPtrWillBeMember<Me
diaQueryListListener> >&); | |
63 | 61 |
64 void suspend(); | 62 void suspend(); |
65 void resume(); | 63 void resume(); |
66 | 64 |
67 private: | 65 private: |
68 explicit ScriptedAnimationController(Document*); | 66 explicit ScriptedAnimationController(Document*); |
69 | 67 |
70 void scheduleAnimationIfNeeded(); | 68 void scheduleAnimationIfNeeded(); |
71 | 69 |
72 void dispatchEvents(); | 70 void dispatchEvents(); |
73 void executeCallbacks(double monotonicTimeNow); | 71 void executeCallbacks(double monotonicTimeNow); |
74 void callMediaQueryListListeners(); | |
75 | 72 |
76 typedef Vector<OwnPtr<RequestAnimationFrameCallback> > CallbackList; | 73 typedef Vector<OwnPtr<RequestAnimationFrameCallback> > CallbackList; |
77 CallbackList m_callbacks; | 74 CallbackList m_callbacks; |
78 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall
backs | 75 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall
backs |
79 | 76 |
80 RawPtrWillBeMember<Document> m_document; | 77 RawPtrWillBeMember<Document> m_document; |
81 CallbackId m_nextCallbackId; | 78 CallbackId m_nextCallbackId; |
82 int m_suspendCount; | 79 int m_suspendCount; |
83 WillBeHeapVector<RefPtrWillBeMember<Event> > m_eventQueue; | 80 WillBeHeapVector<RefPtrWillBeMember<Event> > m_eventQueue; |
84 WillBeHeapListHashSet<std::pair<RawPtrWillBeMember<const EventTarget>, const
StringImpl*> > m_perFrameEvents; | 81 WillBeHeapListHashSet<std::pair<RawPtrWillBeMember<const EventTarget>, const
StringImpl*> > m_perFrameEvents; |
85 typedef WillBeHeapListHashSet<RefPtrWillBeMember<MediaQueryListListener> > M
ediaQueryListListeners; | |
86 MediaQueryListListeners m_mediaQueryListListeners; | |
87 }; | 82 }; |
88 | 83 |
89 } | 84 } |
90 | 85 |
91 #endif // ScriptedAnimationController_h | 86 #endif // ScriptedAnimationController_h |
OLD | NEW |