};
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)
{
}
void dispatchEvents();
+ void dispatchEventsAsync();
+
+ void detachFromDocument();
protected:
DocumentTimeline(Document*, PassOwnPtr<PlatformTiming>);
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 {
OwnPtr<PlatformTiming> m_timing;
- class DocumentTimelineTiming : public PlatformTiming {
+ class DocumentTimelineTiming FINAL : public PlatformTiming {
public:
DocumentTimelineTiming(DocumentTimeline* documentTimeline)
: m_timeline(documentTimeline)
};
- friend class CoreAnimationDocumentTimelineTest;
+ friend class AnimationDocumentTimelineTest;
};
} // namespace