Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 24509004: Run DOM callbacks in the zone they are coming from. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Wrap into expectAsync0. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tests/html/events_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 2f2259cf9ce82311f99182db49eab18d87e5dcf4..4447fa800d41be286c2fdbe627a680adff7392c7 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -28623,11 +28623,17 @@ 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 root zone.
+ if (Zone.current == Zone.ROOT) return callback;
+ return Zone.current.bindUnaryCallback(callback);
+ }
+
void cancel() {
if (_canceled) return;
@@ -28646,7 +28652,7 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
// Remove current event listener.
_unlisten();
- _onData = handleData;
+ _onData = _wrapZone(handleData);
_tryResume();
}
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tests/html/events_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698