| 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 8b25d5ab640e880fb09b432283c29e0cb0dc7366..f94bdec2d5c279b9aa8a8fe60fd5f6302a902fb8 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -30464,11 +30464,20 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
|
| var _onData;
|
| final bool _useCapture;
|
|
|
| - _EventStreamSubscription(this._target, this._eventType, this._onData,
|
| - this._useCapture) {
|
| + _EventStreamSubscription(this._target, this._eventType, onData,
|
| + this._useCapture) : _onData = _wrapZone(onData) {
|
| _tryResume();
|
| }
|
|
|
| + static _wrapZone(callback) {
|
| + // For performance reasons, avoid wrapping if we are in the default zone.
|
| + final zone = currentZoneExperimental;
|
| + if (zone.isDefault) return callback;
|
| +
|
| + zone.expectCallback();
|
| + return (e) => zone.executePeriodicCallbackGuarded(() => callback(e));
|
| + }
|
| +
|
| void cancel() {
|
| if (_canceled) return;
|
|
|
| @@ -30476,6 +30485,9 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
|
| // Clear out the target to indicate this is complete.
|
| _target = null;
|
| _onData = null;
|
| +
|
| + final zone = currentZoneExperimental;
|
| + if (!zone.isDefault) zone.cancelCallbackExpectation();
|
| }
|
|
|
| bool get _canceled => _target == null;
|
| @@ -30487,7 +30499,7 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
|
| // Remove current event listener.
|
| _unlisten();
|
|
|
| - _onData = handleData;
|
| + _onData = _wrapZone(handleData);
|
| _tryResume();
|
| }
|
|
|
|
|