diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-01 23:47:38 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-02-05 21:55:54 +0100 |
commit | 39eca841c30e1a54424b85f34e8dd56b2648f930 (patch) | |
tree | 2ab9c7bc285e20f85cefff16c6441c726bbed126 /src/node_worker.cc | |
parent | 8d63f4037e52eda125c5a70dafa602f47c13d0ad (diff) | |
download | android-node-v8-39eca841c30e1a54424b85f34e8dd56b2648f930.tar.gz android-node-v8-39eca841c30e1a54424b85f34e8dd56b2648f930.tar.bz2 android-node-v8-39eca841c30e1a54424b85f34e8dd56b2648f930.zip |
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_worker.cc')
-rw-r--r-- | src/node_worker.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/node_worker.cc b/src/node_worker.cc index d457ab0c3e..2d960f6e4d 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -569,6 +569,12 @@ void InitWorker(Local<Object> target, FIXED_ONE_BYTE_STRING(env->isolate(), "isMainThread"), Boolean::New(env->isolate(), env->is_main_thread())) .FromJust(); + + target + ->Set(env->context(), + FIXED_ONE_BYTE_STRING(env->isolate(), "ownsProcessState"), + Boolean::New(env->isolate(), env->owns_process_state())) + .FromJust(); } } // anonymous namespace |