From 8af6b75e10bd9ca06dea8b1c48e2034c34c6fcf0 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 13 Nov 2017 11:41:20 +0900 Subject: [PATCH] src: add public API for managing NodePlatform PR-URL: https://github.com/nodejs/node/pull/16981 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/node.cc | 12 ++++++++++++ src/node.h | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/node.cc b/src/node.cc index 14c65196d59c65..59a04a0b99ae2a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4043,6 +4043,18 @@ void FreeEnvironment(Environment* env) { } +MultiIsolatePlatform* CreatePlatform( + int thread_pool_size, + v8::TracingController* tracing_controller) { + return new NodePlatform(thread_pool_size, tracing_controller); +} + + +void FreePlatform(MultiIsolatePlatform* platform) { + delete platform; +} + + inline int Start(Isolate* isolate, IsolateData* isolate_data, int argc, const char* const* argv, int exec_argc, const char* const* exec_argv) { diff --git a/src/node.h b/src/node.h index d08c4633778834..c079d741238484 100644 --- a/src/node.h +++ b/src/node.h @@ -97,6 +97,11 @@ // Forward-declare libuv loop struct uv_loop_s; +// Forward-declare TracingController, used by CreatePlatform. +namespace v8 { +class TracingController; +} + // Forward-declare these functions now to stop MSVS from becoming // terminally confused when it's done in node_internals.h namespace node { @@ -243,6 +248,11 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data, NODE_EXTERN void LoadEnvironment(Environment* env); NODE_EXTERN void FreeEnvironment(Environment* env); +NODE_EXTERN MultiIsolatePlatform* CreatePlatform( + int thread_pool_size, + v8::TracingController* tracing_controller); +NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform); + NODE_EXTERN void EmitBeforeExit(Environment* env); NODE_EXTERN int EmitExit(Environment* env); NODE_EXTERN void RunAtExit(Environment* env);