diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2019-04-09 15:21:36 -0700 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2019-04-12 12:33:37 -0700 |
commit | 060d901f87b3d87314f8540eb02f315e2952f581 (patch) | |
tree | 53159171201703bb6d8a4e780c8624a5c6c8cbb5 /src/node_worker.cc | |
parent | 7b0d8673898e65a368108264c77bccaa3e004028 (diff) | |
download | android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.tar.gz android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.tar.bz2 android-node-v8-060d901f87b3d87314f8540eb02f315e2952f581.zip |
src: replace FromJust() with Check() when possible
FromJust() is often used not for its return value, but for its
side-effects. In these cases, Check() exists, and is more clear as to
the intent. From its comment:
To be used, where the actual value of the Maybe is not needed, like
Object::Set.
See: https://github.com/nodejs/node/pull/26929/files#r269256335
PR-URL: https://github.com/nodejs/node/pull/27162
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Diffstat (limited to 'src/node_worker.cc')
-rw-r--r-- | src/node_worker.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/node_worker.cc b/src/node_worker.cc index 7de9c355f6..bdf324fa04 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -84,12 +84,12 @@ Worker::Worker(Environment* env, object()->Set(env->context(), env->message_port_string(), - parent_port_->object()).FromJust(); + parent_port_->object()).Check(); object()->Set(env->context(), env->thread_id_string(), Number::New(env->isolate(), static_cast<double>(thread_id_))) - .FromJust(); + .Check(); #if NODE_USE_V8_PLATFORM && HAVE_INSPECTOR inspector_parent_handle_ = @@ -372,7 +372,7 @@ void Worker::OnThreadStopped() { // Reset the parent port as we're closing it now anyway. object()->Set(env()->context(), env()->message_port_string(), - Undefined(env()->isolate())).FromJust(); + Undefined(env()->isolate())).Check(); Local<Value> code = Integer::New(env()->isolate(), exit_code_); MakeCallback(env()->onexit_string(), 1, &code); @@ -602,7 +602,7 @@ void InitWorker(Local<Object> target, w->SetClassName(workerString); target->Set(env->context(), workerString, - w->GetFunction(env->context()).ToLocalChecked()).FromJust(); + w->GetFunction(env->context()).ToLocalChecked()).Check(); } env->SetMethod(target, "getEnvMessagePort", GetEnvMessagePort); @@ -611,19 +611,19 @@ void InitWorker(Local<Object> target, ->Set(env->context(), env->thread_id_string(), Number::New(env->isolate(), static_cast<double>(env->thread_id()))) - .FromJust(); + .Check(); target ->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "isMainThread"), Boolean::New(env->isolate(), env->is_main_thread())) - .FromJust(); + .Check(); target ->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "ownsProcessState"), Boolean::New(env->isolate(), env->owns_process_state())) - .FromJust(); + .Check(); } } // anonymous namespace |