| Index: sdk/lib/html/dartium/html_dartium.dart
|
| diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
|
| index 9b787e4f2baa09321a6697f220ddb7a412ad4c1a..29a417ad3c74a7c287a970a80822a308d7bde81f 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -37039,36 +37039,33 @@ final _pureIsolateUriBaseClosure = () {
|
| "is not supported in the browser");
|
| };
|
|
|
| -class _Timer implements Timer {
|
| - const int _STATE_TIMEOUT = 0;
|
| - const int _STATE_INTERVAL = 1;
|
| - var _state;
|
| + class _Timer implements Timer {
|
| + var _canceler;
|
|
|
| _Timer(int milliSeconds, void callback(Timer timer), bool repeating) {
|
| +
|
| if (repeating) {
|
| - _state = window._setInterval(() {
|
| + int id = window._setInterval(() {
|
| callback(this);
|
| - }, milliSeconds) * 2 + _STATE_INTERVAL;
|
| + }, milliSeconds);
|
| + _canceler = () => window._clearInterval(id);
|
| } else {
|
| - _state = window._setTimeout(() {
|
| - _state = null;
|
| + int id = window._setTimeout(() {
|
| + _canceler = null;
|
| callback(this);
|
| - }, milliSeconds) * 2 + _STATE_TIMEOUT;
|
| + }, milliSeconds);
|
| + _canceler = () => window._clearTimeout(id);
|
| }
|
| }
|
|
|
| void cancel() {
|
| - if (_state == null) return;
|
| - int id = _state ~/ 2;
|
| - if ((_state & 1) == _STATE_TIMEOUT) {
|
| - window._clearTimeout(id);
|
| - } else {
|
| - window._clearInterval(id);
|
| + if (_canceler != null) {
|
| + _canceler();
|
| }
|
| - _state = null;
|
| + _canceler = null;
|
| }
|
|
|
| - bool get isActive => _state != null;
|
| + bool get isActive => _canceler != null;
|
| }
|
|
|
| get _timerFactoryClosure =>
|
|
|