From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <sattard@slack-corp.com>
Date: Wed, 29 Jul 2020 12:03:04 -0700
Subject: feat: add implementation of v8::Platform::PostJob

Uses the new "v8::platform::NewDefaultJobHandle" method

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2315981
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2304812

diff --git a/src/node_platform.cc b/src/node_platform.cc
index 7e68b7af891ffb87ce083081775015cc7b62fc42..aac0682670fcffd235fcf450bc5e2b0d45985b47 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -544,6 +544,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() {
   };
 }
 
+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), 1 /* num_worker_threads */);
+}
+
 template <class T>
 TaskQueue<T>::TaskQueue()
     : lock_(), tasks_available_(), tasks_drained_(),
diff --git a/src/node_platform.h b/src/node_platform.h
index dc512ddf08facf1ebb0d8c9e7677d349d0d2c87c..a274be6bbea19a4488bca393712a9ac8b50fe16a 100644
--- a/src/node_platform.h
+++ b/src/node_platform.h
@@ -162,6 +162,7 @@ class NodePlatform : public MultiIsolatePlatform {
   void UnregisterIsolate(v8::Isolate* isolate) override;
   void AddIsolateFinishedCallback(v8::Isolate* isolate,
                                   void (*callback)(void*), void* data) override;
+  std::unique_ptr<v8::JobHandle> PostJob(v8::TaskPriority priority, std::unique_ptr<v8::JobTask> job_task) override;
 
   std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
       v8::Isolate* isolate) override;
