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

Unified Diff: pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart

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 | « pkg/dev_compiler/test/browser/language_tests.js ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart b/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
index 248f8aab63f82d426dd314f8ed25cfff534d3f1a..ecbca1bc9459f6fbdb220adcb5d2530f7f196bc6 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
@@ -36968,7 +36968,7 @@ class Window extends EventTarget
@DomName('Window.requestAnimationFrame')
int requestAnimationFrame(FrameRequestCallback callback) {
_ensureRequestAnimationFrame();
- return _requestAnimationFrame(_wrapZone/*<num, dynamic>*/(callback));
+ return _requestAnimationFrame(_wrapZone(callback));
}
/**
@@ -42906,9 +42906,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
@@ -42917,7 +42917,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();
}
@@ -42939,7 +42939,7 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
}
// Remove current event listener.
_unlisten();
- _onData = _wrapZone/*<Event, dynamic>*/(handleData);
+ _onData = _wrapZone<Event>(handleData);
_tryResume();
}
@@ -46314,24 +46314,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 | « pkg/dev_compiler/test/browser/language_tests.js ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698