Index: sdk/lib/io/timer_impl.dart |
diff --git a/sdk/lib/io/timer_impl.dart b/sdk/lib/io/timer_impl.dart |
index 1d7b277c2189463e6d1bec90dcfc38e32c687dc4..f03b6180e5e17c2c3c1788fb387e46da667e4565 100644 |
--- a/sdk/lib/io/timer_impl.dart |
+++ b/sdk/lib/io/timer_impl.dart |
@@ -29,7 +29,10 @@ class _Timer extends LinkedListEntry<_Timer> implements Timer { |
} |
timer._milliSeconds = repeating ? milliSeconds : -1; |
timer._addTimerToList(); |
- timer._notifyEventHandler(); |
+ if (identical(timer, _timers.first)) { |
+ // The new timer is the first in queue. Update event handler. |
+ timer._notifyEventHandler(); |
+ } |
return timer; |
} |
@@ -72,9 +75,8 @@ class _Timer extends LinkedListEntry<_Timer> implements Timer { |
_wakeupTime += _milliSeconds; |
} |
- // Adds a timer to the timer list and resets the native timer if it is the |
- // earliest timer in the list. Timers with the same wakeup time are enqueued |
- // in order and notified in FIFO order. |
+ // Adds a timer to the timer list. Timers with the same wakeup time are |
+ // enqueued in order and notified in FIFO order. |
void _addTimerToList() { |
_Timer entry = _timers.isEmpty ? null : _timers.first; |
while (entry != null) { |