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

Unified Diff: src/platform/time.h

Issue 23548024: Introduce a RandonNumberGenerator class. Refactor the random/private_random uses in Isolate/Context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Initialize random_number_generator of Isolate lazily. Created 7 years, 3 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
Index: src/platform/time.h
diff --git a/src/platform/time.h b/src/platform/time.h
index 3fed6287fe0d1e0b2bdd0b79830285ae9b2da88a..2777cee08d9a6fb9393f1463057b468fec4b3530 100644
--- a/src/platform/time.h
+++ b/src/platform/time.h
@@ -222,6 +222,15 @@ class Time V8_FINAL BASE_EMBEDDED {
// with which we might compare it.
static Time Max() { return Time(std::numeric_limits<int64_t>::max()); }
+ // Converts to/from internal values. The meaning of the "internal value" is
+ // completely up to the implementation, so it should be treated as opaque.
+ static Time FromInternalValue(int64_t value) V8_WARN_UNUSED_RESULT {
Michael Starzinger 2013/09/09 17:11:25 Ceterum censeo V8_WARN_UNUSED_RESULT esse delendam
Benedikt Meurer 2013/09/10 06:08:07 Done.
+ return Time(value);
+ }
+ int64_t ToInternalValue() const V8_WARN_UNUSED_RESULT {
Michael Starzinger 2013/09/09 17:11:25 Ceterum censeo V8_WARN_UNUSED_RESULT esse delendam
Benedikt Meurer 2013/09/10 06:08:07 Done.
+ return us_;
+ }
+
// Converts to/from POSIX time specs.
static Time FromTimespec(struct timespec ts);
struct timespec ToTimespec() const;
@@ -329,6 +338,15 @@ class TimeTicks V8_FINAL BASE_EMBEDDED {
// Returns true if this object has not been initialized.
bool IsNull() const { return ticks_ == 0; }
+ // Converts to/from internal values. The meaning of the "internal value" is
+ // completely up to the implementation, so it should be treated as opaque.
+ static TimeTicks FromInternalValue(int64_t value) V8_WARN_UNUSED_RESULT {
Michael Starzinger 2013/09/09 17:11:25 Ceterum censeo V8_WARN_UNUSED_RESULT esse delendam
Benedikt Meurer 2013/09/10 06:08:07 Done.
+ return TimeTicks(value);
+ }
+ int64_t ToInternalValue() const V8_WARN_UNUSED_RESULT {
Michael Starzinger 2013/09/09 17:11:25 Ceterum censeo V8_WARN_UNUSED_RESULT esse delendam
Benedikt Meurer 2013/09/10 06:08:07 Done.
+ return ticks_;
+ }
+
TimeTicks& operator=(const TimeTicks other) {
ticks_ = other.ticks_;
return *this;

Powered by Google App Engine
This is Rietveld 408576698