Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Laverdet <marcel@laverdet.com>2019-11-13 01:26:08 +0300
committerAnna Henningsen <anna@addaleax.net>2019-11-20 21:02:55 +0300
commitc712fb7cd6222018cf615fd0071998bde6f16da9 (patch)
tree2f6713dc39dfea54e6fb6b1a56a82c9da64469a6 /src/node.h
parentc63af4fea041673eb7c33f6df3c474d4537fe5eb (diff)
src: add abstract `IsolatePlatformDelegate`
Adds a new abstract class for module authors and embedders to register arbitrary isolates with `node::MultiIsolatePlatform`. PR-URL: https://github.com/nodejs/node/pull/30324 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node.h')
-rw-r--r--src/node.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/node.h b/src/node.h
index c80e6266857..f3da4574019 100644
--- a/src/node.h
+++ b/src/node.h
@@ -262,6 +262,12 @@ class NODE_EXTERN ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
NODE_EXTERN ArrayBufferAllocator* CreateArrayBufferAllocator();
NODE_EXTERN void FreeArrayBufferAllocator(ArrayBufferAllocator* allocator);
+class NODE_EXTERN IsolatePlatformDelegate {
+ public:
+ virtual std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner() = 0;
+ virtual bool IdleTasksEnabled() = 0;
+};
+
class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
public:
~MultiIsolatePlatform() override = default;
@@ -283,6 +289,12 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
// This function may only be called once per `Isolate`.
virtual void RegisterIsolate(v8::Isolate* isolate,
struct uv_loop_s* loop) = 0;
+ // This method can be used when an application handles task scheduling on its
+ // own through `IsolatePlatformDelegate`. Upon registering an isolate with
+ // this overload any other method in this class with the exception of
+ // `UnregisterIsolate` *must not* be used on that isolate.
+ virtual void RegisterIsolate(v8::Isolate* isolate,
+ IsolatePlatformDelegate* delegate) = 0;
// This function may only be called once per `Isolate`, and discard any
// pending delayed tasks scheduled for that isolate.