src: implement NodePlatform::PostJob

V8 is starting to use the job API for Wasm compilation, so the node
platform should implement that.

PR-URL: https://github.com/nodejs/node/pull/35415
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
This commit is contained in:
Clemens Backes
2020-07-21 10:11:35 +02:00
committed by Michaël Zasso
parent 80e8aec4a5
commit b65e5aeaa7
2 changed files with 9 additions and 0 deletions

View File

@@ -513,6 +513,12 @@ bool NodePlatform::FlushForegroundTasks(Isolate* isolate) {
return per_isolate->FlushForegroundTasksInternal();
}
std::unique_ptr<v8::JobHandle> NodePlatform::PostJob(v8::TaskPriority priority,
std::unique_ptr<v8::JobTask> job_task) {
return v8::platform::NewDefaultJobHandle(
this, priority, std::move(job_task), NumberOfWorkerThreads());
}
bool NodePlatform::IdleTasksEnabled(Isolate* isolate) {
return ForIsolate(isolate)->IdleTasksEnabled();
}

View File

@@ -154,6 +154,9 @@ class NodePlatform : public MultiIsolatePlatform {
double CurrentClockTimeMillis() override;
v8::TracingController* GetTracingController() override;
bool FlushForegroundTasks(v8::Isolate* isolate) override;
std::unique_ptr<v8::JobHandle> PostJob(
v8::TaskPriority priority,
std::unique_ptr<v8::JobTask> job_task) override;
void RegisterIsolate(v8::Isolate* isolate, uv_loop_t* loop) override;
void RegisterIsolate(v8::Isolate* isolate,