| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 void setZeroTime(double); | 79 void setZeroTime(double); |
| 80 bool hasStarted() const { return !isNull(m_zeroTime); } | 80 bool hasStarted() const { return !isNull(m_zeroTime); } |
| 81 double zeroTime() const { return m_zeroTime; } | 81 double zeroTime() const { return m_zeroTime; } |
| 82 double currentTime(); | 82 double currentTime(); |
| 83 void pauseAnimationsForTesting(double); | 83 void pauseAnimationsForTesting(double); |
| 84 size_t numberOfActiveAnimationsForTesting() const; | 84 size_t numberOfActiveAnimationsForTesting() const; |
| 85 | 85 |
| 86 void setOutdatedPlayer(Player*); | 86 void setOutdatedPlayer(Player*); |
| 87 bool hasOutdatedPlayer() const { return m_hasOutdatedPlayer; } | 87 bool hasOutdatedPlayer() const { return m_hasOutdatedPlayer; } |
| 88 | 88 |
| 89 void addEventToDispatch(EventTarget* target, PassRefPtr<Event> event) | |
| 90 { | |
| 91 m_events.append(EventToDispatch(target, event)); | |
| 92 } | |
| 93 | |
| 94 void dispatchEvents(); | |
| 95 void dispatchEventsAsync(); | |
| 96 | |
| 97 void detachFromDocument(); | 89 void detachFromDocument(); |
| 98 | 90 |
| 99 protected: | 91 protected: |
| 100 DocumentTimeline(Document*, PassOwnPtr<PlatformTiming>); | 92 DocumentTimeline(Document*, PassOwnPtr<PlatformTiming>); |
| 101 | 93 |
| 102 private: | 94 private: |
| 103 double m_zeroTime; | 95 double m_zeroTime; |
| 104 Document* m_document; | 96 Document* m_document; |
| 105 Timer<DocumentTimeline> m_eventDistpachTimer; | |
| 106 // Players which will be updated on the next frame | 97 // Players which will be updated on the next frame |
| 107 // i.e. current, in effect, or had timing changed | 98 // i.e. current, in effect, or had timing changed |
| 108 HashSet<RefPtr<Player> > m_playersNeedingUpdate; | 99 HashSet<RefPtr<Player> > m_playersNeedingUpdate; |
| 109 HashSet<Player*> m_players; | 100 HashSet<Player*> m_players; |
| 110 bool m_hasOutdatedPlayer; | 101 bool m_hasOutdatedPlayer; |
| 111 | 102 |
| 112 void eventDispatchTimerFired(Timer<DocumentTimeline>*); | |
| 113 void wake(); | 103 void wake(); |
| 114 | 104 |
| 115 struct EventToDispatch { | |
| 116 EventToDispatch(EventTarget* target, PassRefPtr<Event> event) | |
| 117 : target(target) | |
| 118 , event(event) | |
| 119 { | |
| 120 } | |
| 121 RefPtr<EventTarget> target; | |
| 122 RefPtr<Event> event; | |
| 123 }; | |
| 124 Vector<EventToDispatch> m_events; | |
| 125 | |
| 126 static const double s_minimumDelay; | 105 static const double s_minimumDelay; |
| 127 | 106 |
| 128 OwnPtr<PlatformTiming> m_timing; | 107 OwnPtr<PlatformTiming> m_timing; |
| 129 | 108 |
| 130 class DocumentTimelineTiming FINAL : public PlatformTiming { | 109 class DocumentTimelineTiming FINAL : public PlatformTiming { |
| 131 public: | 110 public: |
| 132 DocumentTimelineTiming(DocumentTimeline* documentTimeline) | 111 DocumentTimelineTiming(DocumentTimeline* documentTimeline) |
| 133 : m_timeline(documentTimeline) | 112 : m_timeline(documentTimeline) |
| 134 , m_timer(this, &DocumentTimelineTiming::timerFired) | 113 , m_timer(this, &DocumentTimelineTiming::timerFired) |
| 135 { | 114 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 147 Timer<DocumentTimelineTiming> m_timer; | 126 Timer<DocumentTimelineTiming> m_timer; |
| 148 | 127 |
| 149 }; | 128 }; |
| 150 | 129 |
| 151 friend class AnimationDocumentTimelineTest; | 130 friend class AnimationDocumentTimelineTest; |
| 152 }; | 131 }; |
| 153 | 132 |
| 154 } // namespace | 133 } // namespace |
| 155 | 134 |
| 156 #endif | 135 #endif |
| OLD | NEW |