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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 96 |
97 double timeToNextEffect = std::numeric_limits<double>::infinity(); | 97 double timeToNextEffect = std::numeric_limits<double>::infinity(); |
98 Vector<Player*> playersToRemove; | 98 Vector<Player*> players; |
99 for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin();
it != m_playersNeedingUpdate.end(); ++it) { | 99 for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin();
it != m_playersNeedingUpdate.end(); ++it) |
100 Player* player = it->get(); | 100 players.append(it->get()); |
101 if (!player->update()) | 101 |
102 playersToRemove.append(player); | 102 std::sort(players.begin(), players.end(), Player::hasLowerPriority); |
103 timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange
()); | 103 |
| 104 for (size_t i = 0; i < players.size(); ++i) { |
| 105 Player* player = players[i]; |
| 106 if (player->update()) |
| 107 timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectCh
ange()); |
| 108 else |
| 109 m_playersNeedingUpdate.remove(player); |
104 } | 110 } |
105 for (size_t i = 0; i < playersToRemove.size(); ++i) | |
106 m_playersNeedingUpdate.remove(playersToRemove[i]); | |
107 | 111 |
108 ASSERT(!m_playersNeedingUpdate.isEmpty() || timeToNextEffect == std::numeric
_limits<double>::infinity()); | 112 ASSERT(!m_playersNeedingUpdate.isEmpty() || timeToNextEffect == std::numeric
_limits<double>::infinity()); |
109 if (timeToNextEffect < s_minimumDelay) | 113 if (timeToNextEffect < s_minimumDelay) |
110 m_timing->serviceOnNextFrame(); | 114 m_timing->serviceOnNextFrame(); |
111 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) | 115 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) |
112 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); | 116 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); |
113 | 117 |
114 m_hasOutdatedPlayer = false; | 118 m_hasOutdatedPlayer = false; |
115 } | 119 } |
116 | 120 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff
ect())); | 179 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff
ect())); |
176 } | 180 } |
177 return count; | 181 return count; |
178 } | 182 } |
179 | 183 |
180 void DocumentTimeline::detachFromDocument() { | 184 void DocumentTimeline::detachFromDocument() { |
181 m_document = 0; | 185 m_document = 0; |
182 } | 186 } |
183 | 187 |
184 } // namespace | 188 } // namespace |
OLD | NEW |