Skip to content

Commit 71f8f12

Browse files
helloshuangziMylesBorins
authored andcommitted
src: add public API to expose the main V8 Platform
Add an API to get MultiIsolatePlatform used in node main thread. PR-URL: #20447 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 972b94e commit 71f8f12

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/node.cc

+5
Original file line numberDiff line numberDiff line change
@@ -4439,6 +4439,11 @@ void FreeEnvironment(Environment* env) {
44394439
}
44404440

44414441

4442+
MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
4443+
return v8_platform.Platform();
4444+
}
4445+
4446+
44424447
MultiIsolatePlatform* CreatePlatform(
44434448
int thread_pool_size,
44444449
v8::TracingController* tracing_controller) {

src/node.h

+5
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data,
251251
NODE_EXTERN void LoadEnvironment(Environment* env);
252252
NODE_EXTERN void FreeEnvironment(Environment* env);
253253

254+
// This returns the MultiIsolatePlatform used in the main thread of Node.js.
255+
// If NODE_USE_V8_PLATFORM haven't been defined when Node.js was built,
256+
// it returns nullptr.
257+
NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform();
258+
254259
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
255260
int thread_pool_size,
256261
v8::TracingController* tracing_controller);

0 commit comments

Comments
 (0)