From 95b93f9ad2e35587139eaf484ecd3e45129d3ecb Mon Sep 17 00:00:00 2001 From: Allen Yonghuang Wang Date: Mon, 30 Apr 2018 17:34:05 -0700 Subject: [PATCH 1/3] src: add public API to expose the MultiIsolatePlatform used in node main thread --- src/node.cc | 5 +++++ src/node.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/node.cc b/src/node.cc index ee114257d5d126..51bdc0df7c5d89 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4425,6 +4425,11 @@ void FreeEnvironment(Environment* env) { } +MultiIsolatePlatform* GetNodeMultiIsolatePlatform() { + 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 ab5d1c120fa007..9019c80f18e3f8 100644 --- a/src/node.h +++ b/src/node.h @@ -251,6 +251,10 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data, NODE_EXTERN void LoadEnvironment(Environment* env); NODE_EXTERN void FreeEnvironment(Environment* env); +// This returns the MultiIsolatePlatform used by node main. +// If NODE_USE_V8_PLATFORM is not defined, it will return nullptr. +NODE_EXTERN MultiIsolatePlatform* GetNodeMultiIsolatePlatform(); + NODE_EXTERN MultiIsolatePlatform* CreatePlatform( int thread_pool_size, v8::TracingController* tracing_controller); From c92af0b8862f98c26d8c8808694d928a4c13fd61 Mon Sep 17 00:00:00 2001 From: Allen Yonghuang Wang Date: Tue, 1 May 2018 10:21:05 -0700 Subject: [PATCH 2/3] src: give it a more accurate name and polish its comments. --- src/node.cc | 2 +- src/node.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/node.cc b/src/node.cc index 51bdc0df7c5d89..669155a908e2eb 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4425,7 +4425,7 @@ void FreeEnvironment(Environment* env) { } -MultiIsolatePlatform* GetNodeMultiIsolatePlatform() { +MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() { return v8_platform.Platform(); } diff --git a/src/node.h b/src/node.h index 9019c80f18e3f8..ce5ef924f15507 100644 --- a/src/node.h +++ b/src/node.h @@ -251,9 +251,10 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data, NODE_EXTERN void LoadEnvironment(Environment* env); NODE_EXTERN void FreeEnvironment(Environment* env); -// This returns the MultiIsolatePlatform used by node main. -// If NODE_USE_V8_PLATFORM is not defined, it will return nullptr. -NODE_EXTERN MultiIsolatePlatform* GetNodeMultiIsolatePlatform(); +// 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 would return nullptr. +NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform(); NODE_EXTERN MultiIsolatePlatform* CreatePlatform( int thread_pool_size, From bb5c76c606f9a5d6beadd551ff2b822811adb03e Mon Sep 17 00:00:00 2001 From: Allen Yonghuang Wang Date: Wed, 2 May 2018 09:51:48 -0700 Subject: [PATCH 3/3] src: polish comments --- src/node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.h b/src/node.h index ce5ef924f15507..5a491c1abf5457 100644 --- a/src/node.h +++ b/src/node.h @@ -253,7 +253,7 @@ 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 would return nullptr. +// it returns nullptr. NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform(); NODE_EXTERN MultiIsolatePlatform* CreatePlatform(