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: avoid extra Persistent in DefaultTriggerAsyncIdScope #23844

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,20 @@ inline void Environment::AsyncHooks::clear_async_id_stack() {
inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
::DefaultTriggerAsyncIdScope(Environment* env,
double default_trigger_async_id)
: async_id_fields_ref_(env->async_hooks()->async_id_fields()) {
: async_hooks_(env->async_hooks()) {
if (env->async_hooks()->fields()[AsyncHooks::kCheck] > 0) {
CHECK_GE(default_trigger_async_id, 0);
}

old_default_trigger_async_id_ =
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId];
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId] =
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId];
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
default_trigger_async_id;
}

inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
::~DefaultTriggerAsyncIdScope() {
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId] =
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
old_default_trigger_async_id_;
}

Expand Down
2 changes: 1 addition & 1 deletion src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ class Environment {
~DefaultTriggerAsyncIdScope();

private:
AliasedBuffer<double, v8::Float64Array> async_id_fields_ref_;
AsyncHooks* async_hooks_;
double old_default_trigger_async_id_;

DISALLOW_COPY_AND_ASSIGN(DefaultTriggerAsyncIdScope);
Expand Down