summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Yonghuang Wang <helloshuangzi@gmail.com>2018-04-30 17:34:05 -0700
committerAnna Henningsen <anna@addaleax.net>2018-05-06 23:34:09 +0200
commitb00c34c16155417d1ddee44430d99ca43a837315 (patch)
treec5f37348bf8a2c7e9958e3f393c4ae6e32144742
parentc8f88471204cb30b5a1b5ac72173be547654023a (diff)
downloadnode-new-b00c34c16155417d1ddee44430d99ca43a837315.tar.gz
src: add public API to expose the main V8 Platform
Add an API to get MultiIsolatePlatform used in node main thread. PR-URL: https://github.com/nodejs/node/pull/20447 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
-rw-r--r--src/node.cc5
-rw-r--r--src/node.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc
index ee114257d5..669155a908 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -4425,6 +4425,11 @@ void FreeEnvironment(Environment* env) {
}
+MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
+ return v8_platform.Platform();
+}
+
+
MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
v8::TracingController* tracing_controller) {
diff --git a/src/node.h b/src/node.h
index ab5d1c120f..5a491c1abf 100644
--- a/src/node.h
+++ b/src/node.h
@@ -251,6 +251,11 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data,
NODE_EXTERN void LoadEnvironment(Environment* env);
NODE_EXTERN void FreeEnvironment(Environment* env);
+// This returns the MultiIsolatePlatform used in the main thread of Node.js.
+// If NODE_USE_V8_PLATFORM haven't been defined when Node.js was built,
+// it returns nullptr.
+NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform();
+
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
v8::TracingController* tracing_controller);