diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-11-03 15:28:34 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-11-06 15:57:57 +0300 |
commit | 4aca277f16b8649b5fc21d41f340fad0a47c2e61 (patch) | |
tree | d7bc9d32f1065cd8200b841d5f6d27320514edf5 /src/stream_pipe.cc | |
parent | d80e49d6801501a0f2b93c442d5e425ed6fc73fb (diff) |
src: remove AsyncScope and AsyncCallbackScope
Reduce the number of different scopes we use for async callbacks.
PR-URL: https://github.com/nodejs/node/pull/30236
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/stream_pipe.cc')
-rw-r--r-- | src/stream_pipe.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/stream_pipe.cc b/src/stream_pipe.cc index be7fc882ea5..832a20d324f 100644 --- a/src/stream_pipe.cc +++ b/src/stream_pipe.cc @@ -119,7 +119,6 @@ void StreamPipe::ReadableListener::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { StreamPipe* pipe = ContainerOf(&StreamPipe::readable_listener_, this); AllocatedBuffer buf(pipe->env(), buf_); - AsyncScope async_scope(pipe); if (nread < 0) { // EOF or error; stop reading and pass the error to the previous listener // (which might end up in JS). @@ -162,7 +161,9 @@ void StreamPipe::WritableListener::OnStreamAfterWrite(WriteWrap* w, StreamPipe* pipe = ContainerOf(&StreamPipe::writable_listener_, this); pipe->is_writing_ = false; if (pipe->is_eof_) { - AsyncScope async_scope(pipe); + HandleScope handle_scope(pipe->env()->isolate()); + InternalCallbackScope callback_scope(pipe, + InternalCallbackScope::kSkipTaskQueues); pipe->ShutdownWritable(); pipe->Unpipe(); return; @@ -206,7 +207,9 @@ void StreamPipe::WritableListener::OnStreamWantsWrite(size_t suggested_size) { pipe->wanted_data_ = suggested_size; if (pipe->is_reading_ || pipe->is_closed_) return; - AsyncScope async_scope(pipe); + HandleScope handle_scope(pipe->env()->isolate()); + InternalCallbackScope callback_scope(pipe, + InternalCallbackScope::kSkipTaskQueues); pipe->is_reading_ = true; pipe->source()->ReadStart(); } |