Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fef17b7

Browse filesBrowse files
addaleaxtargos
authored andcommitted
src: avoid extra Persistent in DefaultTriggerAsyncIdScope
Instead of getting a reference to the main `AliasedBuffer`, which would always unnecesarily allocate and destroy a `Persistent` handle, store and use a reference to the owning object. PR-URL: #23844 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent 22caa26 commit fef17b7
Copy full SHA for fef17b7

File tree

Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Open diff view settings
Collapse file

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,20 @@ inline void Environment::AsyncHooks::clear_async_id_stack() {
186186
inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
187187
::DefaultTriggerAsyncIdScope(Environment* env,
188188
double default_trigger_async_id)
189-
: async_id_fields_ref_(env->async_hooks()->async_id_fields()) {
189+
: async_hooks_(env->async_hooks()) {
190190
if (env->async_hooks()->fields()[AsyncHooks::kCheck] > 0) {
191191
CHECK_GE(default_trigger_async_id, 0);
192192
}
193193

194194
old_default_trigger_async_id_ =
195-
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId];
196-
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId] =
195+
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId];
196+
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
197197
default_trigger_async_id;
198198
}
199199

200200
inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
201201
::~DefaultTriggerAsyncIdScope() {
202-
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId] =
202+
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
203203
old_default_trigger_async_id_;
204204
}
205205

Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class Environment {
487487
~DefaultTriggerAsyncIdScope();
488488

489489
private:
490-
AliasedBuffer<double, v8::Float64Array> async_id_fields_ref_;
490+
AsyncHooks* async_hooks_;
491491
double old_default_trigger_async_id_;
492492

493493
DISALLOW_COPY_AND_ASSIGN(DefaultTriggerAsyncIdScope);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.