Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1619)

Unified Diff: runtime/lib/timer_impl.dart

Issue 2995103002: [vm] Prevent non-fatal errors from causing timers to be dropped. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/isolate/non_fatal_exception_in_timer_callback_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/timer_impl.dart
diff --git a/runtime/lib/timer_impl.dart b/runtime/lib/timer_impl.dart
index 9a2d3ffbc1ac31eb29c984055da603f0cf609805..8c0a670abdfdaedafdb94b18d33dc589c7e4e2fa 100644
--- a/runtime/lib/timer_impl.dart
+++ b/runtime/lib/timer_impl.dart
@@ -348,8 +348,9 @@ class _Timer implements Timer {
// callbacks will be enqueued now and notified in the next spin at the
// earliest.
_handlingCallbacks = true;
+ var i = 0;
try {
- for (var i = 0; i < pendingTimers.length; i++) {
+ for (; i < pendingTimers.length; i++) {
// Next pending timer.
var timer = pendingTimers[i];
timer._indexOrNext = null;
@@ -378,6 +379,12 @@ class _Timer implements Timer {
}
} finally {
_handlingCallbacks = false;
+ // Re-queue timers we didn't get to.
+ for (i++; i < pendingTimers.length; i++) {
+ var timer = pendingTimers[i];
+ timer._enqueue();
+ }
+ _notifyEventHandler();
zra 2017/08/16 21:46:56 Would it be okay to only notify the event handler
rmacnak 2017/08/16 21:55:58 Even if no timers needs to be requeued, there may
}
}
« no previous file with comments | « no previous file | tests/isolate/non_fatal_exception_in_timer_callback_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698