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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 3014593002: Use generic functions in zones. (Closed)
Patch Set: Added changes missing from patch set #2 Created 3 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/co19/co19-co19.status » ('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 afd3e210c910214d4612fa9ff8ff80b210d0b3a7..d79f59c690fb78b6a20072488d02844b778c1928 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -49051,9 +49051,9 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
// TODO(leafp): It would be better to write this as
// _onData = onData == null ? null :
- // onData is _wrapZoneCallback<Event, dynamic>
- // ? _wrapZone/*<Event, dynamic>*/(onData)
- // : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
+ // onData is void Function(Event)
+ // ? _wrapZone<Event>(onData)
+ // : _wrapZone<Event>((e) => onData(e as T))
// In order to support existing tests which pass the wrong type of events but
// use a more general listener, without causing as much slowdown for things
// which are typed correctly. But this currently runs afoul of restrictions
@@ -49062,7 +49062,7 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
this._target, this._eventType, void onData(T event), this._useCapture)
: _onData = onData == null
? null
- : _wrapZone<Event, dynamic>((e) => (onData as dynamic)(e)) {
+ : _wrapZone<Event>((e) => (onData as dynamic)(e)) {
_tryResume();
}
@@ -49084,7 +49084,7 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
}
// Remove current event listener.
_unlisten();
- _onData = _wrapZone/*<Event, dynamic>*/(handleData);
+ _onData = _wrapZone<Event>(handleData);
_tryResume();
}
@@ -52391,24 +52391,18 @@ class _WrappedEvent implements Event {
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// TODO(jacobr): remove these typedefs when dart:async supports generic types.
-typedef R _wrapZoneCallback<A, R>(A a);
-typedef R _wrapZoneBinaryCallback<A, B, R>(A a, B b);
-
-_wrapZoneCallback/*<A, R>*/ _wrapZone/*<A, R>*/(
- _wrapZoneCallback/*<A, R>*/ callback) {
+void Function(T) _wrapZone<T>(void Function(T) callback) {
// For performance reasons avoid wrapping if we are in the root zone.
if (Zone.current == Zone.ROOT) return callback;
if (callback == null) return null;
- return Zone.current.bindUnaryCallback/*<R, A>*/(callback, runGuarded: true);
+ return Zone.current.bindUnaryCallbackGuarded(callback);
}
-_wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/(
- _wrapZoneBinaryCallback/*<A, B, R>*/ callback) {
+void Function(T1, T2) _wrapBinaryZone<T1, T2>(void Function(T1, T2) callback) {
+ // For performance reasons avoid wrapping if we are in the root zone.
if (Zone.current == Zone.ROOT) return callback;
if (callback == null) return null;
- return Zone.current
- .bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true);
+ return Zone.current.bindBinaryCallbackGuarded(callback);
}
/**
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/co19/co19-co19.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698