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

Unified Diff: cc/base/time_util.h

Issue 693883004: Make cc::animation::TrimTimeToCurrentIteration,cc::AnimationCurve::Duration use TimeTicks/TimeDelta (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 side-by-side diff with in-line comments
Download patch
Index: cc/base/time_util.h
diff --git a/cc/base/time_util.h b/cc/base/time_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e460bfaecd64276c2a46d64ce4eced634ea392b
--- /dev/null
+++ b/cc/base/time_util.h
@@ -0,0 +1,36 @@
+// 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 {
+
+base::TimeDelta operator*(const base::TimeDelta time_delta, double value) {
ajuma 2014/11/06 18:03:23 Rather than overloading operator* (which will be c
patro 2014/11/07 07:03:40 Done.
+ return base::TimeDelta::FromInternalValue(time_delta.ToInternalValue() *
ajuma 2014/11/06 18:03:23 Make the double/int64 conversions explicit, e.g:
ajuma 2014/11/06 18:07:20 Sorry, messed up the parentheses there. I meant: b
patro 2014/11/07 07:03:40 Done.
+ value);
+}
+
+base::TimeDelta operator*(double value, const base::TimeDelta time_delta) {
+ return base::TimeDelta::FromInternalValue(time_delta.ToInternalValue() *
+ value);
+}
+
+base::TimeDelta operator/(const base::TimeDelta time_delta, double value) {
+ return base::TimeDelta::FromInternalValue(time_delta.ToInternalValue() /
+ value);
+}
+
+base::TimeDelta operator/(double value, const base::TimeDelta time_delta) {
+ return base::TimeDelta::FromInternalValue(time_delta.ToInternalValue() /
+ value);
+}
+
+} // namespace cc
+
+#endif // CC_BASE_TIME_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698