File tree 2 files changed +5
-16
lines changed
2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -251,14 +251,6 @@ void Worker::Run() {
251
251
Isolate::DisallowJavascriptExecutionScope disallow_js (isolate_,
252
252
Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
253
253
254
- // Grab the parent-to-child channel and render is unusable.
255
- MessagePort* child_port;
256
- {
257
- Mutex::ScopedLock lock (mutex_);
258
- child_port = child_port_;
259
- child_port_ = nullptr ;
260
- }
261
-
262
254
{
263
255
Context::Scope context_scope (env_->context ());
264
256
{
@@ -394,13 +386,13 @@ void Worker::CreateEnvMessagePort(Environment* env) {
394
386
HandleScope handle_scope (isolate_);
395
387
Mutex::ScopedLock lock (mutex_);
396
388
// Set up the message channel for receiving messages in the child.
397
- child_port_ = MessagePort::New (env,
398
- env->context (),
399
- std::move (child_port_data_));
389
+ MessagePort* child_port = MessagePort::New (env,
390
+ env->context (),
391
+ std::move (child_port_data_));
400
392
// MessagePort::New() may return nullptr if execution is terminated
401
393
// within it.
402
- if (child_port_ != nullptr )
403
- env->set_message_port (child_port_ ->object (isolate_));
394
+ if (child_port != nullptr )
395
+ env->set_message_port (child_port ->object (isolate_));
404
396
}
405
397
406
398
void Worker::JoinThread () {
Original file line number Diff line number Diff line change @@ -100,9 +100,6 @@ class Worker : public AsyncWrap {
100
100
std::unique_ptr<MessagePortData> child_port_data_;
101
101
std::shared_ptr<KVStore> env_vars_;
102
102
103
- // The child port is kept alive by the child Environment's persistent
104
- // handle to it, as long as that child Environment exists.
105
- MessagePort* child_port_ = nullptr ;
106
103
// This is always kept alive because the JS object associated with the Worker
107
104
// instance refers to it via its [kPort] property.
108
105
MessagePort* parent_port_ = nullptr ;
You can’t perform that action at this time.
0 commit comments