Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: remove dead code in async_wrap #56065

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,31 +488,15 @@ AsyncWrap::AsyncWrap(Environment* env,
Local<Object> object,
ProviderType provider,
double execution_async_id)
: AsyncWrap(env, object, provider, execution_async_id, false) {}

AsyncWrap::AsyncWrap(Environment* env,
Local<Object> 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> 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> object)
: BaseObject(env, object),
context_frame_(env->isolate(),
Expand Down Expand Up @@ -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<Object> resource, double execution_async_id,
bool silent) {
void AsyncWrap::AsyncReset(Local<Object> resource, double execution_async_id) {
CHECK_NE(provider_type(), PROVIDER_NONE);

if (async_id_ != kInvalidAsyncId) {
Expand Down Expand Up @@ -642,8 +625,6 @@ void AsyncWrap::AsyncReset(Local<Object> 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_);
Expand Down
15 changes: 1 addition & 14 deletions src/async_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ class AsyncWrap : public BaseObject {
inline v8::Local<v8::Value> context_frame() const;

void AsyncReset(v8::Local<v8::Object> resource,
double execution_async_id = kInvalidAsyncId,
bool silent = false);
double execution_async_id = kInvalidAsyncId);

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

private:
friend class PromiseWrap;

AsyncWrap(Environment* env,
v8::Local<v8::Object> promise,
ProviderType provider,
double execution_async_id,
bool silent);
AsyncWrap(Environment* env,
v8::Local<v8::Object> 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.
Expand Down
Loading