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

Unified Diff: Source/core/animation/Player.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 | « Source/core/animation/Player.h ('k') | Source/core/animation/PlayerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/Player.cpp
diff --git a/Source/core/animation/Player.cpp b/Source/core/animation/Player.cpp
index 35d2ed0f64897830a8f405a392f7fef49229b9ac..2276e1cc39ae43652166e5ba55f816612b63ddd2 100644
--- a/Source/core/animation/Player.cpp
+++ b/Source/core/animation/Player.cpp
@@ -36,6 +36,16 @@
namespace WebCore {
+namespace {
+
+static unsigned nextSequenceNumber()
+{
+ static unsigned next = 0;
+ return ++next;
+}
+
+}
+
PassRefPtr<Player> Player::create(DocumentTimeline& timeline, TimedItem* content)
{
return adoptRef(new Player(timeline, content));
@@ -52,6 +62,7 @@ Player::Player(DocumentTimeline& timeline, TimedItem* content)
, m_held(false)
, m_isPausedForTesting(false)
, m_outdated(false)
+ , m_sequenceNumber(nextSequenceNumber())
{
if (m_content) {
if (m_content->player())
@@ -299,6 +310,17 @@ void Player::cancel()
m_content = nullptr;
}
+bool Player::hasLowerPriority(Player* player1, Player* player2)
+{
+ if (player1->m_startTime < player2->m_startTime)
+ return true;
+ if (player1->m_startTime > player2->m_startTime)
+ return false;
+ if (isNull(player1->m_startTime) != isNull(player2->m_startTime))
+ return isNull(player1->m_startTime);
+ return player1->m_sequenceNumber < player2->m_sequenceNumber;
+}
+
void Player::pauseForTesting(double pauseTime)
{
RELEASE_ASSERT(!paused());
« no previous file with comments | « Source/core/animation/Player.h ('k') | Source/core/animation/PlayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698