diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-09-23 20:24:33 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-10-03 23:43:42 +0300 |
commit | d527dde3600655eae7ce0ba5da9263ec4560cd11 (patch) | |
tree | cb9186b8b85a696ec7f916f40fcec935ba86fdc9 /src/stream_wrap.h | |
parent | 2ebdba12297348649620e3d302b156c149d85a6e (diff) |
src: use JS inheritance for `AsyncWrap`
For all classes descending from `AsyncWrap`, use JS inheritance
instead of manually adding methods to the individual classes.
This allows cleanup of some code around transferring handles
over IPC.
PR-URL: https://github.com/nodejs/node/pull/23094
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/stream_wrap.h')
-rw-r--r-- | src/stream_wrap.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stream_wrap.h b/src/stream_wrap.h index 487a40b7ffc..98f0ca4ac4f 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -76,6 +76,8 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase { ShutdownWrap* CreateShutdownWrap(v8::Local<v8::Object> object) override; WriteWrap* CreateWriteWrap(v8::Local<v8::Object> object) override; + static LibuvStreamWrap* From(Environment* env, v8::Local<v8::Object> object); + protected: LibuvStreamWrap(Environment* env, v8::Local<v8::Object> object, @@ -84,8 +86,8 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase { AsyncWrap* GetAsyncWrap() override; - static void AddMethods(Environment* env, - v8::Local<v8::FunctionTemplate> target); + static v8::Local<v8::FunctionTemplate> GetConstructorTemplate( + Environment* env); protected: inline void set_fd(int fd) { |