From 1747d707d77f459f061d51fcd551cda9db6ed1cf Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 10 Sep 2018 06:23:59 +0200 Subject: [PATCH] src: move no_async_hooks_checks to env This commit moves the setting of AsyncHooks no_force_checks to the Environment constructor instead of from the Start function in node.cc. PR-URL: https://github.com/nodejs/node/pull/22784 Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/env.cc | 3 +++ src/node.cc | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/env.cc b/src/env.cc index a2145ab46b9..0b0664b2861 100644 --- a/src/env.cc +++ b/src/env.cc @@ -189,6 +189,9 @@ Environment::Environment(IsolateData* isolate_data, isolate()->GetHeapProfiler()->AddBuildEmbedderGraphCallback( BuildEmbedderGraph, this); + if (options_->no_force_async_hooks_checks) { + async_hooks_.no_force_checks(); + } } Environment::~Environment() { diff --git a/src/node.cc b/src/node.cc index b4481f348b4..4a161eb3b28 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2894,12 +2894,6 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, return 12; // Signal internal error. } - // TODO(addaleax): Maybe access this option directly instead of setting - // a boolean member of Environment. Ditto below for trace_sync_io. - if (env.options()->no_force_async_hooks_checks) { - env.async_hooks()->no_force_checks(); - } - { Environment::AsyncCallbackScope callback_scope(&env); env.async_hooks()->push_async_ids(1, 0);