| 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 class _Utils { | 7 class _Utils { |
| 8 static double dateTimeToDouble(DateTime dateTime) => | 8 static double dateTimeToDouble(DateTime dateTime) => |
| 9 dateTime.millisecondsSinceEpoch.toDouble(); | 9 dateTime.millisecondsSinceEpoch.toDouble(); |
| 10 static DateTime doubleToDateTime(double dateTime) { | 10 static DateTime doubleToDateTime(double dateTime) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 final _forwardingPrintClosure = _Utils.forwardingPrint; | 199 final _forwardingPrintClosure = _Utils.forwardingPrint; |
| 200 | 200 |
| 201 class _Timer implements Timer{ | 201 class _Timer implements Timer{ |
| 202 var _canceler; | 202 var _canceler; |
| 203 | 203 |
| 204 _Timer(int milliSeconds, void callback(Timer timer), bool repeating) { | 204 _Timer(int milliSeconds, void callback(Timer timer), bool repeating) { |
| 205 | 205 |
| 206 if (repeating) { | 206 if (repeating) { |
| 207 int id = window._setInterval(() { | 207 int id = window._setInterval(() { |
| 208 callback(this); | 208 callback(this); |
| 209 }, milliSeconds);) | 209 }, milliSeconds); |
| 210 _canceler = () => window._clearInterval(id); | 210 _canceler = () => window._clearInterval(id); |
| 211 } else { | 211 } else { |
| 212 int id = window._setTimeout(() { | 212 int id = window._setTimeout(() { |
| 213 _canceler = null; | 213 _canceler = null; |
| 214 callback(this); | 214 callback(this); |
| 215 }, milliSeconds);) | 215 }, milliSeconds); |
| 216 _canceler = () => window._clearTimeout(id); | 216 _canceler = () => window._clearTimeout(id); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 | 219 |
| 220 void cancel() { | 220 void cancel() { |
| 221 if (_canceler != null) { | 221 if (_canceler != null) { |
| 222 _canceler(); | 222 _canceler(); |
| 223 } | 223 } |
| 224 _canceler = null; | 224 _canceler = null; |
| 225 } | 225 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 _send(msg) { | 265 _send(msg) { |
| 266 _sendToHelperIsolate(msg, _sendPort); | 266 _sendToHelperIsolate(msg, _sendPort); |
| 267 } | 267 } |
| 268 | 268 |
| 269 bool get isActive => _isActive; | 269 bool get isActive => _isActive; |
| 270 } | 270 } |
| 271 | 271 |
| 272 get _pureIsolateTimerFactoryClosure => | 272 get _pureIsolateTimerFactoryClosure => |
| 273 ((int milliSeconds, void callback(Timer time), bool repeating) => | 273 ((int milliSeconds, void callback(Timer time), bool repeating) => |
| 274 new _PureIsolateTimer(milliSeconds, callback, repeating)); | 274 new _PureIsolateTimer(milliSeconds, callback, repeating)); |
| OLD | NEW |