| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 2692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) { | 2703 void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) { |
| 2704 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 2704 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
| 2705 if (callback == call_completed_callbacks_.at(i)) { | 2705 if (callback == call_completed_callbacks_.at(i)) { |
| 2706 call_completed_callbacks_.Remove(i); | 2706 call_completed_callbacks_.Remove(i); |
| 2707 } | 2707 } |
| 2708 } | 2708 } |
| 2709 } | 2709 } |
| 2710 | 2710 |
| 2711 | 2711 |
| 2712 void Isolate::FireCallCompletedCallback() { | 2712 void Isolate::FireCallCompletedCallback() { |
| 2713 bool has_call_completed_callbacks = !call_completed_callbacks_.is_empty(); | 2713 if (call_completed_callbacks_.is_empty()) return; |
| 2714 bool run_microtasks = autorun_microtasks() && pending_microtask_count(); | 2714 if (handle_scope_implementer()->GetCallDepth()) return; |
| 2715 if (!has_call_completed_callbacks && !run_microtasks) return; | |
| 2716 | |
| 2717 if (!handle_scope_implementer()->CallDepthIsZero()) return; | |
| 2718 if (run_microtasks) RunMicrotasks(); | |
| 2719 // Fire callbacks. Increase call depth to prevent recursive callbacks. | 2715 // Fire callbacks. Increase call depth to prevent recursive callbacks. |
| 2720 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this); | 2716 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this); |
| 2721 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); | 2717 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); |
| 2722 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 2718 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
| 2723 call_completed_callbacks_.at(i)(isolate); | 2719 call_completed_callbacks_.at(i)(isolate); |
| 2724 } | 2720 } |
| 2725 } | 2721 } |
| 2726 | 2722 |
| 2727 | 2723 |
| 2728 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { | 2724 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2972 // Then check whether this scope intercepts. | 2968 // Then check whether this scope intercepts. |
| 2973 if ((flag & intercept_mask_)) { | 2969 if ((flag & intercept_mask_)) { |
| 2974 intercepted_flags_ |= flag; | 2970 intercepted_flags_ |= flag; |
| 2975 return true; | 2971 return true; |
| 2976 } | 2972 } |
| 2977 return false; | 2973 return false; |
| 2978 } | 2974 } |
| 2979 | 2975 |
| 2980 } // namespace internal | 2976 } // namespace internal |
| 2981 } // namespace v8 | 2977 } // namespace v8 |
| OLD | NEW |