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

Unified Diff: base/time/time.h

Issue 178103004: Removing the use of base::Time inside the LayerTreeHost system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing to a common ToWebKitTime function. Created 6 years, 10 months 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
« no previous file with comments | « no previous file | base/time/time.cc » ('j') | cc/test/fake_layer_tree_host_impl_client.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time/time.h
diff --git a/base/time/time.h b/base/time/time.h
index 40566b92317a3c94ff183994a22c0029122fceb0..83781c5b4e5d0c25ae1b122bfb1deb6dbb02fa13 100644
--- a/base/time/time.h
+++ b/base/time/time.h
@@ -47,6 +47,7 @@
#endif
#include <limits>
+#include <ostream>
namespace base {
@@ -613,6 +614,14 @@ class BASE_EXPORT TimeTicks {
// application runs.
static TimeTicks UnixEpoch();
+ // Converts time to/from a double which is the number of seconds since epoch
+ // (Jan 1, 1970). Webkit uses this format to represent time.
jamesr 2014/02/28 00:58:16 if this is just needed for interacting with Blink
+ // Because WebKit initializes double time value to 0 to indicate "not
+ // initialized", we map it to empty Time object that also means "not
+ // initialized".
+ static TimeTicks FromWebKit(double dt);
+ double ToWebKit() const;
+
// Returns the internal numeric value of the TimeTicks object.
// For serializing, use FromInternalValue to reconstitute.
int64 ToInternalValue() const {
@@ -688,6 +697,21 @@ inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
return TimeTicks(t.ticks_ + delta_);
}
+inline ::std::ostream& operator<<(::std::ostream& os, const TimeTicks& t) {
+ os << "TimeTicks(";
jamesr 2014/02/28 00:58:16 i'm pretty sure we don't want to have these stream
+ int64 ticks = t.ToInternalValue();
+ if (ticks == 0)
+ ;
+ else if (ticks == std::numeric_limits<int64>::max())
+ os << "max";
+ else if (ticks == std::numeric_limits<int64>::min())
+ os << "min";
+ else
+ os << ticks;
+ os << ")";
+ return os;
+}
+
} // namespace base
#endif // BASE_TIME_TIME_H_
« no previous file with comments | « no previous file | base/time/time.cc » ('j') | cc/test/fake_layer_tree_host_impl_client.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698