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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // This should only be used for CSS | 90 // This should only be used for CSS |
91 void unpause(); | 91 void unpause(); |
92 | 92 |
93 void setOutdated(); | 93 void setOutdated(); |
94 bool outdated() { return m_outdated; } | 94 bool outdated() { return m_outdated; } |
95 | 95 |
96 bool maybeStartAnimationOnCompositor(); | 96 bool maybeStartAnimationOnCompositor(); |
97 void cancelAnimationOnCompositor(); | 97 void cancelAnimationOnCompositor(); |
98 bool hasActiveAnimationsOnCompositor(); | 98 bool hasActiveAnimationsOnCompositor(); |
99 | 99 |
100 static bool hasLowerPriority(AnimationPlayer*, AnimationPlayer*); | 100 class SortInfo { |
| 101 public: |
| 102 friend class AnimationPlayer; |
| 103 bool operator<(const SortInfo& other) const; |
| 104 private: |
| 105 SortInfo(unsigned sequenceNumber, double startTime) |
| 106 : m_sequenceNumber(sequenceNumber) |
| 107 , m_startTime(startTime) |
| 108 { } |
| 109 unsigned m_sequenceNumber; |
| 110 double m_startTime; |
| 111 }; |
| 112 |
| 113 const SortInfo& sortInfo() const { return m_sortInfo; } |
| 114 |
| 115 static bool hasLowerPriority(AnimationPlayer* player1, AnimationPlayer* play
er2) |
| 116 { |
| 117 return player1->sortInfo() < player2->sortInfo(); |
| 118 } |
101 | 119 |
102 private: | 120 private: |
103 AnimationPlayer(DocumentTimeline&, TimedItem*); | 121 AnimationPlayer(DocumentTimeline&, TimedItem*); |
104 double sourceEnd() const; | 122 double sourceEnd() const; |
105 bool limited(double currentTime) const; | 123 bool limited(double currentTime) const; |
106 double currentTimeWithoutLag() const; | 124 double currentTimeWithoutLag() const; |
107 double currentTimeWithLag() const; | 125 double currentTimeWithLag() const; |
108 void updateTimingState(double newCurrentTime); | 126 void updateTimingState(double newCurrentTime); |
109 void updateCurrentTimingState(); | 127 void updateCurrentTimingState(); |
110 | 128 |
111 double m_playbackRate; | 129 double m_playbackRate; |
112 double m_startTime; | 130 double m_startTime; |
113 double m_holdTime; | 131 double m_holdTime; |
114 double m_storedTimeLag; | 132 double m_storedTimeLag; |
115 | 133 |
| 134 SortInfo m_sortInfo; |
| 135 |
116 RefPtr<TimedItem> m_content; | 136 RefPtr<TimedItem> m_content; |
117 // FIXME: We should keep the timeline alive and have this as non-null | 137 // FIXME: We should keep the timeline alive and have this as non-null |
118 // but this is tricky to do without Oilpan | 138 // but this is tricky to do without Oilpan |
119 DocumentTimeline* m_timeline; | 139 DocumentTimeline* m_timeline; |
120 // Reflects all pausing, including via pauseForTesting(). | 140 // Reflects all pausing, including via pauseForTesting(). |
121 bool m_paused; | 141 bool m_paused; |
122 bool m_held; | 142 bool m_held; |
123 bool m_isPausedForTesting; | 143 bool m_isPausedForTesting; |
124 | 144 |
125 // This indicates timing information relevant to the player has changed by | 145 // This indicates timing information relevant to the player has changed by |
126 // means other than the ordinary progression of time | 146 // means other than the ordinary progression of time |
127 bool m_outdated; | 147 bool m_outdated; |
128 | |
129 unsigned m_sequenceNumber; | |
130 }; | 148 }; |
131 | 149 |
132 } // namespace | 150 } // namespace |
133 | 151 |
134 #endif | 152 #endif |
OLD | NEW |