diff options
author | Nicolai Stange <nicstange@gmail.com> | 2020-11-29 03:11:30 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2020-12-11 04:45:16 -0800 |
commit | c53ba1f6188b667654b389e47f515ffcf776cb55 (patch) | |
tree | d77a54e0efc5b7b8d7494d12da32f58e12bc1c85 /src/node_perf.cc | |
parent | 348a3adacb5a3893ef07d89315e91c2e71036d10 (diff) | |
download | node-new-c53ba1f6188b667654b389e47f515ffcf776cb55.tar.gz |
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 <zaubernerd@zaubernerd.de>
PR-URL: https://github.com/nodejs/node/pull/36343
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/node_perf.cc')
-rw-r--r-- | src/node_perf.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/node_perf.cc b/src/node_perf.cc index 5fa4eabc99..1eddb00f48 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -159,11 +159,10 @@ void PerformanceEntry::Notify(Environment* env, AliasedUint32Array& observers = env->performance_state()->observers; if (!env->performance_entry_callback().IsEmpty() && type != NODE_PERFORMANCE_ENTRY_TYPE_INVALID && observers[type]) { - node::MakeCallback(env->isolate(), - object.As<Object>(), - env->performance_entry_callback(), - 1, &object, - node::async_context{0, 0}); + node::MakeSyncCallback(env->isolate(), + object.As<Object>(), + env->performance_entry_callback(), + 1, &object); } } |