Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: Source/core/animation/DocumentTimeline.cpp

Issue 185593010: Web Animations: Sort Players in DocumentTimeline::serviceAnimations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add some braces Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/animation/Player.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/DocumentTimeline.cpp
diff --git a/Source/core/animation/DocumentTimeline.cpp b/Source/core/animation/DocumentTimeline.cpp
index 681d9ff382aa2d6f257a5958c0294b4e5f8780cf..a55c1eddf06da17db772b3d28ddc7a101c18d475 100644
--- a/Source/core/animation/DocumentTimeline.cpp
+++ b/Source/core/animation/DocumentTimeline.cpp
@@ -95,15 +95,19 @@ void DocumentTimeline::serviceAnimations()
m_timing->cancelWake();
double timeToNextEffect = std::numeric_limits<double>::infinity();
- Vector<Player*> playersToRemove;
- for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it) {
- Player* player = it->get();
- if (!player->update())
- playersToRemove.append(player);
- timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange());
+ Vector<Player*> players;
+ for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it)
+ players.append(it->get());
+
+ std::sort(players.begin(), players.end(), Player::hasLowerPriority);
+
+ for (size_t i = 0; i < players.size(); ++i) {
+ Player* player = players[i];
+ if (player->update())
+ timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange());
+ else
+ m_playersNeedingUpdate.remove(player);
}
- for (size_t i = 0; i < playersToRemove.size(); ++i)
- m_playersNeedingUpdate.remove(playersToRemove[i]);
ASSERT(!m_playersNeedingUpdate.isEmpty() || timeToNextEffect == std::numeric_limits<double>::infinity());
if (timeToNextEffect < s_minimumDelay)
« no previous file with comments | « no previous file | Source/core/animation/Player.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698