| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef AnimationClock_h | 31 #ifndef AnimationClock_h |
| 32 #define AnimationClock_h | 32 #define AnimationClock_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "wtf/Allocator.h" |
| 35 #include "wtf/CurrentTime.h" | 36 #include "wtf/CurrentTime.h" |
| 36 #include "wtf/Noncopyable.h" | 37 #include "wtf/Noncopyable.h" |
| 37 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 38 #include <limits> | 39 #include <limits> |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 class CORE_EXPORT AnimationClock { | 43 class CORE_EXPORT AnimationClock { |
| 44 DISALLOW_ALLOCATION(); |
| 43 WTF_MAKE_NONCOPYABLE(AnimationClock); | 45 WTF_MAKE_NONCOPYABLE(AnimationClock); |
| 44 public: | 46 public: |
| 45 explicit AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime = WTF:
:monotonicallyIncreasingTime) | 47 explicit AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime = WTF:
:monotonicallyIncreasingTime) |
| 46 : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime) | 48 : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime) |
| 47 , m_time(0) | 49 , m_time(0) |
| 48 , m_currentTask(std::numeric_limits<unsigned>::max()) | 50 , m_currentTask(std::numeric_limits<unsigned>::max()) |
| 49 { | 51 { |
| 50 } | 52 } |
| 51 | 53 |
| 52 void updateTime(double time); | 54 void updateTime(double time); |
| 53 double currentTime(); | 55 double currentTime(); |
| 54 void resetTimeForTesting(double time = 0); | 56 void resetTimeForTesting(double time = 0); |
| 55 | 57 |
| 56 static void notifyTaskStart() { ++s_currentTask; } | 58 static void notifyTaskStart() { ++s_currentTask; } |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 WTF::TimeFunction m_monotonicallyIncreasingTime; | 61 WTF::TimeFunction m_monotonicallyIncreasingTime; |
| 60 double m_time; | 62 double m_time; |
| 61 unsigned m_currentTask; | 63 unsigned m_currentTask; |
| 62 static unsigned s_currentTask; | 64 static unsigned s_currentTask; |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 } // namespace blink | 67 } // namespace blink |
| 66 | 68 |
| 67 #endif // AnimationClock_h | 69 #endif // AnimationClock_h |
| OLD | NEW |