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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class Document; | 39 class Document; |
40 class Event; | 40 class Event; |
41 class EventTarget; | 41 class EventTarget; |
42 class FrameRequestCallback; | 42 class FrameRequestCallback; |
43 class MediaQueryListListener; | 43 class MediaQueryListListener; |
44 | 44 |
45 class CORE_EXPORT ScriptedAnimationController | 45 class CORE_EXPORT ScriptedAnimationController |
46 : public GarbageCollected<ScriptedAnimationController> { | 46 : public GarbageCollectedFinalized<ScriptedAnimationController> { |
47 public: | 47 public: |
48 static ScriptedAnimationController* create(Document* document) { | 48 static ScriptedAnimationController* create(Document* document) { |
49 return new ScriptedAnimationController(document); | 49 return new ScriptedAnimationController(document); |
50 } | 50 } |
51 | 51 |
52 DECLARE_TRACE(); | 52 DECLARE_TRACE(); |
53 void clearDocumentPointer() { m_document = nullptr; } | 53 void clearDocumentPointer() { m_document = nullptr; } |
54 | 54 |
55 typedef int CallbackId; | 55 typedef int CallbackId; |
56 | 56 |
57 int registerCallback(FrameRequestCallback*); | 57 int registerCallback(FrameRequestCallback*); |
58 void cancelCallback(CallbackId); | 58 void cancelCallback(CallbackId); |
59 void serviceScriptedAnimations(double monotonicTimeNow); | 59 void serviceScriptedAnimations(double monotonicTimeNow); |
60 | 60 |
| 61 void enqueueTask(std::unique_ptr<WTF::Closure>); |
61 void enqueueEvent(Event*); | 62 void enqueueEvent(Event*); |
62 void enqueuePerFrameEvent(Event*); | 63 void enqueuePerFrameEvent(Event*); |
63 void enqueueMediaQueryChangeListeners( | 64 void enqueueMediaQueryChangeListeners( |
64 HeapVector<Member<MediaQueryListListener>>&); | 65 HeapVector<Member<MediaQueryListListener>>&); |
65 | 66 |
66 void suspend(); | 67 void suspend(); |
67 void resume(); | 68 void resume(); |
68 | 69 |
69 void dispatchEventsAndCallbacksForPrinting(); | 70 void dispatchEventsAndCallbacksForPrinting(); |
70 | 71 |
71 private: | 72 private: |
72 explicit ScriptedAnimationController(Document*); | 73 explicit ScriptedAnimationController(Document*); |
73 | 74 |
74 void scheduleAnimationIfNeeded(); | 75 void scheduleAnimationIfNeeded(); |
75 | 76 |
| 77 void runTasks(); |
76 void dispatchEvents( | 78 void dispatchEvents( |
77 const AtomicString& eventInterfaceFilter = AtomicString()); | 79 const AtomicString& eventInterfaceFilter = AtomicString()); |
78 void executeCallbacks(double monotonicTimeNow); | 80 void executeCallbacks(double monotonicTimeNow); |
79 void callMediaQueryListListeners(); | 81 void callMediaQueryListListeners(); |
80 | 82 |
81 bool hasScheduledItems() const; | 83 bool hasScheduledItems() const; |
82 | 84 |
83 Member<Document> m_document; | 85 Member<Document> m_document; |
84 FrameRequestCallbackCollection m_callbackCollection; | 86 FrameRequestCallbackCollection m_callbackCollection; |
85 int m_suspendCount; | 87 int m_suspendCount; |
| 88 Vector<std::unique_ptr<WTF::Closure>> m_taskQueue; |
86 HeapVector<Member<Event>> m_eventQueue; | 89 HeapVector<Member<Event>> m_eventQueue; |
87 HeapListHashSet<std::pair<Member<const EventTarget>, const StringImpl*>> | 90 HeapListHashSet<std::pair<Member<const EventTarget>, const StringImpl*>> |
88 m_perFrameEvents; | 91 m_perFrameEvents; |
89 using MediaQueryListListeners = | 92 using MediaQueryListListeners = |
90 HeapListHashSet<Member<MediaQueryListListener>>; | 93 HeapListHashSet<Member<MediaQueryListListener>>; |
91 MediaQueryListListeners m_mediaQueryListListeners; | 94 MediaQueryListListeners m_mediaQueryListListeners; |
92 }; | 95 }; |
93 | 96 |
94 } // namespace blink | 97 } // namespace blink |
95 | 98 |
96 #endif // ScriptedAnimationController_h | 99 #endif // ScriptedAnimationController_h |
OLD | NEW |