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

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

Issue 23874019: Web Animations CSS: Start running animations on the compositor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and rename hasActiveAnimationOnCompositor to hasActiveAnimationsOnCompositor Created 7 years, 1 month 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/TimedItem.h » ('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 92c7cf4ca491e513fae3cdfbcca78171125c9071..881195feef92c3f64d23b6db5c634190c01005bc 100644
--- a/Source/core/animation/Player.cpp
+++ b/Source/core/animation/Player.cpp
@@ -32,6 +32,7 @@
#include "config.h"
#include "core/animation/Player.h"
+#include "core/animation/Animation.h"
#include "core/animation/DocumentTimeline.h"
#include "core/animation/TimedItem.h"
@@ -82,6 +83,30 @@ double Player::currentTimeBeforeDrift() const
return (effectiveTime(m_timeline.currentTime()) - startTime()) * m_playbackRate;
}
+bool Player::maybeStartAnimationOnCompositor()
+{
+ // FIXME: Support starting compositor animations that have a fixed
+ // start time.
+ ASSERT(!hasStartTime());
+ if (!m_content || !m_content->isAnimation())
+ return false;
+
+ return toAnimation(m_content.get())->maybeStartAnimationOnCompositor();
+}
+
+bool Player::hasActiveAnimationsOnCompositor()
+{
+ if (!m_content || !m_content->isAnimation())
+ return false;
+ return toAnimation(m_content.get())->hasActiveAnimationsOnCompositor();
+}
+
+void Player::cancelAnimationOnCompositor()
+{
+ if (hasActiveAnimationsOnCompositor())
+ toAnimation(m_content.get())->cancelAnimationOnCompositor();
+}
+
double Player::pausedTimeDrift() const
{
ASSERT(pausedInternal());
@@ -139,7 +164,9 @@ void Player::setCurrentTime(double seekTime)
void Player::pauseForTesting()
{
- ASSERT(!paused());
+ // FIXME: Need to support pausing compositor animations to pass virtual/threaded tests.
+ RELEASE_ASSERT(!hasActiveAnimationsOnCompositor());
+ RELEASE_ASSERT(!paused());
m_isPausedForTesting = true;
setPausedImpl(true);
}
@@ -155,9 +182,11 @@ void Player::setPausedImpl(bool newValue)
if (pausedInternal() == newValue)
return;
- if (newValue)
+ if (newValue) {
+ // FIXME: resume compositor animation rather than pull back to main-thread
+ cancelAnimationOnCompositor();
m_pauseStartTime = currentTime();
- else {
+ } else {
m_timeDrift = pausedTimeDrift();
m_pauseStartTime = nullValue();
}
« no previous file with comments | « Source/core/animation/Player.h ('k') | Source/core/animation/TimedItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698