mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
src: simplify node_worker.cc using new KVStore API
PR-URL: https://github.com/nodejs/node/pull/31773 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
7152fe3180
commit
7e5e34d01e
1 file changed
+4
-8
+4
-8
@@ -30,6 +30,7 @@ using v8::Integer;
|
||||
using v8::Isolate;
|
||||
using v8::Local;
|
||||
using v8::Locker;
|
||||
using v8::Maybe;
|
||||
using v8::MaybeLocal;
|
||||
using v8::Null;
|
||||
using v8::Number;
|
||||
@@ -504,14 +505,9 @@ void Worker::New(const FunctionCallbackInfo<Value>& args) {
|
||||
if (args[1]->IsObject() || args[2]->IsArray()) {
|
||||
per_isolate_opts.reset(new PerIsolateOptions());
|
||||
|
||||
HandleEnvOptions(
|
||||
per_isolate_opts->per_env, [isolate, &env_vars](const char* name) {
|
||||
MaybeLocal<String> value =
|
||||
env_vars->Get(isolate, OneByteString(isolate, name));
|
||||
return value.IsEmpty() ? std::string{}
|
||||
: std::string(*String::Utf8Value(
|
||||
isolate, value.ToLocalChecked()));
|
||||
});
|
||||
HandleEnvOptions(per_isolate_opts->per_env, [&env_vars](const char* name) {
|
||||
return env_vars->Get(name).FromMaybe("");
|
||||
});
|
||||
|
||||
#ifndef NODE_WITHOUT_NODE_OPTIONS
|
||||
MaybeLocal<String> maybe_node_opts =
|
||||
|
||||
Reference in new issue
Block a user