Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream_base: homogenize req_wrap_obj use #10184

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/stream_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ void StreamBase::AfterShutdown(ShutdownWrap* req_wrap, int status) {
req_wrap_obj
};

if (req_wrap->object()->Has(env->context(),
env->oncomplete_string()).FromJust()) {
if (req_wrap_obj->Has(env->context(), env->oncomplete_string()).FromJust())
req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv);
}

delete req_wrap;
}
Expand Down Expand Up @@ -172,9 +170,8 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) {

int err = DoWrite(req_wrap, *bufs, count, nullptr);

req_wrap->object()->Set(env->async(), True(env->isolate()));
req_wrap->object()->Set(env->bytes_string(),
Number::New(env->isolate(), bytes));
req_wrap_obj->Set(env->async(), True(env->isolate()));
req_wrap_obj->Set(env->bytes_string(), Number::New(env->isolate(), bytes));
const char* msg = Error();
if (msg != nullptr) {
req_wrap_obj->Set(env->error_string(), OneByteString(env->isolate(), msg));
Expand Down Expand Up @@ -328,7 +325,7 @@ int StreamBase::WriteString(const FunctionCallbackInfo<Value>& args) {
// Reference StreamWrap instance to prevent it from being garbage
// collected before `AfterWrite` is called.
CHECK_EQ(false, req_wrap->persistent().IsEmpty());
req_wrap->object()->Set(env->handle_string(), send_handle_obj);
req_wrap_obj->Set(env->handle_string(), send_handle_obj);
}

err = DoWrite(
Expand All @@ -338,7 +335,7 @@ int StreamBase::WriteString(const FunctionCallbackInfo<Value>& args) {
reinterpret_cast<uv_stream_t*>(send_handle));
}

req_wrap->object()->Set(env->async(), True(env->isolate()));
req_wrap_obj->Set(env->async(), True(env->isolate()));

if (err)
req_wrap->Dispose();
Expand Down Expand Up @@ -383,10 +380,8 @@ void StreamBase::AfterWrite(WriteWrap* req_wrap, int status) {
wrap->ClearError();
}

if (req_wrap->object()->Has(env->context(),
env->oncomplete_string()).FromJust()) {
if (req_wrap_obj->Has(env->context(), env->oncomplete_string()).FromJust())
req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv);
}

req_wrap->Dispose();
}
Expand Down