Skip to content

Commit

Permalink
src: add public API to expose the main V8 Platform
Browse files Browse the repository at this point in the history
Add an API to get MultiIsolatePlatform used in node main thread.

PR-URL: #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>
  • Loading branch information
helloshuangzi authored and MylesBorins committed May 8, 2018
1 parent 59ed6c0 commit ea6af3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/node.cc
Expand Up @@ -4439,6 +4439,11 @@ void FreeEnvironment(Environment* env) {
}


MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
return v8_platform.Platform();
}


MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
v8::TracingController* tracing_controller) {
Expand Down
5 changes: 5 additions & 0 deletions src/node.h
Expand Up @@ -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);
Expand Down

0 comments on commit ea6af3b

Please sign in to comment.