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
|
} |
} |