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 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 2703 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
2704 if (callback == call_completed_callbacks_.at(i)) { | 2704 if (callback == call_completed_callbacks_.at(i)) { |
2705 call_completed_callbacks_.Remove(i); | 2705 call_completed_callbacks_.Remove(i); |
2706 } | 2706 } |
2707 } | 2707 } |
2708 } | 2708 } |
2709 | 2709 |
2710 | 2710 |
2711 void Isolate::FireCallCompletedCallback() { | 2711 void Isolate::FireCallCompletedCallback() { |
2712 bool has_call_completed_callbacks = !call_completed_callbacks_.is_empty(); | 2712 bool has_call_completed_callbacks = !call_completed_callbacks_.is_empty(); |
2713 bool run_microtasks = autorun_microtasks() && pending_microtask_count(); | 2713 bool run_microtasks = |
| 2714 pending_microtask_count() && |
| 2715 !handle_scope_implementer()->HasMicrotasksSuppressions() && |
| 2716 handle_scope_implementer()->microtasks_policy() == |
| 2717 v8::MicrotasksPolicy::kAuto; |
2714 if (!has_call_completed_callbacks && !run_microtasks) return; | 2718 if (!has_call_completed_callbacks && !run_microtasks) return; |
2715 | 2719 |
2716 if (!handle_scope_implementer()->CallDepthIsZero()) return; | 2720 if (!handle_scope_implementer()->CallDepthIsZero()) return; |
2717 if (run_microtasks) RunMicrotasks(); | 2721 if (run_microtasks) RunMicrotasks(); |
2718 // Fire callbacks. Increase call depth to prevent recursive callbacks. | 2722 // Fire callbacks. Increase call depth to prevent recursive callbacks. |
2719 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this); | 2723 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this); |
2720 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); | 2724 v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate); |
2721 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 2725 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
2722 call_completed_callbacks_.at(i)(isolate); | 2726 call_completed_callbacks_.at(i)(isolate); |
2723 } | 2727 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2971 // Then check whether this scope intercepts. | 2975 // Then check whether this scope intercepts. |
2972 if ((flag & intercept_mask_)) { | 2976 if ((flag & intercept_mask_)) { |
2973 intercepted_flags_ |= flag; | 2977 intercepted_flags_ |= flag; |
2974 return true; | 2978 return true; |
2975 } | 2979 } |
2976 return false; | 2980 return false; |
2977 } | 2981 } |
2978 | 2982 |
2979 } // namespace internal | 2983 } // namespace internal |
2980 } // namespace v8 | 2984 } // namespace v8 |
OLD | NEW |