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