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

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

Issue 299723002: Revert of Web Animations: Timeline should not advance during task execution (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/AnimationClock.h ('k') | Source/core/animation/AnimationClockTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimationClock.cpp
diff --git a/Source/core/animation/AnimationClock.cpp b/Source/core/animation/AnimationClock.cpp
index e9018afca4ddb38ebe1704f8e964d297a9b5e1c1..649220690e67a27adf18592ac5d9a46d000c9ff2 100644
--- a/Source/core/animation/AnimationClock.cpp
+++ b/Source/core/animation/AnimationClock.cpp
@@ -31,52 +31,23 @@
#include "config.h"
#include "core/animation/AnimationClock.h"
-#include "wtf/CurrentTime.h"
-#include <math.h>
-
-namespace {
-
-// FIXME: This is an approximation of time between frames, used when
-// ticking the animation clock outside of animation frame callbacks.
-// Ideally this would be generated by the compositor.
-const double approximateFrameTime = 1 / 60.0;
-
-}
-
namespace WebCore {
-
-unsigned AnimationClock::s_currentTask = 0;
void AnimationClock::updateTime(double time)
{
if (time > m_time)
m_time = time;
- m_currentTask = s_currentTask;
+ m_frozen = true;
}
double AnimationClock::currentTime()
{
- if (m_currentTask != s_currentTask) {
- const double currentTime = m_monotonicallyIncreasingTime();
- if (m_time < currentTime) {
- // Advance to the first estimated frame after the current time.
- const double frameShift = fmod(currentTime - m_time, approximateFrameTime);
- const double newTime = currentTime + approximateFrameTime - frameShift;
- ASSERT(newTime > currentTime);
- ASSERT(newTime <= currentTime + approximateFrameTime);
- updateTime(newTime);
- } else {
- m_currentTask = s_currentTask;
- }
+ if (!m_frozen) {
+ double newTime = m_monotonicallyIncreasingTime();
+ if (newTime >= m_time + minTimeBeforeUnsynchronizedAnimationClockTick)
+ m_time = newTime;
}
return m_time;
}
-void AnimationClock::resetTimeForTesting()
-{
- m_time = 0;
- m_currentTask = 0;
- s_currentTask = 0;
}
-
-}
« no previous file with comments | « Source/core/animation/AnimationClock.h ('k') | Source/core/animation/AnimationClockTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698