| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 public: | 50 public: |
| 51 explicit AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime = | 51 explicit AnimationClock(WTF::TimeFunction monotonicallyIncreasingTime = |
| 52 WTF::monotonicallyIncreasingTime) | 52 WTF::monotonicallyIncreasingTime) |
| 53 : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime), | 53 : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime), |
| 54 m_time(0), | 54 m_time(0), |
| 55 m_taskForWhichTimeWasCalculated(std::numeric_limits<unsigned>::max()) {} | 55 m_taskForWhichTimeWasCalculated(std::numeric_limits<unsigned>::max()) {} |
| 56 | 56 |
| 57 void updateTime(double time); | 57 void updateTime(double time); |
| 58 double currentTime(); | 58 double currentTime(); |
| 59 void resetTimeForTesting(double time = 0); | 59 void resetTimeForTesting(double time = 0); |
| 60 void disableSyntheticTimeForTesting() { |
| 61 m_monotonicallyIncreasingTime = nullptr; |
| 62 } |
| 60 | 63 |
| 61 // notifyTaskStart should be called right before the main message loop starts | 64 // notifyTaskStart should be called right before the main message loop starts |
| 62 // to run the next task from the message queue. | 65 // to run the next task from the message queue. |
| 63 static void notifyTaskStart() { ++s_currentlyRunningTask; } | 66 static void notifyTaskStart() { ++s_currentlyRunningTask; } |
| 64 | 67 |
| 65 private: | 68 private: |
| 66 WTF::TimeFunction m_monotonicallyIncreasingTime; | 69 WTF::TimeFunction m_monotonicallyIncreasingTime; |
| 67 double m_time; | 70 double m_time; |
| 68 unsigned m_taskForWhichTimeWasCalculated; | 71 unsigned m_taskForWhichTimeWasCalculated; |
| 69 static unsigned s_currentlyRunningTask; | 72 static unsigned s_currentlyRunningTask; |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 } // namespace blink | 75 } // namespace blink |
| 73 | 76 |
| 74 #endif // AnimationClock_h | 77 #endif // AnimationClock_h |
| OLD | NEW |