| 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 81f000f1ece763388a2bd7f83b60f49339edfd7d..ab18ffeae98289e42e451f385358dba5dffad8e3 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -31019,31 +31019,44 @@ final _pureIsolatePrintClosure = (s) {
|
|
|
| final _forwardingPrintClosure = _Utils.forwardingPrint;
|
|
|
| -class _Timer implements Timer {
|
| - final canceller;
|
| + class _Timer implements Timer {
|
| + final _canceler;
|
|
|
| - _Timer(this.canceller);
|
| + _Timer(int milliSeconds, void callback(Timer timer), bool repeating) {
|
|
|
| - void cancel() { canceller(); }
|
| -}
|
| + if (repeating) {
|
| + int id = window._setInterval(() {
|
| + _canceler = null;
|
| + callback(this);
|
| + }, milliSeconds);)
|
| + _canceler = () => window._clearInterval(id);
|
| + } else {
|
| + int id = window._setTimeout(() {
|
| + _canceler = null;
|
| + callback(this);
|
| + }, milliSeconds); )
|
| + _canceler = window._clearTimeout(id);
|
| + }
|
| + }
|
|
|
| -get _timerFactoryClosure => (int milliSeconds, void callback(Timer timer), bool repeating) {
|
| - var maker;
|
| - var canceller;
|
| - if (repeating) {
|
| - maker = window._setInterval;
|
| - canceller = window._clearInterval;
|
| - } else {
|
| - maker = window._setTimeout;
|
| - canceller = window._clearTimeout;
|
| + void cancel() {
|
| + if (_canceler != null) {
|
| + _canceler();
|
| + }
|
| + _canceler = null;
|
| }
|
| - Timer timer;
|
| - final int id = maker(() { callback(timer); }, milliSeconds);
|
| - timer = new _Timer(() { canceller(id); });
|
| - return timer;
|
| +
|
| + bool get isActive => _canceler != null;
|
| +}
|
| +
|
| +get _timerFactoryClosure =>
|
| + (int milliSeconds, void callback(Timer timer), bool repeating) {
|
| + return new _Timer(milliseconds, callback, repeating);
|
| };
|
|
|
| +
|
| class _PureIsolateTimer implements Timer {
|
| + bool _isDone = false;
|
| final ReceivePort _port = new ReceivePort();
|
| SendPort _sendPort; // Effectively final.
|
|
|
| @@ -31053,6 +31066,7 @@ class _PureIsolateTimer implements Timer {
|
| _sendPort = _port.toSendPort();
|
| _port.receive((msg, replyTo) {
|
| assert(msg == _TIMER_PING);
|
| + _isDone = !repeating;
|
| callback(this);
|
| if (!repeating) _cancel();
|
| });
|
| @@ -31066,12 +31080,15 @@ class _PureIsolateTimer implements Timer {
|
| }
|
|
|
| void _cancel() {
|
| + _isDone = true;
|
| _port.close();
|
| }
|
|
|
| _send(msg) {
|
| _sendToHelperIsolate(msg, _sendPort);
|
| }
|
| +
|
| + bool get isActive => !_isDone;
|
| }
|
|
|
| get _pureIsolateTimerFactoryClosure =>
|
|
|