Skip to content

Commit e2ced0d

Browse files
nicstangetargos
authored andcommitted
perf_hooks: invoke performance_entry_callback via MakeSyncCallback()
It's desirable to retain async_contexts active at callsites of perf_hooks.performance.mark() and alike in the subsequent PerformanceObserver invocations such that the latter can access e.g. associated AsyncLocalStorage instances. In working towards this goal replace the node::MakeCallback(..., async_context{0, 0}) in PerformanceEntry::doNotify() by the new node::MakeSyncCallback() introduced specifically for this purpose. This change will retain the original async_context, if any, in perf_hook's observersCallback() and thus, for the subsequent doNotify() on unbuffered PerformanceObservers. Co-Authored-By: ZauberNerd <[email protected]> PR-URL: #36343 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 4f3d7bb commit e2ced0d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/node_perf.cc

+4-5
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,10 @@ void PerformanceEntry::Notify(Environment* env,
159159
AliasedUint32Array& observers = env->performance_state()->observers;
160160
if (!env->performance_entry_callback().IsEmpty() &&
161161
type != NODE_PERFORMANCE_ENTRY_TYPE_INVALID && observers[type]) {
162-
node::MakeCallback(env->isolate(),
163-
object.As<Object>(),
164-
env->performance_entry_callback(),
165-
1, &object,
166-
node::async_context{0, 0});
162+
node::MakeSyncCallback(env->isolate(),
163+
object.As<Object>(),
164+
env->performance_entry_callback(),
165+
1, &object);
167166
}
168167
}
169168

0 commit comments

Comments
 (0)