| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
| 36 #include "wtf/CurrentTime.h" | 36 #include "wtf/CurrentTime.h" |
| 37 #include "wtf/Noncopyable.h" | 37 #include "wtf/Noncopyable.h" |
| 38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 39 #include <limits> | 39 #include <limits> |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class CORE_EXPORT AnimationClock { | 43 class CORE_EXPORT AnimationClock { |
| 44 DISALLOW_ALLOCATION(); | 44 DISALLOW_NEW(); |
| 45 WTF_MAKE_NONCOPYABLE(AnimationClock); | 45 WTF_MAKE_NONCOPYABLE(AnimationClock); |
| 46 public: | 46 public: |
| 47 explicit AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime = WTF:
:monotonicallyIncreasingTime) | 47 explicit AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime = WTF:
:monotonicallyIncreasingTime) |
| 48 : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime) | 48 : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime) |
| 49 , m_time(0) | 49 , m_time(0) |
| 50 , m_currentTask(std::numeric_limits<unsigned>::max()) | 50 , m_currentTask(std::numeric_limits<unsigned>::max()) |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 void updateTime(double time); | 54 void updateTime(double time); |
| 55 double currentTime(); | 55 double currentTime(); |
| 56 void resetTimeForTesting(double time = 0); | 56 void resetTimeForTesting(double time = 0); |
| 57 | 57 |
| 58 static void notifyTaskStart() { ++s_currentTask; } | 58 static void notifyTaskStart() { ++s_currentTask; } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 WTF::TimeFunction m_monotonicallyIncreasingTime; | 61 WTF::TimeFunction m_monotonicallyIncreasingTime; |
| 62 double m_time; | 62 double m_time; |
| 63 unsigned m_currentTask; | 63 unsigned m_currentTask; |
| 64 static unsigned s_currentTask; | 64 static unsigned s_currentTask; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace blink | 67 } // namespace blink |
| 68 | 68 |
| 69 #endif // AnimationClock_h | 69 #endif // AnimationClock_h |
| OLD | NEW |