Chromium Code Reviews| Index: src/v8.cc |
| diff --git a/src/v8.cc b/src/v8.cc |
| index b89bb7a69bb48afaab13dca1916c983fb7762cef..3050bc2a22a44cc328c0c84d14d433f37be517bb 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,26 @@ 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::EnqueueMicrotask(Isolate* isolate, Handle<Object> microtask) { |
|
dcarney
2014/02/12 07:17:15
this function seems kinds of pointless now, maybe
rafaelw
2014/02/12 21:25:04
Excellent point =-). Removed.
On 2014/02/12 07:17
|
| + Execution::EnqueueMicrotask(isolate, microtask); |
| +} |
| + |
| + |
| void V8::InitializeOncePerProcessImpl() { |
| FlagList::EnforceFlagImplications(); |