diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/animation/AnimationClock.h')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/animation/AnimationClock.h | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/chromium/third_party/WebKit/Source/core/animation/AnimationClock.h b/chromium/third_party/WebKit/Source/core/animation/AnimationClock.h index f6a2cdb8499..b5bb0d9adc6 100644 --- a/chromium/third_party/WebKit/Source/core/animation/AnimationClock.h +++ b/chromium/third_party/WebKit/Source/core/animation/AnimationClock.h @@ -32,45 +32,33 @@ #define AnimationClock_h #include "wtf/CurrentTime.h" +#include "wtf/Noncopyable.h" #include "wtf/PassOwnPtr.h" +#include <limits> namespace WebCore { class AnimationClock { + WTF_MAKE_NONCOPYABLE(AnimationClock); public: - static PassOwnPtr<AnimationClock> create(WTF::TimeFunction monotonicallyIncreasingTime = WTF::monotonicallyIncreasingTime) - { - return adoptPtr(new AnimationClock(monotonicallyIncreasingTime)); - } - - void updateTime(double time) - { - if (time > m_time) - m_time = time; - m_frozen = true; - } - - double currentTime() + explicit AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime = WTF::monotonicallyIncreasingTime) + : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime) + , m_time(0) + , m_currentTask(std::numeric_limits<unsigned>::max()) { - if (!m_frozen) - updateTime(m_monotonicallyIncreasingTime()); - return m_time; } - void unfreeze() { m_frozen = false; } + void updateTime(double time); + double currentTime(); + void resetTimeForTesting(); - void resetTimeForTesting() { m_time = 0; m_frozen = true; } + static void notifyTaskStart() { ++s_currentTask; } private: - AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime) - : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime) - , m_time(0) - , m_frozen(false) - { - } WTF::TimeFunction m_monotonicallyIncreasingTime; double m_time; - bool m_frozen; + unsigned m_currentTask; + static unsigned s_currentTask; }; } // namespace WebCore |