From 05d2662cec862897675cad4616ddb9e31bdbf626 Mon Sep 17 00:00:00 2001 From: rmcilroy Date: Wed, 8 Oct 2014 04:28:05 -0700 Subject: [PATCH] Add implementation of MonotonicallyIncreasingTime to Gin's V8 platform implementation. BUG=417668 Review URL: https://codereview.chromium.org/634523002 Cr-Commit-Position: refs/heads/master@{#298684} --- gin/public/v8_platform.h | 1 + gin/v8_platform.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h index 2df0f848e599..f085b58ecfbf 100644 --- a/gin/public/v8_platform.h +++ b/gin/public/v8_platform.h @@ -24,6 +24,7 @@ class GIN_EXPORT V8Platform : public NON_EXPORTED_BASE(v8::Platform) { v8::Platform::ExpectedRuntime expected_runtime) OVERRIDE; virtual void CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) OVERRIDE; + virtual double MonotonicallyIncreasingTime() OVERRIDE; private: friend struct base::DefaultLazyInstanceTraits; diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc index d50ff24f8bf4..ec163ded8d14 100644 --- a/gin/v8_platform.cc +++ b/gin/v8_platform.cc @@ -39,4 +39,9 @@ void V8Platform::CallOnForegroundThread(v8::Isolate* isolate, v8::Task* task) { FROM_HERE, base::Bind(&v8::Task::Run, base::Owned(task))); } +double V8Platform::MonotonicallyIncreasingTime() { + return base::TimeTicks::Now().ToInternalValue() / + static_cast(base::Time::kMicrosecondsPerSecond); +} + } // namespace gin