| 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 9f92c2b4517c6fee2bc2dfd6a5166504c06f2bc3..8623dd8ec9e177e070f0e028f83210da909beb6d 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -35053,7 +35053,6 @@ class Rect {
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
| -// TODO(antonm): support not DOM isolates too.
|
| class _Timer implements Timer {
|
| final canceller;
|
|
|
| @@ -35104,22 +35103,8 @@ class _PureIsolateTimer implements Timer {
|
| _port.close();
|
| }
|
|
|
| - // Tricky part.
|
| - // Once _HELPER_ISOLATE_PORT gets resolved, it will still delay in .then
|
| - // and to delay Timer.run is used. However, Timer.run will try to register
|
| - // another Timer and here we got stuck: event cannot be posted as then
|
| - // callback is not executed because it's delayed with timer.
|
| - // Therefore once future is resolved, it's unsafe to call .then on it
|
| - // in Timer code.
|
| _send(msg) {
|
| - if (_SEND_PORT != null) {
|
| - _SEND_PORT.send(msg, _sendPort);
|
| - } else {
|
| - _HELPER_ISOLATE_PORT.then((port) {
|
| - _SEND_PORT = port;
|
| - _SEND_PORT.send(msg, _sendPort);
|
| - });
|
| - }
|
| + _sendToHelperIsolate(msg, _sendPort);
|
| }
|
| }
|
|
|
| @@ -36349,9 +36334,29 @@ class _DOMStringMap extends NativeFieldWrapperClass1 implements Map<String, Stri
|
| bool get isEmpty => Maps.isEmpty(this);
|
| }
|
|
|
| -final Future<SendPort> _HELPER_ISOLATE_PORT =
|
| +final Future<SendPort> __HELPER_ISOLATE_PORT =
|
| spawnDomFunction(_helperIsolateMain);
|
|
|
| +// Tricky part.
|
| +// Once _HELPER_ISOLATE_PORT gets resolved, it will still delay in .then
|
| +// and to delay Timer.run is used. However, Timer.run will try to register
|
| +// another Timer and here we got stuck: event cannot be posted as then
|
| +// callback is not executed because it's delayed with timer.
|
| +// Therefore once future is resolved, it's unsafe to call .then on it
|
| +// in Timer code.
|
| +SendPort __SEND_PORT;
|
| +
|
| +_sendToHelperIsolate(msg, SendPort replyTo) {
|
| + if (__SEND_PORT != null) {
|
| + __SEND_PORT.send(msg, replyTo);
|
| + } else {
|
| + __HELPER_ISOLATE_PORT.then((port) {
|
| + __SEND_PORT = port;
|
| + __SEND_PORT.send(msg, replyTo);
|
| + });
|
| + }
|
| +}
|
| +
|
| final _TIMER_REGISTRY = new Map<SendPort, Timer>();
|
|
|
| const _NEW_TIMER = 'NEW_TIMER';
|
| @@ -36381,9 +36386,7 @@ _helperIsolateMain() {
|
|
|
| final _printClosure = window.console.log;
|
| final _pureIsolatePrintClosure = (s) {
|
| - _HELPER_ISOLATE_PORT.then((sendPort) {
|
| - sendPort.send([_PRINT, s]);
|
| - });
|
| + _sendToHelperIsolate([_PRINT, s]);
|
| };
|
|
|
| final _forwardingPrintClosure = _Utils.forwardingPrint;
|
|
|