summaryrefslogtreecommitdiff
path: root/src/node.cc
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-12-13 23:15:37 +0800
committerAnna Henningsen <anna@addaleax.net>2018-12-15 21:22:10 +0100
commit7a6bd9f9b7aa8f19eb955c226fefd2b8a74c23be (patch)
treea46d42524f3761246da1192f96039124886373c2 /src/node.cc
parent9021b0d3fcac507b335bd1117155e555adbd7c28 (diff)
downloadandroid-node-v8-7a6bd9f9b7aa8f19eb955c226fefd2b8a74c23be.tar.gz
android-node-v8-7a6bd9f9b7aa8f19eb955c226fefd2b8a74c23be.tar.bz2
android-node-v8-7a6bd9f9b7aa8f19eb955c226fefd2b8a74c23be.zip
src: pass isMainThread into bootstrap/node.js directly
Instead of loading the working binding for the sole purpose of detecting whether we are inside the main thread unconditionally. PR-URL: https://github.com/nodejs/node/pull/25017 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node.cc')
-rw-r--r--src/node.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node.cc b/src/node.cc
index 7e1a904e52..93fcca6beb 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1276,14 +1276,16 @@ void LoadEnvironment(Environment* env) {
env->process_string(),
FIXED_ONE_BYTE_STRING(isolate, "bootstrappers"),
FIXED_ONE_BYTE_STRING(isolate, "loaderExports"),
- FIXED_ONE_BYTE_STRING(isolate, "triggerFatalException")};
+ FIXED_ONE_BYTE_STRING(isolate, "triggerFatalException"),
+ FIXED_ONE_BYTE_STRING(isolate, "isMainThread")};
std::vector<Local<Value>> node_args = {
process,
bootstrapper,
loader_exports.ToLocalChecked(),
env->NewFunctionTemplate(FatalException)
->GetFunction(context)
- .ToLocalChecked()};
+ .ToLocalChecked(),
+ Boolean::New(isolate, env->is_main_thread())};
if (ExecuteBootstrapper(
env, "internal/bootstrap/node", &node_params, &node_args)