| Index: src/v8.cc
|
| diff --git a/src/v8.cc b/src/v8.cc
|
| index b89bb7a69bb48afaab13dca1916c983fb7762cef..9c8917d6c5ebb49bdcf1c14ed0f6a04acccb7373 100644
|
| --- a/src/v8.cc
|
| +++ b/src/v8.cc
|
| @@ -148,15 +148,16 @@ void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) {
|
|
|
| void V8::FireCallCompletedCallback(Isolate* isolate) {
|
| bool has_call_completed_callbacks = call_completed_callbacks_ != NULL;
|
| - bool microtask_pending = isolate->microtask_pending();
|
| - if (!has_call_completed_callbacks && !microtask_pending) return;
|
| + bool run_microtasks = isolate->autorun_microtasks() &&
|
| + isolate->microtask_pending();
|
| + if (!has_call_completed_callbacks && !run_microtasks) return;
|
|
|
| HandleScopeImplementer* handle_scope_implementer =
|
| isolate->handle_scope_implementer();
|
| if (!handle_scope_implementer->CallDepthIsZero()) return;
|
| // Fire callbacks. Increase call depth to prevent recursive callbacks.
|
| handle_scope_implementer->IncrementCallDepth();
|
| - if (microtask_pending) Execution::RunMicrotasks(isolate);
|
| + if (run_microtasks) Execution::RunMicrotasks(isolate);
|
| if (has_call_completed_callbacks) {
|
| for (int i = 0; i < call_completed_callbacks_->length(); i++) {
|
| call_completed_callbacks_->at(i)();
|
| @@ -166,6 +167,27 @@ void V8::FireCallCompletedCallback(Isolate* isolate) {
|
| }
|
|
|
|
|
| +void V8::RunMicrotasks(Isolate* isolate) {
|
| + if (!isolate->microtask_pending())
|
| + return;
|
| +
|
| + HandleScopeImplementer* handle_scope_implementer =
|
| + isolate->handle_scope_implementer();
|
| + ASSERT(handle_scope_implementer->CallDepthIsZero());
|
| +
|
| + // Increase call depth to prevent recursive callbacks.
|
| + handle_scope_implementer->IncrementCallDepth();
|
| + Execution::RunMicrotasks(isolate);
|
| + handle_scope_implementer->DecrementCallDepth();
|
| +}
|
| +
|
| +
|
| +void V8::EnqueueExternalMicrotask(Isolate* isolate,
|
| + Handle<Object> handler) {
|
| + Execution::EnqueueExternalMicrotask(isolate, handler);
|
| +}
|
| +
|
| +
|
| void V8::InitializeOncePerProcessImpl() {
|
| FlagList::EnforceFlagImplications();
|
|
|
|
|