From 70f9cb098ff24cd6a06b65843471a0231a66206c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 27 Mar 2016 15:03:53 +0900 Subject: [PATCH] Use Environment::KickNextTick --- atom/common/api/atom_bindings.cc | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index a000f6fc743a..fe53d8793f2a 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -98,24 +98,8 @@ void AtomBindings::OnCallNextTick(uv_async_t* handle) { self->pending_next_ticks_.begin(); it != self->pending_next_ticks_.end(); ++it) { node::Environment* env = *it; - node::Environment::TickInfo* tick_info = env->tick_info(); - - v8::Context::Scope context_scope(env->context()); - if (tick_info->in_tick()) - continue; - - if (tick_info->length() == 0) { - env->isolate()->RunMicrotasks(); - } - - if (tick_info->length() == 0) { - tick_info->set_index(0); - continue; - } - - tick_info->set_in_tick(true); - env->tick_callback_function()->Call(env->process_object(), 0, NULL); - tick_info->set_in_tick(false); + node::Environment::AsyncCallbackScope callback_scope(env); + env->KickNextTick(&callback_scope); } self->pending_next_ticks_.clear();