Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / animation / DocumentTimeline.h
index e48536e..c334bd6 100644 (file)
@@ -60,15 +60,32 @@ public:
     };
 
     static PassRefPtr<DocumentTimeline> create(Document*, PassOwnPtr<PlatformTiming> = nullptr);
+    ~DocumentTimeline();
     // Returns whether style recalc was triggered.
     bool serviceAnimations();
-    PassRefPtr<Player> play(TimedItem*);
+
+    // Creates a player attached to this timeline, but without a start time.
+    Player* createPlayer(TimedItem*);
+    Player* play(TimedItem*);
+
+    void playerDestroyed(Player* player)
+    {
+        ASSERT(m_players.contains(player));
+        m_players.remove(player);
+    }
+
     // Called from setReadyState() in Document.cpp to set m_zeroTime to
     // performance.timing.domInteractive
     void setZeroTime(double);
+    bool hasStarted() const { return !isNull(m_zeroTime); }
+    double zeroTime() const { return m_zeroTime; }
     double currentTime();
     void pauseAnimationsForTesting(double);
     size_t numberOfActiveAnimationsForTesting() const;
+    const Vector<RefPtr<Player> >& currentPlayers() const { return m_currentPlayers; }
+
+    void setHasPlayerNeedingUpdate();
+    bool hasPlayerNeedingUpdate() const { return m_hasPlayerNeedingUpdate; }
 
     void addEventToDispatch(EventTarget* target, PassRefPtr<Event> event)
     {
@@ -76,6 +93,9 @@ public:
     }
 
     void dispatchEvents();
+    void dispatchEventsAsync();
+
+    void detachFromDocument();
 
 protected:
     DocumentTimeline(Document*, PassOwnPtr<PlatformTiming>);
@@ -83,8 +103,12 @@ protected:
 private:
     double m_zeroTime;
     Document* m_document;
-    Vector<RefPtr<Player> > m_players;
+    Timer<DocumentTimeline> m_eventDistpachTimer;
+    Vector<RefPtr<Player> > m_currentPlayers;
+    HashSet<Player*> m_players;
+    bool m_hasPlayerNeedingUpdate;
 
+    void eventDispatchTimerFired(Timer<DocumentTimeline>*);
     void wake();
 
     struct EventToDispatch {
@@ -102,7 +126,7 @@ private:
 
     OwnPtr<PlatformTiming> m_timing;
 
-    class DocumentTimelineTiming : public PlatformTiming {
+    class DocumentTimelineTiming FINAL : public PlatformTiming {
     public:
         DocumentTimelineTiming(DocumentTimeline* documentTimeline)
             : m_timeline(documentTimeline)
@@ -123,7 +147,7 @@ private:
 
     };
 
-    friend class CoreAnimationDocumentTimelineTest;
+    friend class AnimationDocumentTimelineTest;
 };
 
 } // namespace