Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-02 01:47:38 +0300
committerAnna Henningsen <anna@addaleax.net>2019-02-05 23:55:54 +0300
commit39eca841c30e1a54424b85f34e8dd56b2648f930 (patch)
tree2ab9c7bc285e20f85cefff16c6441c726bbed126 /src/node_process_methods.cc
parent8d63f4037e52eda125c5a70dafa602f47c13d0ad (diff)
src: split ownsProcessState off isMainThread
Embedders may want to control whether a Node.js instance controls the current process, similar to what we currently have with `Worker`s. Previously, the `isMainThread` flag had a bit of a double usage, both for indicating whether we are (not) running a Worker and whether we can modify per-process state. PR-URL: https://github.com/nodejs/node/pull/25881 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r--src/node_process_methods.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc
index 51758f05f6b..a6d2c252e77 100644
--- a/src/node_process_methods.cc
+++ b/src/node_process_methods.cc
@@ -72,7 +72,7 @@ static void Abort(const FunctionCallbackInfo<Value>& args) {
static void Chdir(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
- CHECK(env->is_main_thread());
+ CHECK(env->owns_process_state());
CHECK_EQ(args.Length(), 1);
CHECK(args[0]->IsString());
@@ -392,17 +392,17 @@ static void InitializeProcessMethods(Local<Object> target,
Environment* env = Environment::GetCurrent(context);
// define various internal methods
- if (env->is_main_thread()) {
+ if (env->owns_process_state()) {
env->SetMethod(target, "_debugProcess", DebugProcess);
env->SetMethod(target, "_debugEnd", DebugEnd);
- env->SetMethod(
- target, "_startProfilerIdleNotifier", StartProfilerIdleNotifier);
- env->SetMethod(
- target, "_stopProfilerIdleNotifier", StopProfilerIdleNotifier);
env->SetMethod(target, "abort", Abort);
env->SetMethod(target, "chdir", Chdir);
}
+ env->SetMethod(
+ target, "_startProfilerIdleNotifier", StartProfilerIdleNotifier);
+ env->SetMethod(target, "_stopProfilerIdleNotifier", StopProfilerIdleNotifier);
+
env->SetMethod(target, "umask", Umask);
env->SetMethod(target, "_rawDebug", RawDebug);
env->SetMethod(target, "memoryUsage", MemoryUsage);