aboutsummaryrefslogtreecommitdiff
path: root/src/node_http2.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-02-08 04:59:10 +0100
committerAnna Henningsen <anna@addaleax.net>2018-02-14 10:00:29 +0100
commit0e7b61229aa602e55c5fb034a63d7da97eecff3b (patch)
tree0e64305591fd94e1b609c5fd4ba1ae1bd19ea66a /src/node_http2.h
parent0ed9ea861b847579478457b7f5aab430fb6d77cb (diff)
downloadandroid-node-v8-0e7b61229aa602e55c5fb034a63d7da97eecff3b.tar.gz
android-node-v8-0e7b61229aa602e55c5fb034a63d7da97eecff3b.tar.bz2
android-node-v8-0e7b61229aa602e55c5fb034a63d7da97eecff3b.zip
src: refactor WriteWrap and ShutdownWraps
Encapsulate stream requests more: - `WriteWrap` and `ShutdownWrap` classes are now tailored to the streams on which they are used. In particular, for most streams these are now plain `AsyncWrap`s and do not carry the overhead of unused libuv request data. - Provide generic `Write()` and `Shutdown()` methods that wrap around the actual implementations, and make *usage* of streams easier, rather than implementing; for example, wrap objects don’t need to be provided by callers anymore. - Use `EmitAfterWrite()` and `EmitAfterShutdown()` handlers to call the corresponding JS handlers, rather than always trying to call them. This makes usage of streams by other C++ code easier and leaner. Also fix up some tests that were previously not actually testing asynchronicity when the comments indicated that they would. PR-URL: https://github.com/nodejs/node/pull/18676 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_http2.h')
-rw-r--r--src/node_http2.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/node_http2.h b/src/node_http2.h
index bf41d74ed4..0e81eaac6c 100644
--- a/src/node_http2.h
+++ b/src/node_http2.h
@@ -601,9 +601,6 @@ class Http2Stream : public AsyncWrap,
inline void Close(int32_t code);
- // Shutdown the writable side of the stream
- inline void Shutdown();
-
// Destroy this stream instance and free all held memory.
inline void Destroy();
@@ -818,6 +815,10 @@ class Http2Session : public AsyncWrap, public StreamListener {
inline void EmitStatistics();
+ inline StreamBase* underlying_stream() {
+ return static_cast<StreamBase*>(stream_);
+ }
+
void Start();
void Stop();
void Close(uint32_t code = NGHTTP2_NO_ERROR,
@@ -907,8 +908,6 @@ class Http2Session : public AsyncWrap, public StreamListener {
template <get_setting fn>
static void GetSettings(const FunctionCallbackInfo<Value>& args);
- WriteWrap* AllocateSend();
-
uv_loop_t* event_loop() const {
return env()->event_loop();
}