| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 class _Timer implements Timer { | 5 class _Timer implements Timer { |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * Set jitter to wake up timer events that would happen in _TIMER_JITTER ms. | 8 * Set jitter to wake up timer events that would happen in _TIMER_JITTER ms. |
| 9 */ | 9 */ |
| 10 static final int _TIMER_JITTER = 0; | 10 static final int _TIMER_JITTER = 0; |
| 11 | 11 |
| 12 /* | 12 /* |
| 13 * Disables the timer. | 13 * Disables the timer. |
| 14 */ | 14 */ |
| 15 static final int _NO_TIMER = -1; | 15 static final int _NO_TIMER = -1; |
| 16 | 16 |
| 17 factory _Timer(void callback(Timer timer), | 17 factory _Timer(void callback(Timer timer), |
| 18 int milliSeconds, | 18 int milliSeconds, |
| 19 bool repeating) { | 19 [bool repeating = false]) { |
| 20 EventHandler._start(); | 20 EventHandler._start(); |
| 21 if (_timers === null) { | 21 if (_timers === null) { |
| 22 _timers = new DoubleLinkedQueue<_Timer>(); | 22 _timers = new DoubleLinkedQueue<_Timer>(); |
| 23 } | 23 } |
| 24 Timer timer = new _Timer._internal(); | 24 Timer timer = new _Timer._internal(); |
| 25 timer._callback = callback; | 25 timer._callback = callback; |
| 26 timer._milliSeconds = milliSeconds; | 26 timer._milliSeconds = milliSeconds; |
| 27 timer._wakeupTime = (new Date.now()).value + milliSeconds; | 27 timer._wakeupTime = (new Date.now()).value + milliSeconds; |
| 28 timer._repeating = repeating; | 28 timer._repeating = repeating; |
| 29 timer._addTimerToList(); | 29 timer._addTimerToList(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 static ReceivePort _receivePort; | 178 static ReceivePort _receivePort; |
| 179 static bool _handling_callbacks = false; | 179 static bool _handling_callbacks = false; |
| 180 | 180 |
| 181 var _callback; | 181 var _callback; |
| 182 int _milliSeconds; | 182 int _milliSeconds; |
| 183 int _wakeupTime; | 183 int _wakeupTime; |
| 184 bool _repeating; | 184 bool _repeating; |
| 185 } | 185 } |
| 186 | 186 |
| OLD | NEW |