summaryrefslogtreecommitdiff
path: root/src/stream_base.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-02-24 17:42:27 +0100
committerAnna Henningsen <anna@addaleax.net>2018-03-15 12:53:06 +0100
commit8695273948846b999f528ede97c764638fbb6c40 (patch)
tree5f167a62c91f05d897cac2a9e77bc7d69746d30f /src/stream_base.cc
parent3ad7c1ae9778fd9a61b4e99eeab4291827700d55 (diff)
downloadandroid-node-v8-8695273948846b999f528ede97c764638fbb6c40.tar.gz
android-node-v8-8695273948846b999f528ede97c764638fbb6c40.tar.bz2
android-node-v8-8695273948846b999f528ede97c764638fbb6c40.zip
src: tighten handle scopes for stream operations
Put `HandleScope`s and `Context::Scope`s where they are used, and don’t create one for native stream callbacks automatically. This is slightly less convenient but means that stream listeners that don’t actually call back into JS don’t have to pay the (small) cost of setting these up. PR-URL: https://github.com/nodejs/node/pull/18936 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/stream_base.cc')
-rw-r--r--src/stream_base.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/stream_base.cc b/src/stream_base.cc
index 1d1d324841..8838a1a6df 100644
--- a/src/stream_base.cc
+++ b/src/stream_base.cc
@@ -387,6 +387,8 @@ void ReportWritesToJSStreamListener::OnStreamAfterReqFinished(
StreamBase* stream = static_cast<StreamBase*>(stream_);
Environment* env = stream->stream_env();
AsyncWrap* async_wrap = req_wrap->GetAsyncWrap();
+ HandleScope handle_scope(env->isolate());
+ Context::Scope context_scope(env->context());
Local<Object> req_wrap_obj = async_wrap->object();
Local<Value> argv[] = {