Skip to content

Commit

Permalink
Clean up some unnecessary bits
Browse files Browse the repository at this point in the history
  • Loading branch information
Qard committed Dec 19, 2019
1 parent 01add3b commit 8fba1da
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
4 changes: 0 additions & 4 deletions lib/internal/timers.js
Expand Up @@ -97,8 +97,6 @@ const {
emitBefore,
emitAfter,
emitDestroy,
popExecutionAsyncResource,
pushExecutionAsyncResource,
} = require('internal/async_hooks');

// Symbols for storing async id state.
Expand Down Expand Up @@ -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)
Expand All @@ -556,7 +553,6 @@ function getTimerCallbacks(runNextTicks) {
}
timer._destroyed = true;
}
pushExecutionAsyncResource(timer);
}

emitAfter(asyncId);
Expand Down
12 changes: 0 additions & 12 deletions src/async_wrap.cc
Expand Up @@ -147,7 +147,6 @@ void AsyncWrap::EmitTraceEventBefore() {

void AsyncWrap::EmitBefore(Environment* env, double async_id,
v8::Local<v8::Object> resource) {
v8::Local<v8::Context> context = env->isolate()->GetCurrentContext();
env->async_hooks()->push_execution_async_resource(resource);

Emit(env, async_id, AsyncHooks::kBefore,
Expand All @@ -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<v8::Context> 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,
Expand Down Expand Up @@ -400,24 +396,18 @@ static void RegisterDestroyHook(const FunctionCallbackInfo<Value>& args) {
}

static void GetExecutionAsyncResource(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Environment* env = Environment::GetCurrent(args);
v8::Local<v8::Context> context = isolate->GetCurrentContext();
args.GetReturnValue().Set(env->async_hooks()->get_execution_async_resource());
}

static void PushExecutionAsyncResource(
const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Environment* env = Environment::GetCurrent(args);
v8::Local<v8::Context> context = isolate->GetCurrentContext();
env->async_hooks()->push_execution_async_resource(args[0]);
}

static void PopExecutionAsyncResource(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Environment* env = Environment::GetCurrent(args);
v8::Local<v8::Context> context = isolate->GetCurrentContext();
env->async_hooks()->pop_execution_async_resource();
}

Expand Down Expand Up @@ -514,8 +504,6 @@ void AsyncWrap::Initialize(Local<Object> target,
env->SetMethod(target, "popExecutionAsyncResource",
PopExecutionAsyncResource);

env->async_hooks()->push_execution_async_resource(v8::Object::New(isolate));

PropertyAttribute ReadOnlyDontDelete =
static_cast<PropertyAttribute>(ReadOnly | DontDelete);

Expand Down

0 comments on commit 8fba1da

Please sign in to comment.