summaryrefslogtreecommitdiff
path: root/src/stream_base.h
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.h
parent3ad7c1ae9778fd9a61b4e99eeab4291827700d55 (diff)
downloadnode-new-8695273948846b999f528ede97c764638fbb6c40.tar.gz
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.h')
-rw-r--r--src/stream_base.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/stream_base.h b/src/stream_base.h
index 8af05059f4..6962648650 100644
--- a/src/stream_base.h
+++ b/src/stream_base.h
@@ -61,7 +61,8 @@ class ShutdownWrap : public StreamReq {
v8::Local<v8::Object> req_wrap_obj)
: StreamReq(stream, req_wrap_obj) { }
- void OnDone(int status) override; // Just calls stream()->AfterShutdown()
+ // Call stream()->EmitAfterShutdown() and dispose of this request wrap.
+ void OnDone(int status) override;
};
class WriteWrap : public StreamReq {
@@ -78,7 +79,8 @@ class WriteWrap : public StreamReq {
free(storage_);
}
- void OnDone(int status) override; // Just calls stream()->AfterWrite()
+ // Call stream()->EmitAfterWrite() and dispose of this request wrap.
+ void OnDone(int status) override;
private:
char* storage_ = nullptr;
@@ -306,13 +308,6 @@ class StreamBase : public StreamResource {
Environment* env_;
EmitToJSStreamListener default_listener_;
- // These are called by the respective {Write,Shutdown}Wrap class.
- void AfterShutdown(ShutdownWrap* req, int status);
- void AfterWrite(WriteWrap* req, int status);
-
- template <typename Wrap, typename EmitEvent>
- void AfterRequest(Wrap* req_wrap, EmitEvent emit);
-
friend class WriteWrap;
friend class ShutdownWrap;
};