summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorMatteo Collina <hello@matteocollina.com>2018-05-04 08:00:07 +0200
committerAnna Henningsen <anna@addaleax.net>2020-02-11 20:59:09 +0100
commit9fdb6e6aaf45b2364bac89a8f240772f49503ee6 (patch)
tree6ffbc990c3bdad00c598217cd6a63770a9d1cd3b /src/api
parent1c11ea43883256b6bc9e64a28bbc22f88c5c2b38 (diff)
downloadnode-new-9fdb6e6aaf45b2364bac89a8f240772f49503ee6.tar.gz
async_hooks: add executionAsyncResource
Remove the need for the destroy hook in the basic APM case. Co-authored-by: Stephen Belanger <admin@stephenbelanger.com> PR-URL: https://github.com/nodejs/node/pull/30959 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/api')
-rw-r--r--src/api/callback.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/api/callback.cc b/src/api/callback.cc
index 5e3fd65903..74a7836391 100644
--- a/src/api/callback.cc
+++ b/src/api/callback.cc
@@ -36,7 +36,7 @@ CallbackScope::~CallbackScope() {
InternalCallbackScope::InternalCallbackScope(AsyncWrap* async_wrap, int flags)
: InternalCallbackScope(async_wrap->env(),
- async_wrap->object(),
+ async_wrap->GetResource(),
{ async_wrap->get_async_id(),
async_wrap->get_trigger_async_id() },
flags) {}
@@ -50,7 +50,6 @@ InternalCallbackScope::InternalCallbackScope(Environment* env,
object_(object),
skip_hooks_(flags & kSkipAsyncHooks),
skip_task_queues_(flags & kSkipTaskQueues) {
- CHECK_IMPLIES(!(flags & kAllowEmptyResource), !object.IsEmpty());
CHECK_NOT_NULL(env);
env->PushAsyncCallbackScope();
@@ -69,8 +68,9 @@ InternalCallbackScope::InternalCallbackScope(Environment* env,
AsyncWrap::EmitBefore(env, asyncContext.async_id);
}
- env->async_hooks()->push_async_ids(async_context_.async_id,
- async_context_.trigger_async_id);
+ env->async_hooks()->push_async_context(async_context_.async_id,
+ async_context_.trigger_async_id, object);
+
pushed_ids_ = true;
}
@@ -89,7 +89,7 @@ void InternalCallbackScope::Close() {
}
if (pushed_ids_)
- env_->async_hooks()->pop_async_id(async_context_.async_id);
+ env_->async_hooks()->pop_async_context(async_context_.async_id);
if (failed_) return;