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/tcp_wrap.cc | |
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/tcp_wrap.cc')
-rw-r--r-- | src/tcp_wrap.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 554b0216fa7..ff30be33635 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -88,9 +88,7 @@ void TCPWrap::Initialize(Local<Object> target, t->InstanceTemplate()->Set(env->onread_string(), Null(env->isolate())); t->InstanceTemplate()->Set(env->onconnection_string(), Null(env->isolate())); - AsyncWrap::AddWrapMethods(env, t, AsyncWrap::kFlagHasReset); - HandleWrap::AddWrapMethods(env, t); - LibuvStreamWrap::AddMethods(env, t); + t->Inherit(LibuvStreamWrap::GetConstructorTemplate(env)); env->SetProtoMethod(t, "open", Open); env->SetProtoMethod(t, "bind", Bind); @@ -115,7 +113,7 @@ void TCPWrap::Initialize(Local<Object> target, // Create FunctionTemplate for TCPConnectWrap. Local<FunctionTemplate> cwt = BaseObject::MakeLazilyInitializedJSTemplate(env); - AsyncWrap::AddWrapMethods(env, cwt); + cwt->Inherit(AsyncWrap::GetConstructorTemplate(env)); Local<String> wrapString = FIXED_ONE_BYTE_STRING(env->isolate(), "TCPConnectWrap"); cwt->SetClassName(wrapString); |