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

Side by Side Diff: tools/dom/src/shared_html.dart

Issue 2959163002: Make Zone API strong mode clean. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.dom.html; 5 part of dart.dom.html;
6 6
7 // TODO(jacobr): remove these typedefs when dart:async supports generic types. 7 void Function(T) _wrapZone<T>(void Function(T) callback) {
8 typedef R _wrapZoneCallback<A, R>(A a);
9 typedef R _wrapZoneBinaryCallback<A, B, R>(A a, B b);
10
11 _wrapZoneCallback/*<A, R>*/ _wrapZone/*<A, R>*/(
12 _wrapZoneCallback/*<A, R>*/ callback) {
13 // For performance reasons avoid wrapping if we are in the root zone. 8 // For performance reasons avoid wrapping if we are in the root zone.
14 if (Zone.current == Zone.ROOT) return callback; 9 if (Zone.current == Zone.ROOT) return callback;
15 if (callback == null) return null; 10 if (callback == null) return null;
16 return Zone.current.bindUnaryCallback/*<R, A>*/(callback, runGuarded: true); 11 return Zone.current.bindUnaryCallbackGuarded(callback);
17 } 12 }
18 13
19 _wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/( 14 void Function(T1, T2) _wrapBinaryZone<T1, T2>(void Function(T1, T2) callback) {
20 _wrapZoneBinaryCallback/*<A, B, R>*/ callback) { 15 // For performance reasons avoid wrapping if we are in the root zone.
21 if (Zone.current == Zone.ROOT) return callback; 16 if (Zone.current == Zone.ROOT) return callback;
22 if (callback == null) return null; 17 if (callback == null) return null;
23 return Zone.current 18 return Zone.current.bindBinaryCallbackGuarded(callback);
24 .bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true);
25 } 19 }
26 20
27 /** 21 /**
28 * Alias for [querySelector]. Note this function is deprecated because its 22 * Alias for [querySelector]. Note this function is deprecated because its
29 * semantics will be changing in the future. 23 * semantics will be changing in the future.
30 */ 24 */
31 @deprecated 25 @deprecated
32 @Experimental() 26 @Experimental()
33 Element query(String relativeSelectors) => document.query(relativeSelectors); 27 Element query(String relativeSelectors) => document.query(relativeSelectors);
34 /** 28 /**
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 document.querySelectorAll(selectors); 73 document.querySelectorAll(selectors);
80 74
81 /// A utility for changing the Dart wrapper type for elements. 75 /// A utility for changing the Dart wrapper type for elements.
82 abstract class ElementUpgrader { 76 abstract class ElementUpgrader {
83 /// Upgrade the specified element to be of the Dart type this was created for. 77 /// Upgrade the specified element to be of the Dart type this was created for.
84 /// 78 ///
85 /// After upgrading the element passed in is invalid and the returned value 79 /// After upgrading the element passed in is invalid and the returned value
86 /// should be used instead. 80 /// should be used instead.
87 Element upgrade(Element element); 81 Element upgrade(Element element);
88 } 82 }
OLDNEW
« 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