Use InternalCallbackScope for ticking event loop

This commit is contained in:
Cheng Zhao 2018-03-09 14:54:25 +09:00
parent 50a5a69c46
commit 5d2452608d
3 changed files with 8 additions and 11 deletions

View file

@ -97,16 +97,11 @@ void AtomBindings::OnCallNextTick(uv_async_t* handle) {
for (std::list<node::Environment*>::const_iterator it =
self->pending_next_ticks_.begin();
it != self->pending_next_ticks_.end(); ++it) {
node::Environment* env = *it;
// KickNextTick, copied from node.cc:
node::Environment::AsyncCallbackScope callback_scope(env);
if (callback_scope.in_makecallback())
continue;
node::Environment::TickInfo* tick_info = env->tick_info();
if (!tick_info->has_scheduled())
env->isolate()->RunMicrotasks();
v8::Local<v8::Object> process = env->process_object();
env->tick_callback_function()->Call(process, 0, nullptr).IsEmpty();
node::InternalCallbackScope scope(
*it,
v8::Local<v8::Object>(),
{0, 0},
node::InternalCallbackScope::kAllowEmptyResource);
}
self->pending_next_ticks_.clear();