Revision: 24411
Author: [email protected]
Date: Mon Oct 6 12:22:25 2014 UTC
Log: Add MonotonicallyIncreasingTime to V8 Platform.
Adds a MonotonicallyIncreasingTime() function to the Platform API to enable
the
embedder to provide a time API to V8 which will be used for
IdleNotification deadlines.
BUG=417668
LOG=Y
[email protected]
Review URL: https://codereview.chromium.org/632663002
https://code.google.com/p/v8/source/detail?r=24411
Modified:
/branches/bleeding_edge/include/v8-platform.h
/branches/bleeding_edge/src/libplatform/default-platform.cc
/branches/bleeding_edge/src/libplatform/default-platform.h
=======================================
--- /branches/bleeding_edge/include/v8-platform.h Thu Jul 3 08:50:52 2014
UTC
+++ /branches/bleeding_edge/include/v8-platform.h Mon Oct 6 12:22:25 2014
UTC
@@ -55,6 +55,20 @@
* scheduling. The definition of "foreground" is opaque to V8.
*/
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0;
+
+
+ /**
+ * Monotonically increasing time in seconds from an arbitrary fixed
point in
+ * the past. This function is expected to return at least
+ * millisecond-precision values. For this reason,
+ * it is recommended that the fixed point be no further in the past than
+ * the epoch.
+ **/
+ virtual double MonotonicallyIncreasingTime() {
+ // TODO(rmcilroy): Remove this default implementation when Chromium
+ // change has landed.
+ return 0;
+ }
};
} // namespace v8
=======================================
--- /branches/bleeding_edge/src/libplatform/default-platform.cc Wed Aug 27
08:29:22 2014 UTC
+++ /branches/bleeding_edge/src/libplatform/default-platform.cc Mon Oct 6
12:22:25 2014 UTC
@@ -9,6 +9,7 @@
#include "src/base/logging.h"
#include "src/base/platform/platform.h"
+#include "src/base/platform/time.h"
#include "src/base/sys-info.h"
#include "src/libplatform/worker-thread.h"
@@ -106,4 +107,9 @@
main_thread_queue_[isolate].push(task);
}
+
+double DefaultPlatform::MonotonicallyIncreasingTime() {
+ return base::TimeTicks::HighResolutionNow().ToInternalValue() /
+ static_cast<double>(base::Time::kMicrosecondsPerSecond);
+}
} } // namespace v8::platform
=======================================
--- /branches/bleeding_edge/src/libplatform/default-platform.h Tue Sep 2
07:07:52 2014 UTC
+++ /branches/bleeding_edge/src/libplatform/default-platform.h Mon Oct 6
12:22:25 2014 UTC
@@ -37,6 +37,7 @@
Task* task, ExpectedRuntime expected_runtime) OVERRIDE;
virtual void CallOnForegroundThread(v8::Isolate* isolate,
Task* task) OVERRIDE;
+ virtual double MonotonicallyIncreasingTime() OVERRIDE;
private:
static const int kMaxThreadPoolSize;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.