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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 #include "ast.h" | 9 #include "ast.h" |
10 #include "bootstrapper.h" | 10 #include "bootstrapper.h" |
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 // Fire callbacks. Increase call depth to prevent recursive callbacks. | 2245 // Fire callbacks. Increase call depth to prevent recursive callbacks. |
2246 handle_scope_implementer()->IncrementCallDepth(); | 2246 handle_scope_implementer()->IncrementCallDepth(); |
2247 if (run_microtasks) Execution::RunMicrotasks(this); | 2247 if (run_microtasks) Execution::RunMicrotasks(this); |
2248 for (int i = 0; i < call_completed_callbacks_.length(); i++) { | 2248 for (int i = 0; i < call_completed_callbacks_.length(); i++) { |
2249 call_completed_callbacks_.at(i)(); | 2249 call_completed_callbacks_.at(i)(); |
2250 } | 2250 } |
2251 handle_scope_implementer()->DecrementCallDepth(); | 2251 handle_scope_implementer()->DecrementCallDepth(); |
2252 } | 2252 } |
2253 | 2253 |
2254 | 2254 |
| 2255 void Isolate::RunMicrotasks() { |
| 2256 if (!microtask_pending()) |
| 2257 return; |
| 2258 |
| 2259 ASSERT(handle_scope_implementer()->CallDepthIsZero()); |
| 2260 |
| 2261 // Increase call depth to prevent recursive callbacks. |
| 2262 handle_scope_implementer()->IncrementCallDepth(); |
| 2263 Execution::RunMicrotasks(this); |
| 2264 handle_scope_implementer()->DecrementCallDepth(); |
| 2265 } |
| 2266 |
| 2267 |
2255 } } // namespace v8::internal | 2268 } } // namespace v8::internal |
OLD | NEW |