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

Unified Diff: src/libplatform/default-platform.h

Issue 1179153002: Add V8 platform API to call delayed task. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Provide empty body to enable roll in Chromium. Created 5 years, 6 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 | « include/v8-platform.h ('k') | src/libplatform/default-platform.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libplatform/default-platform.h
diff --git a/src/libplatform/default-platform.h b/src/libplatform/default-platform.h
index 72b4d91aa8cfebbce16c71fb5cff23c128785746..fba5803f406054647b3d376527c9f9136b2a3765 100644
--- a/src/libplatform/default-platform.h
+++ b/src/libplatform/default-platform.h
@@ -5,6 +5,7 @@
#ifndef V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
#define V8_LIBPLATFORM_DEFAULT_PLATFORM_H_
+#include <functional>
#include <map>
#include <queue>
#include <vector>
@@ -37,11 +38,16 @@ class DefaultPlatform : public Platform {
Task* task, ExpectedRuntime expected_runtime) override;
virtual void CallOnForegroundThread(v8::Isolate* isolate,
Task* task) override;
+ virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
+ double delay_in_seconds) override;
double MonotonicallyIncreasingTime() override;
private:
static const int kMaxThreadPoolSize;
+ Task* PopTaskInMainThreadQueue(v8::Isolate* isolate);
+ Task* PopTaskInMainThreadDelayedQueue(v8::Isolate* isolate);
+
base::Mutex lock_;
bool initialized_;
int thread_pool_size_;
@@ -49,6 +55,12 @@ class DefaultPlatform : public Platform {
TaskQueue queue_;
std::map<v8::Isolate*, std::queue<Task*> > main_thread_queue_;
+ typedef std::pair<double, Task*> DelayedEntry;
+ std::map<v8::Isolate*,
+ std::priority_queue<DelayedEntry, std::vector<DelayedEntry>,
+ std::greater<DelayedEntry> > >
+ main_thread_delayed_queue_;
+
DISALLOW_COPY_AND_ASSIGN(DefaultPlatform);
};
« no previous file with comments | « include/v8-platform.h ('k') | src/libplatform/default-platform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698