mirror of https://github.com/electron/electron
42 lines
1.9 KiB
Diff
42 lines
1.9 KiB
Diff
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 8ef62824d475d7c669e08b8d11e9d91af3c8e5a3..b64c7f603c67420aa09029dead063bfb12ba863b 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_; }
|