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

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

Issue 2893893002: Use generic functions in zones. (Closed)
Patch Set: Fix more tests. Created 3 years, 4 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') | sdk/lib/js/dartium/cached_patches.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 0ad6f36e686dcb8ca5707affc6969a3266b221d4..edbfe10f9bc85910e88e4d856f8993f4291cc048 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -49055,9 +49055,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
@@ -49066,7 +49066,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();
}
@@ -49088,7 +49088,7 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
}
// Remove current event listener.
_unlisten();
- _onData = _wrapZone/*<Event, dynamic>*/(handleData);
+ _onData = _wrapZone<Event>(handleData);
_tryResume();
}
@@ -52395,24 +52395,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') | sdk/lib/js/dartium/cached_patches.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698