summaryrefslogtreecommitdiff
path: root/Source/core/animation/AnimationClock.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/core/animation/AnimationClock.h')
-rw-r--r--Source/core/animation/AnimationClock.h30
1 files changed, 18 insertions, 12 deletions
diff --git a/Source/core/animation/AnimationClock.h b/Source/core/animation/AnimationClock.h
index e5a3bdbff..540dfbeb2 100644
--- a/Source/core/animation/AnimationClock.h
+++ b/Source/core/animation/AnimationClock.h
@@ -31,34 +31,40 @@
#ifndef AnimationClock_h
#define AnimationClock_h
-#include <limits>
#include "wtf/CurrentTime.h"
#include "wtf/PassOwnPtr.h"
-#include "wtf/Noncopyable.h"
namespace WebCore {
+// FIXME: This value is used to suppress updates when time is required outside of a frame.
+// The purpose of allowing the clock to update during such periods is to allow animations
+// to have an appropriate start time and for getComputedStyle to attempt to catch-up to a
+// compositor animation. However a more accurate system might be to attempt to phase-lock
+// with the frame clock.
+const double minTimeBeforeUnsynchronizedAnimationClockTick = 0.005;
+
class AnimationClock {
- WTF_MAKE_NONCOPYABLE(AnimationClock);
public:
- explicit AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime = WTF::monotonicallyIncreasingTime)
- : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime)
- , m_time(0)
- , m_currentTask(std::numeric_limits<unsigned>::max())
+ static PassOwnPtr<AnimationClock> create(WTF::TimeFunction monotonicallyIncreasingTime = WTF::monotonicallyIncreasingTime)
{
+ return adoptPtr(new AnimationClock(monotonicallyIncreasingTime));
}
void updateTime(double time);
double currentTime();
- void resetTimeForTesting();
-
- static void notifyTaskStart() { ++s_currentTask; }
+ void unfreeze() { m_frozen = false; }
+ void resetTimeForTesting() { m_time = 0; m_frozen = true; }
private:
+ AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime)
+ : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime)
+ , m_time(0)
+ , m_frozen(false)
+ {
+ }
WTF::TimeFunction m_monotonicallyIncreasingTime;
double m_time;
- unsigned m_currentTask;
- static unsigned s_currentTask;
+ bool m_frozen;
};
} // namespace WebCore