Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: cc/base/time_util.h

Issue 719453007: Make Keyframe use TimeTicks/TimeDelta to represent time instead of double. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_BASE_TIME_UTIL_H_ 5 #ifndef CC_BASE_TIME_UTIL_H_
6 #define CC_BASE_TIME_UTIL_H_ 6 #define CC_BASE_TIME_UTIL_H_
7 7
8 namespace base { 8 namespace base {
9 class TimeDelta; 9 class TimeDelta;
10 } 10 }
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class CC_EXPORT TimeUtil { 14 class CC_EXPORT TimeUtil {
15 public: 15 public:
16 static base::TimeDelta Scale(base::TimeDelta time_delta, double value) { 16 static base::TimeDelta Scale(base::TimeDelta time_delta, double value) {
17 return base::TimeDelta::FromInternalValue(static_cast<int64>( 17 return base::TimeDelta::FromInternalValue(static_cast<int64>(
18 static_cast<double>(time_delta.ToInternalValue()) * value)); 18 static_cast<double>(time_delta.ToInternalValue()) * value));
19 } 19 }
20 20
21 static double Divide(base::TimeDelta dividend, base::TimeDelta divisor) {
22 return static_cast<double>(dividend.ToInternalValue()) /
23 static_cast<double>(divisor.ToInternalValue());
24 }
25
21 static base::TimeDelta Mod(base::TimeDelta dividend, 26 static base::TimeDelta Mod(base::TimeDelta dividend,
22 base::TimeDelta divisor) { 27 base::TimeDelta divisor) {
23 return base::TimeDelta::FromInternalValue(dividend.ToInternalValue() % 28 return base::TimeDelta::FromInternalValue(dividend.ToInternalValue() %
24 divisor.ToInternalValue()); 29 divisor.ToInternalValue());
25 } 30 }
26 }; 31 };
27 32
28 } // namespace cc 33 } // namespace cc
29 34
30 #endif // CC_BASE_TIME_UTIL_H_ 35 #endif // CC_BASE_TIME_UTIL_H_
OLDNEW
« no previous file with comments | « cc/animation/scroll_offset_animation_curve_unittest.cc ('k') | cc/blink/web_filter_animation_curve_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698