Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: add API to get MultiIsolatePlatform used in node main thread #20447

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4425,6 +4425,11 @@ void FreeEnvironment(Environment* env) {
}


MultiIsolatePlatform* GetNodeMultiIsolatePlatform() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant name, it's already in the node:: namespace. Just GetMultiIsolatePlatform() or GetMainThreadMultiIsolatePlatform()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change it to GetMainThreadMultiIsolatePlatform as a more accurate name.

return v8_platform.Platform();
}


MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
v8::TracingController* tracing_controller) {
Expand Down
4 changes: 4 additions & 0 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe specific that the macro needs to have been defined when Node.js was built, not when the addon is being built?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what's "node main"? This comment could be expanded a little.

NODE_EXTERN MultiIsolatePlatform* GetNodeMultiIsolatePlatform();

NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
v8::TracingController* tracing_controller);
Expand Down