summaryrefslogtreecommitdiff
path: root/src/node.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-03-08 16:55:40 +0100
committerAnna Henningsen <anna@addaleax.net>2019-03-13 09:14:16 +0000
commitb21e7c7bcf23a2715951e4cd96180e4dbf1dcd4d (patch)
tree42050dbd0723b12a1884a9a53ca2da65e3a4653d /src/node.h
parent0e3adddd0d6e5d90b5224c62ef26b561320d1cff (diff)
downloadnode-new-b21e7c7bcf23a2715951e4cd96180e4dbf1dcd4d.tar.gz
embedding: make `NewIsolate()` API more flexible
Split the API up into its essential parts, namely setting up the creation parameters for the Isolate, creating it, and performing Node.js-specific customization afterwards. PR-URL: https://github.com/nodejs/node/pull/26525 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node.h')
-rw-r--r--src/node.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/node.h b/src/node.h
index 3aaaf43668..17eae72e9c 100644
--- a/src/node.h
+++ b/src/node.h
@@ -270,9 +270,24 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
void* data) = 0;
};
+// Set up some Node.js-specific defaults for `params`, in particular
+// the ArrayBuffer::Allocator if it is provided, memory limits, and
+// possibly a code event handler.
+NODE_EXTERN void SetIsolateCreateParams(v8::Isolate::CreateParams* params,
+ ArrayBufferAllocator* allocator
+ = nullptr);
+// Set a number of callbacks for the `isolate`, in particular the Node.js
+// uncaught exception listener.
+NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate);
// Creates a new isolate with Node.js-specific settings.
+// This is a convenience method equivalent to using SetIsolateCreateParams(),
+// Isolate::Allocate(), MultiIsolatePlatform::RegisterIsolate(),
+// Isolate::Initialize(), and SetIsolateUpForNode().
NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator,
struct uv_loop_s* event_loop);
+NODE_EXTERN v8::Isolate* NewIsolate(ArrayBufferAllocator* allocator,
+ struct uv_loop_s* event_loop,
+ MultiIsolatePlatform* platform);
// Creates a new context with Node.js-specific tweaks.
NODE_EXTERN v8::Local<v8::Context> NewContext(