summaryrefslogtreecommitdiff
path: root/src/stream_base-inl.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-02-22 14:37:58 +0100
committerAnna Henningsen <anna@addaleax.net>2018-03-15 12:53:06 +0100
commitf734b3eb04c0d355ef7ab893ed5869b867d35642 (patch)
tree88950ea4877e1394e491bcfc4b9f8d217f27a0b6 /src/stream_base-inl.h
parentc412150582de524beacd180646ec5f18c518a922 (diff)
downloadandroid-node-v8-f734b3eb04c0d355ef7ab893ed5869b867d35642.tar.gz
android-node-v8-f734b3eb04c0d355ef7ab893ed5869b867d35642.tar.bz2
android-node-v8-f734b3eb04c0d355ef7ab893ed5869b867d35642.zip
src: give StreamBases the capability to ask for data
Add a `OnStreamWantsWrite()` event that allows streams to ask for more input data if they want some. 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-inl.h')
-rw-r--r--src/stream_base-inl.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h
index b7495a80ac..f0d522a7b0 100644
--- a/src/stream_base-inl.h
+++ b/src/stream_base-inl.h
@@ -136,6 +136,13 @@ inline void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) {
listener_->OnStreamAfterShutdown(w, status);
}
+inline void StreamResource::EmitWantsWrite(size_t suggested_size) {
+#ifdef DEBUG
+ v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent());
+#endif
+ listener_->OnStreamWantsWrite(suggested_size);
+}
+
inline StreamBase::StreamBase(Environment* env) : env_(env) {
PushStreamListener(&default_listener_);
}