From 8fba1da5cb4abf28aac42f20d3d2ee62596b0364 Mon Sep 17 00:00:00 2001 From: Stephen Belanger Date: Wed, 18 Dec 2019 20:00:01 -0800 Subject: [PATCH] Clean up some unnecessary bits --- lib/internal/timers.js | 4 ---- src/async_wrap.cc | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/lib/internal/timers.js b/lib/internal/timers.js index 8cd42964d63251..c4ae1c5aafd5ba 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -97,8 +97,6 @@ const { emitBefore, emitAfter, emitDestroy, - popExecutionAsyncResource, - pushExecutionAsyncResource, } = require('internal/async_hooks'); // Symbols for storing async id state. @@ -540,7 +538,6 @@ function getTimerCallbacks(runNextTicks) { else timer._onTimeout(...args); } finally { - popExecutionAsyncResource(); if (timer._repeat && timer._idleTimeout !== -1) { timer._idleTimeout = timer._repeat; if (start === undefined) @@ -556,7 +553,6 @@ function getTimerCallbacks(runNextTicks) { } timer._destroyed = true; } - pushExecutionAsyncResource(timer); } emitAfter(asyncId); diff --git a/src/async_wrap.cc b/src/async_wrap.cc index d3fb8a1940703c..c6d621ce7abdfd 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -147,7 +147,6 @@ void AsyncWrap::EmitTraceEventBefore() { void AsyncWrap::EmitBefore(Environment* env, double async_id, v8::Local resource) { - v8::Local context = env->isolate()->GetCurrentContext(); env->async_hooks()->push_execution_async_resource(resource); Emit(env, async_id, AsyncHooks::kBefore, @@ -172,9 +171,6 @@ void AsyncWrap::EmitTraceEventAfter(ProviderType type, double async_id) { void AsyncWrap::EmitAfter(Environment* env, double async_id) { - Isolate* isolate = env->isolate(); - v8::Local context = env->isolate()->GetCurrentContext(); - // If the user's callback failed then the after() hooks will be called at the // end of _fatalException(). Emit(env, async_id, AsyncHooks::kAfter, @@ -400,24 +396,18 @@ static void RegisterDestroyHook(const FunctionCallbackInfo& args) { } static void GetExecutionAsyncResource(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); Environment* env = Environment::GetCurrent(args); - v8::Local context = isolate->GetCurrentContext(); args.GetReturnValue().Set(env->async_hooks()->get_execution_async_resource()); } static void PushExecutionAsyncResource( const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); Environment* env = Environment::GetCurrent(args); - v8::Local context = isolate->GetCurrentContext(); env->async_hooks()->push_execution_async_resource(args[0]); } static void PopExecutionAsyncResource(const FunctionCallbackInfo& args) { - Isolate* isolate = args.GetIsolate(); Environment* env = Environment::GetCurrent(args); - v8::Local context = isolate->GetCurrentContext(); env->async_hooks()->pop_execution_async_resource(); } @@ -514,8 +504,6 @@ void AsyncWrap::Initialize(Local target, env->SetMethod(target, "popExecutionAsyncResource", PopExecutionAsyncResource); - env->async_hooks()->push_execution_async_resource(v8::Object::New(isolate)); - PropertyAttribute ReadOnlyDontDelete = static_cast(ReadOnly | DontDelete);