From 5e7c69716ecbb7a0ebceaed7cc1c6847f9bc5058 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 18 Aug 2017 22:37:37 -0700 Subject: src: reduce code duplication Adds `AsyncWrap::AddWrapMethods()` to add common methods to a `Local`. Follows same pattern as stream base. PR-URL: https://github.com/nodejs/node/pull/14937 Reviewed-By: Anna Henningsen --- src/pipe_wrap.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pipe_wrap.cc') diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 0daec0b144..e29cf6d70f 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -72,7 +72,7 @@ void PipeWrap::Initialize(Local target, t->SetClassName(pipeString); t->InstanceTemplate()->SetInternalFieldCount(1); - env->SetProtoMethod(t, "getAsyncId", AsyncWrap::GetAsyncId); + AsyncWrap::AddWrapMethods(env, t); env->SetProtoMethod(t, "close", HandleWrap::Close); env->SetProtoMethod(t, "unref", HandleWrap::Unref); @@ -104,7 +104,7 @@ void PipeWrap::Initialize(Local target, }; auto cwt = FunctionTemplate::New(env->isolate(), constructor); cwt->InstanceTemplate()->SetInternalFieldCount(1); - env->SetProtoMethod(cwt, "getAsyncId", AsyncWrap::GetAsyncId); + AsyncWrap::AddWrapMethods(env, cwt); Local wrapString = FIXED_ONE_BYTE_STRING(env->isolate(), "PipeConnectWrap"); cwt->SetClassName(wrapString); -- cgit v1.2.3