OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, 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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #include <math.h> | 33 #include <math.h> |
34 #include "platform/wtf/CurrentTime.h" | 34 #include "platform/wtf/CurrentTime.h" |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 // FIXME: This is an approximation of time between frames, used when | 38 // FIXME: This is an approximation of time between frames, used when |
39 // ticking the animation clock outside of animation frame callbacks. | 39 // ticking the animation clock outside of animation frame callbacks. |
40 // Ideally this would be generated by the compositor. | 40 // Ideally this would be generated by the compositor. |
41 const double approximateFrameTime = 1 / 60.0; | 41 const double approximateFrameTime = 1 / 60.0; |
42 } | 42 } // namespace |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 unsigned AnimationClock::currently_running_task_ = 0; | 46 unsigned AnimationClock::currently_running_task_ = 0; |
47 | 47 |
48 void AnimationClock::UpdateTime(double time) { | 48 void AnimationClock::UpdateTime(double time) { |
49 if (time > time_) | 49 if (time > time_) |
50 time_ = time; | 50 time_ = time; |
51 task_for_which_time_was_calculated_ = currently_running_task_; | 51 task_for_which_time_was_calculated_ = currently_running_task_; |
52 } | 52 } |
(...skipping 18 matching lines...) Expand all Loading... |
71 return time_; | 71 return time_; |
72 } | 72 } |
73 | 73 |
74 void AnimationClock::ResetTimeForTesting(double time) { | 74 void AnimationClock::ResetTimeForTesting(double time) { |
75 time_ = time; | 75 time_ = time; |
76 task_for_which_time_was_calculated_ = 0; | 76 task_for_which_time_was_calculated_ = 0; |
77 currently_running_task_ = 0; | 77 currently_running_task_ = 0; |
78 } | 78 } |
79 | 79 |
80 } // namespace blink | 80 } // namespace blink |
OLD | NEW |