Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-02-24 19:42:27 +0300
committerAnna Henningsen <anna@addaleax.net>2018-03-15 14:53:06 +0300
commit8695273948846b999f528ede97c764638fbb6c40 (patch)
tree5f167a62c91f05d897cac2a9e77bc7d69746d30f /src/stream_base.cc
parent3ad7c1ae9778fd9a61b4e99eeab4291827700d55 (diff)
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 1d1d3248415..8838a1a6dfb 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[] = {