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

Unified Diff: tools/dom/src/shared_html.dart

Issue 2162643002: Revert "Reapply zone tasks." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/src/EventStreamProvider.dart ('k') | tools/dom/templates/html/impl/impl_Window.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/shared_html.dart
diff --git a/tools/dom/src/shared_html.dart b/tools/dom/src/shared_html.dart
index f2c32f3c23ab6ee2099e666d870d4ab83ebe6af1..7342cdfef31238ae884a8abcffebc73faef68749 100644
--- a/tools/dom/src/shared_html.dart
+++ b/tools/dom/src/shared_html.dart
@@ -4,26 +4,31 @@
part of dart.dom.html;
-ZoneUnaryCallback/*<R, T>*/ _registerZone/*<R, T>*/(Zone zone,
- ZoneUnaryCallback/*<R, T>*/ callback) {
- // For performance reasons avoid registering if we are in the root zone.
- if (identical(zone, Zone.ROOT)) return callback;
- if (callback == null) return null;
- return zone.registerUnaryCallback(callback);
-}
+// 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);
-ZoneUnaryCallback/*<R, T>*/ _wrapZone/*<R, T>*/(ZoneUnaryCallback/*<R, T>*/ callback) {
+_wrapZoneCallback/*<A, R>*/ _wrapZone/*<A, R>*/(_wrapZoneCallback/*<A, R>*/ callback) {
// For performance reasons avoid wrapping if we are in the root zone.
- if (identical(Zone.current, Zone.ROOT)) return callback;
+ if (Zone.current == Zone.ROOT) return callback;
if (callback == null) return null;
- return Zone.current.bindUnaryCallback(callback, runGuarded: true);
+ // TODO(jacobr): we cast to _wrapZoneCallback/*<A, R>*/ to hack around missing
+ // generic method support in zones.
+ // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
+ _wrapZoneCallback/*<A, R>*/ wrapped =
+ Zone.current.bindUnaryCallback(callback, runGuarded: true);
+ return wrapped;
}
-ZoneBinaryCallback/*<R, A, B>*/ _wrapBinaryZone/*<R, A, B>*/(
- ZoneBinaryCallback/*<R, A, B>*/ callback) {
- if (identical(Zone.current, Zone.ROOT)) return callback;
+_wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/(_wrapZoneBinaryCallback/*<A, B, R>*/ callback) {
+ if (Zone.current == Zone.ROOT) return callback;
if (callback == null) return null;
- return Zone.current.bindBinaryCallback(callback, runGuarded: true);
+ // We cast to _wrapZoneBinaryCallback/*<A, B, R>*/ to hack around missing
+ // generic method support in zones.
+ // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
+ _wrapZoneBinaryCallback/*<A, B, R>*/ wrapped =
+ Zone.current.bindBinaryCallback(callback, runGuarded: true);
+ return wrapped;
}
/**
« no previous file with comments | « tools/dom/src/EventStreamProvider.dart ('k') | tools/dom/templates/html/impl/impl_Window.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698