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

src: refactor WriteWrap and ShutdownWrap #18676

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[squash] bnoordhuis nits
  • Loading branch information
addaleax committed Feb 13, 2018
commit ba18a7ae4a7d4e384fcb66b4b77c7151e40c0edc
7 changes: 1 addition & 6 deletions src/stream_base-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ inline StreamReq* StreamReq::FromObject(v8::Local<v8::Object> req_wrap_obj) {
}

inline void StreamReq::Dispose() {
object()->SetAlignedPointerInInternalField(
kStreamReqField, nullptr);
object()->SetAlignedPointerInInternalField(kStreamReqField, nullptr);
delete this;
}

Expand Down Expand Up @@ -153,10 +152,6 @@ inline void StreamBase::AfterRequest(Wrap* req_wrap, EmitEvent emit) {
v8::HandleScope handle_scope(env->isolate());
v8::Context::Scope context_scope(env->context());

// Remove the reference to the .handle property
v8::Local<v8::Object> req_wrap_obj = req_wrap->object();
req_wrap_obj->Delete(env->context(), env->handle_string()).FromJust();

emit();
req_wrap->Dispose();
}
Expand Down
2 changes: 1 addition & 1 deletion src/stream_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int StreamBase::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
Local<Object> req_wrap_obj = args[0].As<Object>();

uv_buf_t buf;
buf.base = const_cast<char*>(Buffer::Data(args[1]));
buf.base = Buffer::Data(args[1]);
buf.len = Buffer::Length(args[1]);

StreamWriteResult res = Write(&buf, 1, nullptr, req_wrap_obj);
Expand Down
4 changes: 2 additions & 2 deletions src/stream_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ class StreamListener {

// This is called once a write has finished. `status` may be 0 or,
// if negative, a libuv error code.
// By the fault, this is simply passed on to the previous listener
// By default, this is simply passed on to the previous listener
// (and raises an assertion if there is none).
virtual void OnStreamAfterWrite(WriteWrap* w, int status);

// This is called once a shutdown has finished. `status` may be 0 or,
// if negative, a libuv error code.
// By the fault, this is simply passed on to the previous listener
// By default, this is simply passed on to the previous listener
// (and raises an assertion if there is none).
virtual void OnStreamAfterShutdown(ShutdownWrap* w, int status);

Expand Down