summaryrefslogtreecommitdiffstats
path: root/cc/base
diff options
context:
space:
mode:
authorbehara.ms <behara.ms@samsung.com>2014-11-11 21:09:08 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-12 05:09:29 +0000
commit71ff07f3e8b5d1861877cefc046bcea53125c7f7 (patch)
tree5663ad8b541bfa8669fa530ff43a683cfb5956df /cc/base
parentb70363420dbfe0825e96e3d025fb0bacb26ff2f4 (diff)
downloadchromium_src-71ff07f3e8b5d1861877cefc046bcea53125c7f7.zip
chromium_src-71ff07f3e8b5d1861877cefc046bcea53125c7f7.tar.gz
chromium_src-71ff07f3e8b5d1861877cefc046bcea53125c7f7.tar.bz2
Make cc::Animation::TrimTimeToCurrentIteration and
cc::AnimationCurve::Duration use TimeTicks/TimeDelta to represent time. This patch adds a new file time_util.h which adds new class TimeUtil. This TimeUtil class holds helper functions to operate on TimeDelta in double because base::TimeDelta class doesnot allow multiply/divide operations in double. Review URL: https://codereview.chromium.org/693883004 Cr-Commit-Position: refs/heads/master@{#303790}
Diffstat (limited to 'cc/base')
-rw-r--r--cc/base/time_util.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/cc/base/time_util.h b/cc/base/time_util.h
new file mode 100644
index 0000000..dc07e74
--- /dev/null
+++ b/cc/base/time_util.h
@@ -0,0 +1,30 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_BASE_TIME_UTIL_H_
+#define CC_BASE_TIME_UTIL_H_
+
+namespace base {
+class TimeDelta;
+}
+
+namespace cc {
+
+class CC_EXPORT TimeUtil {
+ public:
+ static base::TimeDelta Scale(base::TimeDelta time_delta, double value) {
+ return base::TimeDelta::FromInternalValue(static_cast<int64>(
+ static_cast<double>(time_delta.ToInternalValue()) * value));
+ }
+
+ static base::TimeDelta Mod(base::TimeDelta dividend,
+ base::TimeDelta divisor) {
+ return base::TimeDelta::FromInternalValue(dividend.ToInternalValue() %
+ divisor.ToInternalValue());
+ }
+};
+
+} // namespace cc
+
+#endif // CC_BASE_TIME_UTIL_H_