From b65e5aeaa7bd68a9a02530af3ec40616c468b2fd Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Tue, 21 Jul 2020 10:11:35 +0200 Subject: [PATCH] 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 Reviewed-By: Jiawen Geng Reviewed-By: Daniel Bevenius Reviewed-By: Matteo Collina Reviewed-By: Myles Borins --- src/node_platform.cc | 6 ++++++ src/node_platform.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/node_platform.cc b/src/node_platform.cc index c15a95128e9d3f..eb918bdd559c40 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -513,6 +513,12 @@ bool NodePlatform::FlushForegroundTasks(Isolate* isolate) { return per_isolate->FlushForegroundTasksInternal(); } +std::unique_ptr NodePlatform::PostJob(v8::TaskPriority priority, + std::unique_ptr job_task) { + return v8::platform::NewDefaultJobHandle( + this, priority, std::move(job_task), NumberOfWorkerThreads()); +} + bool NodePlatform::IdleTasksEnabled(Isolate* isolate) { return ForIsolate(isolate)->IdleTasksEnabled(); } diff --git a/src/node_platform.h b/src/node_platform.h index dc512ddf08facf..a7139ebdcc28d2 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -154,6 +154,9 @@ class NodePlatform : public MultiIsolatePlatform { double CurrentClockTimeMillis() override; v8::TracingController* GetTracingController() override; bool FlushForegroundTasks(v8::Isolate* isolate) override; + std::unique_ptr PostJob( + v8::TaskPriority priority, + std::unique_ptr job_task) override; void RegisterIsolate(v8::Isolate* isolate, uv_loop_t* loop) override; void RegisterIsolate(v8::Isolate* isolate,