From 5a494aed8c1ec5cc7cff364b6b41ae05bb5765a1 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 bb2160d73d6367..0d3bfc808d43dc 100644 --- a/src/env.cc +++ b/src/env.cc @@ -161,6 +161,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 fe6293f62a2adc..2576f016c1477a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2896,12 +2896,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);