Skip to content

Commit ea6af3b

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 <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>
1 parent 59ed6c0 commit ea6af3b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/node.cc

Lines changed: 5 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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)