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

Unified Diff: sdk/lib/html/dartium/html_dartium.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: Simplify test. 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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/html/events_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d7c89dadd13fa16dd11020029ba99108c6e4ed12..106ac6ced036fa3c58623bc83249c3882f4702d1 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -7707,7 +7707,6 @@ class Document extends Node
@DocsEditable()
DocumentFragment createDocumentFragment() native "Document_createDocumentFragment_Callback";
- /// Deprecated: use new Element.tag(tagName) instead.
@DomName('Document.createElement')
@DocsEditable()
Element _createElement(String localName_OR_tagName, [String typeExtension]) native "Document_createElement_Callback";
@@ -30735,11 +30734,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, runGuarded: true);
+ }
+
void cancel() {
if (_canceled) return;
@@ -30758,7 +30763,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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/html/events_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698