mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
src: add ability to look up platform based on Environment*
This should eventually remove any necessity to use the global-state `GetMainThreadMultiIsolatePlatform()`. Backport-PR-URL: https://github.com/nodejs/node/pull/35241 PR-URL: https://github.com/nodejs/node/pull/30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
2 files changed
+14
-1
No files matched your search
@@ -474,6 +474,14 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
|
||||
return per_process::v8_platform.Platform();
|
||||
}
|
||||
|
||||
MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env) {
|
||||
return GetMultiIsolatePlatform(env->isolate_data());
|
||||
}
|
||||
|
||||
MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
|
||||
return env->platform();
|
||||
}
|
||||
|
||||
MultiIsolatePlatform* CreatePlatform(
|
||||
int thread_pool_size,
|
||||
node::tracing::TracingController* tracing_controller) {
|
||||
|
||||
+6
-1
@@ -456,9 +456,14 @@ NODE_EXTERN void FreeEnvironment(Environment* env);
|
||||
NODE_EXTERN Environment* GetCurrentEnvironment(v8::Local<v8::Context> context);
|
||||
|
||||
// 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,
|
||||
// If NODE_USE_V8_PLATFORM has not been defined when Node.js was built,
|
||||
// it returns nullptr.
|
||||
// TODO(addaleax): Deprecate in favour of GetMultiIsolatePlatform().
|
||||
NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform();
|
||||
// This returns the MultiIsolatePlatform used for an Environment or IsolateData
|
||||
// instance, if one exists.
|
||||
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
|
||||
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env);
|
||||
|
||||
// Legacy variants of MultiIsolatePlatform::Create().
|
||||
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
|
||||
|
||||
Reference in new issue
Block a user