Index: Source/core/animation/AnimationClock.h |
diff --git a/Source/core/animation/AnimationClock.h b/Source/core/animation/AnimationClock.h |
index b5bb0d9adc6b5e13f1351019755fac8e21661591..540dfbeb2ebd126188b648a079d5a337dfb46ee1 100644 |
--- a/Source/core/animation/AnimationClock.h |
+++ b/Source/core/animation/AnimationClock.h |
@@ -32,33 +32,39 @@ |
#define AnimationClock_h |
#include "wtf/CurrentTime.h" |
-#include "wtf/Noncopyable.h" |
#include "wtf/PassOwnPtr.h" |
-#include <limits> |
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 |