From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Wed, 11 Jan 2023 19:21:06 +0900
Subject: chore: allow customizing microtask policy per context

With https://github.com/electron/electron/issues/36813, microtask queue associated with a context
will be used if available, instead of the default associated with an isolate. We need the
capability to switch the microtask polciy of these per context microtask queue to support
Node.js integration in the renderer.

diff --git a/include/v8-microtask-queue.h b/include/v8-microtask-queue.h
index 135dfb06a3bdd11e5db21c1974a38a086a7ac9cb..f2708774bfac59703e8981d8816a97a8e61b177a 100644
--- a/include/v8-microtask-queue.h
+++ b/include/v8-microtask-queue.h
@@ -97,6 +97,9 @@ class V8_EXPORT MicrotaskQueue {
    */
   virtual int GetMicrotasksScopeDepth() const = 0;
 
+  virtual void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) = 0;
+  virtual v8::MicrotasksPolicy microtasks_policy() const = 0;
+
   MicrotaskQueue(const MicrotaskQueue&) = delete;
   MicrotaskQueue& operator=(const MicrotaskQueue&) = delete;
 
diff --git a/src/execution/microtask-queue.h b/src/execution/microtask-queue.h
index e85df7d13bb7fd5430e55f5669f1da4b19af36a4..ec8ef87d3b9a9bbb95b28eac560e46eab2ee94cb 100644
--- a/src/execution/microtask-queue.h
+++ b/src/execution/microtask-queue.h
@@ -93,10 +93,10 @@ class V8_EXPORT_PRIVATE MicrotaskQueue final : public v8::MicrotaskQueue {
   }
 #endif
 
-  void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) {
+  void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) override {
     microtasks_policy_ = microtasks_policy;
   }
-  v8::MicrotasksPolicy microtasks_policy() const { return microtasks_policy_; }
+  v8::MicrotasksPolicy microtasks_policy() const override { return microtasks_policy_; }
 
   intptr_t capacity() const { return capacity_; }
   intptr_t size() const { return size_; }
