From 83eaaf9731356a95fb3282724b2cb2fb0e2c5121 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 5 Oct 2020 14:59:55 -0700 Subject: [PATCH] src: remove unused AsyncWrapObject Following the crypto subsystem refactor, this is now unused. Begone!! Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/35511 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/async_wrap.cc | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 6567f08e2db237..bb15bf6adb1262 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -54,7 +54,6 @@ using v8::PropertyAttribute; using v8::PropertyCallbackInfo; using v8::ReadOnly; using v8::String; -using v8::Uint32; using v8::Undefined; using v8::Value; using v8::WeakCallbackInfo; @@ -71,45 +70,6 @@ static const char* const provider_names[] = { #undef V }; - -struct AsyncWrapObject : public AsyncWrap { - static inline void New(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - CHECK(args.IsConstructCall()); - CHECK(env->async_wrap_object_ctor_template()->HasInstance(args.This())); - CHECK(args[0]->IsUint32()); - auto type = static_cast(args[0].As()->Value()); - new AsyncWrapObject(env, args.This(), type); - } - - inline AsyncWrapObject(Environment* env, Local object, - ProviderType type) : AsyncWrap(env, object, type) {} - - static Local GetConstructorTemplate(Environment* env) { - Local tmpl = env->async_wrap_object_ctor_template(); - if (tmpl.IsEmpty()) { - tmpl = env->NewFunctionTemplate(AsyncWrapObject::New); - tmpl->SetClassName( - FIXED_ONE_BYTE_STRING(env->isolate(), "AsyncWrap")); - tmpl->Inherit(AsyncWrap::GetConstructorTemplate(env)); - tmpl->InstanceTemplate()->SetInternalFieldCount( - AsyncWrapObject::kInternalFieldCount); - env->set_async_wrap_object_ctor_template(tmpl); - } - return tmpl; - } - - bool IsNotIndicativeOfMemoryLeakAtExit() const override { - // We can't really know what the underlying operation does. One of the - // signs that it's time to remove this class. :) - return true; - } - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(AsyncWrapObject) - SET_SELF_SIZE(AsyncWrapObject) -}; - void AsyncWrap::DestroyAsyncIdsCallback(Environment* env) { Local fn = env->async_hooks_destroy_function(); @@ -751,11 +711,6 @@ void AsyncWrap::Initialize(Local target, env->set_async_hooks_promise_resolve_function(Local()); env->set_async_hooks_binding(target); - target->Set(env->context(), - FIXED_ONE_BYTE_STRING(env->isolate(), "AsyncWrap"), - AsyncWrapObject::GetConstructorTemplate(env) - ->GetFunction(env->context()).ToLocalChecked()).Check(); - // TODO(qard): maybe this should be GetConstructorTemplate instead? PromiseWrap::Initialize(env); } @@ -772,7 +727,6 @@ void AsyncWrap::RegisterExternalReferences( registry->Register(EnablePromiseHook); registry->Register(DisablePromiseHook); registry->Register(RegisterDestroyHook); - registry->Register(AsyncWrapObject::New); registry->Register(AsyncWrap::GetAsyncId); registry->Register(AsyncWrap::AsyncReset); registry->Register(AsyncWrap::GetProviderType);