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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void DocumentTimeline::wake() | 86 void DocumentTimeline::wake() |
87 { | 87 { |
88 m_timing->serviceOnNextFrame(); | 88 m_timing->serviceOnNextFrame(); |
89 } | 89 } |
90 | 90 |
91 void DocumentTimeline::serviceAnimations() | 91 void DocumentTimeline::serviceAnimations() |
92 { | 92 { |
93 TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations"); | 93 TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations"); |
94 | 94 |
95 m_timing->cancelWake(); | 95 m_timing->cancelWake(); |
| 96 m_hasOutdatedPlayer = false; |
96 | 97 |
97 double timeToNextEffect = std::numeric_limits<double>::infinity(); | 98 double timeToNextEffect = std::numeric_limits<double>::infinity(); |
98 Vector<Player*> playersToRemove; | 99 Vector<Player*> playersToRemove; |
99 for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin();
it != m_playersNeedingUpdate.end(); ++it) { | 100 for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin();
it != m_playersNeedingUpdate.end(); ++it) { |
100 Player* player = it->get(); | 101 Player* player = it->get(); |
101 if (!player->update()) | 102 if (!player->update()) |
102 playersToRemove.append(player); | 103 playersToRemove.append(player); |
103 timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange
()); | 104 timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange
()); |
104 } | 105 } |
105 for (size_t i = 0; i < playersToRemove.size(); ++i) | 106 for (size_t i = 0; i < playersToRemove.size(); ++i) |
106 m_playersNeedingUpdate.remove(playersToRemove[i]); | 107 m_playersNeedingUpdate.remove(playersToRemove[i]); |
107 | 108 |
108 ASSERT(!m_playersNeedingUpdate.isEmpty() || timeToNextEffect == std::numeric
_limits<double>::infinity()); | 109 ASSERT(!m_playersNeedingUpdate.isEmpty() || timeToNextEffect == std::numeric
_limits<double>::infinity()); |
109 if (timeToNextEffect < s_minimumDelay) | 110 if (timeToNextEffect < s_minimumDelay) |
110 m_timing->serviceOnNextFrame(); | 111 m_timing->serviceOnNextFrame(); |
111 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) | 112 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) |
112 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); | 113 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); |
113 | 114 |
114 m_hasOutdatedPlayer = false; | 115 ASSERT(!m_hasOutdatedPlayer); |
115 } | 116 } |
116 | 117 |
117 void DocumentTimeline::setZeroTime(double zeroTime) | 118 void DocumentTimeline::setZeroTime(double zeroTime) |
118 { | 119 { |
119 ASSERT(isNull(m_zeroTime)); | 120 ASSERT(isNull(m_zeroTime)); |
120 m_zeroTime = zeroTime; | 121 m_zeroTime = zeroTime; |
121 ASSERT(!isNull(m_zeroTime)); | 122 ASSERT(!isNull(m_zeroTime)); |
122 serviceAnimations(); | 123 serviceAnimations(); |
123 } | 124 } |
124 | 125 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff
ect())); | 176 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff
ect())); |
176 } | 177 } |
177 return count; | 178 return count; |
178 } | 179 } |
179 | 180 |
180 void DocumentTimeline::detachFromDocument() { | 181 void DocumentTimeline::detachFromDocument() { |
181 m_document = 0; | 182 m_document = 0; |
182 } | 183 } |
183 | 184 |
184 } // namespace | 185 } // namespace |
OLD | NEW |