From ae9ea95d7a8265f40c4dc534f42411dce482efac Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 1 Feb 2020 11:42:30 +0100 Subject: [PATCH] src: remove unused `Worker::child_port_` member This fixes a compiler warning introduced in 9225939528590f652e6. PR-URL: https://github.com/nodejs/node/pull/31599 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- src/node_worker.cc | 18 +++++------------- src/node_worker.h | 3 --- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/node_worker.cc b/src/node_worker.cc index 5ecdb74e84185a..54ec43a231f5e0 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -253,14 +253,6 @@ void Worker::Run() { Isolate::DisallowJavascriptExecutionScope disallow_js(isolate_, Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE); - // Grab the parent-to-child channel and render is unusable. - MessagePort* child_port; - { - Mutex::ScopedLock lock(mutex_); - child_port = child_port_; - child_port_ = nullptr; - } - { Context::Scope context_scope(env_->context()); { @@ -396,13 +388,13 @@ void Worker::CreateEnvMessagePort(Environment* env) { HandleScope handle_scope(isolate_); Mutex::ScopedLock lock(mutex_); // Set up the message channel for receiving messages in the child. - child_port_ = MessagePort::New(env, - env->context(), - std::move(child_port_data_)); + MessagePort* child_port = MessagePort::New(env, + env->context(), + std::move(child_port_data_)); // MessagePort::New() may return nullptr if execution is terminated // within it. - if (child_port_ != nullptr) - env->set_message_port(child_port_->object(isolate_)); + if (child_port != nullptr) + env->set_message_port(child_port->object(isolate_)); } void Worker::JoinThread() { diff --git a/src/node_worker.h b/src/node_worker.h index 46eab70a499c37..50d09b6c62011e 100644 --- a/src/node_worker.h +++ b/src/node_worker.h @@ -102,9 +102,6 @@ class Worker : public AsyncWrap { std::unique_ptr child_port_data_; std::shared_ptr env_vars_; - // The child port is kept alive by the child Environment's persistent - // handle to it, as long as that child Environment exists. - MessagePort* child_port_ = nullptr; // This is always kept alive because the JS object associated with the Worker // instance refers to it via its [kPort] property. MessagePort* parent_port_ = nullptr;