From f60a2aa982702ee82e17e48bbd07ae198a3b6cc8 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 8 Aug 2017 20:08:08 +0200 Subject: [PATCH] src: remove virtually unused ExecScope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/14697 Reviewed-By: Tobias Nießen Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- src/env-inl.h | 20 -------------------- src/env.h | 19 ------------------- src/node.cc | 3 ++- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index d31b3602e97e79..8107311ba70ca6 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -190,26 +190,6 @@ inline Environment::AsyncHooks::InitScope::~InitScope() { env_->async_hooks()->pop_ids(uid_fields_ref_[AsyncHooks::kCurrentAsyncId]); } -inline Environment::AsyncHooks::ExecScope::ExecScope( - Environment* env, double async_id, double trigger_id) - : env_(env), - async_id_(async_id), - disposed_(false) { - CHECK_GE(async_id, -1); - CHECK_GE(trigger_id, -1); - env->async_hooks()->push_ids(async_id, trigger_id); -} - -inline Environment::AsyncHooks::ExecScope::~ExecScope() { - if (disposed_) return; - Dispose(); -} - -inline void Environment::AsyncHooks::ExecScope::Dispose() { - disposed_ = true; - env_->async_hooks()->pop_ids(async_id_); -} - inline Environment::AsyncCallbackScope::AsyncCallbackScope(Environment* env) : env_(env) { env_->makecallback_cntr_++; diff --git a/src/env.h b/src/env.h index 9f9a3a23e314d2..fa4b289f314e16 100644 --- a/src/env.h +++ b/src/env.h @@ -416,25 +416,6 @@ class Environment { DISALLOW_COPY_AND_ASSIGN(InitScope); }; - // Used to manage the stack of async and trigger ids as calls are made into - // JS. Mainly used in MakeCallback(). - class ExecScope { - public: - ExecScope() = delete; - explicit ExecScope(Environment* env, double async_id, double trigger_id); - ~ExecScope(); - void Dispose(); - - private: - Environment* env_; - double async_id_; - // Manually track if the destructor has run so it isn't accidentally run - // twice on RAII cleanup. - bool disposed_; - - DISALLOW_COPY_AND_ASSIGN(ExecScope); - }; - private: friend class Environment; // So we can call the constructor. inline explicit AsyncHooks(v8::Isolate* isolate); diff --git a/src/node.cc b/src/node.cc index 0144ebb268f2bb..02a3083620bfbb 100644 --- a/src/node.cc +++ b/src/node.cc @@ -4590,8 +4590,9 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data, { Environment::AsyncCallbackScope callback_scope(&env); - Environment::AsyncHooks::ExecScope exec_scope(&env, 1, 0); + env.async_hooks()->push_ids(1, 0); LoadEnvironment(&env); + env.async_hooks()->pop_ids(1); } env.set_trace_sync_io(trace_sync_io);