Skip to content

Commit 442a7a8

Browse files
Flarnanodejs-github-bot
authored andcommitted
src: remove dead code in async_wrap
The silent option for AsyncWrap and AsyncReset is not used anywhere. Seems like a leftover from times PromiseWrap was used. PR-URL: nodejs#56065 Refs: nodejs#39135 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent cff7ec8 commit 442a7a8

File tree

2 files changed

+3
-35
lines changed

2 files changed

+3
-35
lines changed

src/async_wrap.cc

+2-21
Original file line numberDiff line numberDiff line change
@@ -488,31 +488,15 @@ AsyncWrap::AsyncWrap(Environment* env,
488488
Local<Object> object,
489489
ProviderType provider,
490490
double execution_async_id)
491-
: AsyncWrap(env, object, provider, execution_async_id, false) {}
492-
493-
AsyncWrap::AsyncWrap(Environment* env,
494-
Local<Object> object,
495-
ProviderType provider,
496-
double execution_async_id,
497-
bool silent)
498491
: AsyncWrap(env, object) {
499492
CHECK_NE(provider, PROVIDER_NONE);
500493
provider_type_ = provider;
501494

502495
// Use AsyncReset() call to execute the init() callbacks.
503-
AsyncReset(object, execution_async_id, silent);
496+
AsyncReset(object, execution_async_id);
504497
init_hook_ran_ = true;
505498
}
506499

507-
AsyncWrap::AsyncWrap(Environment* env,
508-
Local<Object> object,
509-
ProviderType provider,
510-
double execution_async_id,
511-
double trigger_async_id)
512-
: AsyncWrap(env, object, provider, execution_async_id, true) {
513-
trigger_async_id_ = trigger_async_id;
514-
}
515-
516500
AsyncWrap::AsyncWrap(Environment* env, Local<Object> object)
517501
: BaseObject(env, object),
518502
context_frame_(env->isolate(),
@@ -592,8 +576,7 @@ void AsyncWrap::EmitDestroy(Environment* env, double async_id) {
592576
// Generalized call for both the constructor and for handles that are pooled
593577
// and reused over their lifetime. This way a new uid can be assigned when
594578
// the resource is pulled out of the pool and put back into use.
595-
void AsyncWrap::AsyncReset(Local<Object> resource, double execution_async_id,
596-
bool silent) {
579+
void AsyncWrap::AsyncReset(Local<Object> resource, double execution_async_id) {
597580
CHECK_NE(provider_type(), PROVIDER_NONE);
598581

599582
if (async_id_ != kInvalidAsyncId) {
@@ -642,8 +625,6 @@ void AsyncWrap::AsyncReset(Local<Object> resource, double execution_async_id,
642625

643626
context_frame_.Reset(isolate, async_context_frame::current(isolate));
644627

645-
if (silent) return;
646-
647628
EmitAsyncInit(env(), resource,
648629
env()->async_hooks()->provider_string(provider_type()),
649630
async_id_, trigger_async_id_);

src/async_wrap.h

+1-14
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ class AsyncWrap : public BaseObject {
190190
inline v8::Local<v8::Value> context_frame() const;
191191

192192
void AsyncReset(v8::Local<v8::Object> resource,
193-
double execution_async_id = kInvalidAsyncId,
194-
bool silent = false);
193+
double execution_async_id = kInvalidAsyncId);
195194

196195
// Only call these within a valid HandleScope.
197196
v8::MaybeLocal<v8::Value> MakeCallback(const v8::Local<v8::Function> cb,
@@ -224,18 +223,6 @@ class AsyncWrap : public BaseObject {
224223
bool IsDoneInitializing() const override;
225224

226225
private:
227-
friend class PromiseWrap;
228-
229-
AsyncWrap(Environment* env,
230-
v8::Local<v8::Object> promise,
231-
ProviderType provider,
232-
double execution_async_id,
233-
bool silent);
234-
AsyncWrap(Environment* env,
235-
v8::Local<v8::Object> promise,
236-
ProviderType provider,
237-
double execution_async_id,
238-
double trigger_async_id);
239226
ProviderType provider_type_ = PROVIDER_NONE;
240227
bool init_hook_ran_ = false;
241228
// Because the values may be Reset(), cannot be made const.

0 commit comments

Comments
 (0)