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 85d227fa3fdce6fc29bc4927e30a0171987578ac..1a61190ed3a2aeb440aa774788a469079df13c79 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 6091fa3575cf82ea532e88747c753040045cc9a0..55eee1dcede4daeed53bdc0447cfb714763d0d32 100644
--- a/src/execution/microtask-queue.h
+++ b/src/execution/microtask-queue.h
@@ -91,10 +91,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_; }
