Handle v8::MicrotasksScope in the main process

This commit is contained in:
Cheng Zhao 2016-06-24 14:45:31 +09:00
parent 5826a8f9a9
commit ee28f4fc32
7 changed files with 27 additions and 25 deletions

View file

@ -16,11 +16,8 @@ v8::Local<v8::Value> CallEmitWithArgs(v8::Isolate* isolate,
v8::Local<v8::Object> obj,
ValueVector* args) {
// Perform microtask checkpoint after running JavaScript.
std::unique_ptr<v8::MicrotasksScope> script_scope(
Locker::IsBrowserProcess() ?
nullptr :
new v8::MicrotasksScope(isolate,
v8::MicrotasksScope::kRunMicrotasks));
v8::MicrotasksScope script_scope(
isolate, v8::MicrotasksScope::kRunMicrotasks);
// Use node::MakeCallback to call the callback, and it will also run pending
// tasks in Node.js.
return node::MakeCallback(