From d53706152f2d26371db3160d4db47f7c051c53c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= Date: Sun, 1 Dec 2024 19:50:15 +0100 Subject: [PATCH] src: remove dead code in async_wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The silent option for AsyncWrap and AsyncReset is not used anywhere. Seems like a leftover from times PromiseWrap was used. PR-URL: https://github.com/nodejs/node/pull/56065 Refs: https://github.com/nodejs/node/pull/39135 Reviewed-By: Chengzhong Wu Reviewed-By: Juan José Arboleda Reviewed-By: Anna Henningsen --- src/async_wrap.cc | 23 ++--------------------- src/async_wrap.h | 15 +-------------- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 8868245403d658..30490b90e77b64 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -488,31 +488,15 @@ AsyncWrap::AsyncWrap(Environment* env, Local object, ProviderType provider, double execution_async_id) - : AsyncWrap(env, object, provider, execution_async_id, false) {} - -AsyncWrap::AsyncWrap(Environment* env, - Local object, - ProviderType provider, - double execution_async_id, - bool silent) : AsyncWrap(env, object) { CHECK_NE(provider, PROVIDER_NONE); provider_type_ = provider; // Use AsyncReset() call to execute the init() callbacks. - AsyncReset(object, execution_async_id, silent); + AsyncReset(object, execution_async_id); init_hook_ran_ = true; } -AsyncWrap::AsyncWrap(Environment* env, - Local object, - ProviderType provider, - double execution_async_id, - double trigger_async_id) - : AsyncWrap(env, object, provider, execution_async_id, true) { - trigger_async_id_ = trigger_async_id; -} - AsyncWrap::AsyncWrap(Environment* env, Local object) : BaseObject(env, object), context_frame_(env->isolate(), @@ -592,8 +576,7 @@ void AsyncWrap::EmitDestroy(Environment* env, double async_id) { // Generalized call for both the constructor and for handles that are pooled // and reused over their lifetime. This way a new uid can be assigned when // the resource is pulled out of the pool and put back into use. -void AsyncWrap::AsyncReset(Local resource, double execution_async_id, - bool silent) { +void AsyncWrap::AsyncReset(Local resource, double execution_async_id) { CHECK_NE(provider_type(), PROVIDER_NONE); if (async_id_ != kInvalidAsyncId) { @@ -642,8 +625,6 @@ void AsyncWrap::AsyncReset(Local resource, double execution_async_id, context_frame_.Reset(isolate, async_context_frame::current(isolate)); - if (silent) return; - EmitAsyncInit(env(), resource, env()->async_hooks()->provider_string(provider_type()), async_id_, trigger_async_id_); diff --git a/src/async_wrap.h b/src/async_wrap.h index d656f72fdabd62..5b33290b4bb2d0 100644 --- a/src/async_wrap.h +++ b/src/async_wrap.h @@ -190,8 +190,7 @@ class AsyncWrap : public BaseObject { inline v8::Local context_frame() const; void AsyncReset(v8::Local resource, - double execution_async_id = kInvalidAsyncId, - bool silent = false); + double execution_async_id = kInvalidAsyncId); // Only call these within a valid HandleScope. v8::MaybeLocal MakeCallback(const v8::Local cb, @@ -224,18 +223,6 @@ class AsyncWrap : public BaseObject { bool IsDoneInitializing() const override; private: - friend class PromiseWrap; - - AsyncWrap(Environment* env, - v8::Local promise, - ProviderType provider, - double execution_async_id, - bool silent); - AsyncWrap(Environment* env, - v8::Local promise, - ProviderType provider, - double execution_async_id, - double trigger_async_id); ProviderType provider_type_ = PROVIDER_NONE; bool init_hook_ran_ = false; // Because the values may be Reset(), cannot be made const.