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-08 06:59:10 +0300
committerAnna Henningsen <anna@addaleax.net>2018-02-14 12:00:29 +0300
commit0e7b61229aa602e55c5fb034a63d7da97eecff3b (patch)
tree0e64305591fd94e1b609c5fd4ba1ae1bd19ea66a /src/stream_wrap.h
parent0ed9ea861b847579478457b7f5aab430fb6d77cb (diff)
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/stream_wrap.h')
-rw-r--r--src/stream_wrap.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/stream_wrap.h b/src/stream_wrap.h
index e5ad25b91e6..a97e8ba10f9 100644
--- a/src/stream_wrap.h
+++ b/src/stream_wrap.h
@@ -73,6 +73,9 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase {
return stream()->type == UV_TCP;
}
+ ShutdownWrap* CreateShutdownWrap(v8::Local<v8::Object> object) override;
+ WriteWrap* CreateWriteWrap(v8::Local<v8::Object> object) override;
+
protected:
LibuvStreamWrap(Environment* env,
v8::Local<v8::Object> object,