summaryrefslogtreecommitdiffstats
path: root/gin/public
diff options
context:
space:
mode:
Diffstat (limited to 'gin/public')
-rw-r--r--gin/public/isolate_holder.h3
-rw-r--r--gin/public/v8_idle_task_runner.h26
-rw-r--r--gin/public/v8_platform.h3
3 files changed, 32 insertions, 0 deletions
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
index 1647293..f7e01e8 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "gin/gin_export.h"
+#include "gin/public/v8_idle_task_runner.h"
#include "v8/include/v8.h"
namespace gin {
@@ -66,6 +67,8 @@ class GIN_EXPORT IsolateHolder {
// This method returns if v8::Locker is needed to access isolate.
AccessMode access_mode() const { return access_mode_; }
+ void EnableIdleTasks(scoped_ptr<V8IdleTaskRunner> idle_task_runner);
+
// This method returns V8IsolateMemoryDumpProvider of this isolate, used for
// testing.
V8IsolateMemoryDumpProvider* isolate_memory_dump_provider_for_testing()
diff --git a/gin/public/v8_idle_task_runner.h b/gin/public/v8_idle_task_runner.h
new file mode 100644
index 0000000..f0662d1
--- /dev/null
+++ b/gin/public/v8_idle_task_runner.h
@@ -0,0 +1,26 @@
+// Copyright 2013 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 GIN_PUBLIC_V8_IDLE_TASK_RUNNER_H_
+#define GIN_PUBLIC_V8_IDLE_TASK_RUNNER_H_
+
+#include "base/basictypes.h"
+#include "v8/include/v8-platform.h"
+
+namespace gin {
+
+// A V8IdleTaskRunner is a task runner for running idle tasks.
+// Idle tasks have an unbound argument which is bound to a deadline in
+// (v8::Platform::MonotonicallyIncreasingTime) when they are run.
+// The idle task is expected to complete by this deadline.
+class GIN_EXPORT V8IdleTaskRunner {
+ public:
+ virtual void PostIdleTask(v8::IdleTask* task) = 0;
+
+ virtual ~V8IdleTaskRunner() {}
+};
+
+} // namespace gin
+
+#endif // GIN_PUBLIC_V8_IDLE_TASK_RUNNER_H_
diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h
index df18943..d66c1fb 100644
--- a/gin/public/v8_platform.h
+++ b/gin/public/v8_platform.h
@@ -26,6 +26,9 @@ class GIN_EXPORT V8Platform : public NON_EXPORTED_BASE(v8::Platform) {
void CallDelayedOnForegroundThread(v8::Isolate* isolate,
v8::Task* task,
double delay_in_seconds) override;
+ void CallIdleOnForegroundThread(v8::Isolate* isolate,
+ v8::IdleTask* task) override;
+ bool IdleTasksEnabled(v8::Isolate* isolate) override;
double MonotonicallyIncreasingTime() override;
private: