| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Set jitter to wake up timer events that would happen in _TIMER_JITTER ms. | 6 // Set jitter to wake up timer events that would happen in _TIMER_JITTER ms. |
| 7 static final int _TIMER_JITTER = 0; | 7 static final int _TIMER_JITTER = 0; |
| 8 | 8 |
| 9 // Disables the timer. | 9 // Disables the timer. |
| 10 static final int _NO_TIMER = -1; | 10 static final int _NO_TIMER = -1; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 static ReceivePort _receivePort; | 179 static ReceivePort _receivePort; |
| 180 static bool _handling_callbacks = false; | 180 static bool _handling_callbacks = false; |
| 181 | 181 |
| 182 var _callback; | 182 var _callback; |
| 183 int _milliSeconds; | 183 int _milliSeconds; |
| 184 int _wakeupTime; | 184 int _wakeupTime; |
| 185 bool _repeating; | 185 bool _repeating; |
| 186 } | 186 } |
| 187 | 187 |
| 188 // Provide a closure which will allocate a Timer object to be able to hook |
| 189 // up the Timer interface in dart:isolate with the implementation here. |
| 190 _getTimerFactoryClosure() { |
| 191 return (int milliSeconds, void callback(Timer timer), bool repeating) { |
| 192 if (repeating) { |
| 193 return new _Timer.repeating(milliSeconds, callback); |
| 194 } |
| 195 return new _Timer(milliSeconds, callback); |
| 196 }; |
| 197 } |
| 198 |
| 199 |
| OLD | NEW |