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

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

Issue 2893893002: Use generic functions in zones. (Closed)
Patch Set: Use `dynamic` as required return type. 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:
Download patch
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..3864d7b4a06254bd223bf8b377a3fd4d5b202533 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
@@ -39,7 +39,7 @@ import 'dart:svg' show Matrix;
import 'dart:svg' show SvgSvgElement;
import 'dart:web_audio' as web_audio;
import 'dart:web_gl' as gl;
-import 'dart:web_gl' show RenderingContext;
+import 'dart:web_gl' show RenderingContext, RenderingContext2;
import 'dart:web_sql';
import 'dart:_isolate_helper' show IsolateNatives;
import 'dart:_foreign_helper' show JS, JS_INTERCEPTOR_CONSTANT;
@@ -2023,8 +2023,8 @@ class CanvasElement extends HtmlElement implements CanvasImageSource {
@DomName('HTMLCanvasElement.getContext')
@DocsEditable()
- @Creates('CanvasRenderingContext2D|RenderingContext')
- @Returns('CanvasRenderingContext2D|RenderingContext|Null')
+ @Creates('CanvasRenderingContext2D|RenderingContext|RenderingContext2')
+ @Returns('CanvasRenderingContext2D|RenderingContext|RenderingContext2|Null')
Object getContext(String contextId, [Map attributes]) {
if (attributes != null) {
var attributes_1 = convertDartToNative_Dictionary(attributes);
@@ -2036,14 +2036,14 @@ class CanvasElement extends HtmlElement implements CanvasImageSource {
@JSName('getContext')
@DomName('HTMLCanvasElement.getContext')
@DocsEditable()
- @Creates('CanvasRenderingContext2D|RenderingContext')
- @Returns('CanvasRenderingContext2D|RenderingContext|Null')
+ @Creates('CanvasRenderingContext2D|RenderingContext|RenderingContext2')
+ @Returns('CanvasRenderingContext2D|RenderingContext|RenderingContext2|Null')
Object _getContext_1(contextId, attributes) native;
@JSName('getContext')
@DomName('HTMLCanvasElement.getContext')
@DocsEditable()
- @Creates('CanvasRenderingContext2D|RenderingContext')
- @Returns('CanvasRenderingContext2D|RenderingContext|Null')
+ @Creates('CanvasRenderingContext2D|RenderingContext|RenderingContext2')
+ @Returns('CanvasRenderingContext2D|RenderingContext|RenderingContext2|Null')
Object _getContext_2(contextId) native;
@DomName('HTMLCanvasElement.toBlob')
@@ -26201,6 +26201,10 @@ class _ChildNodeListLazy extends ListBase<Node> implements NodeListWrapper {
void fillRange(int start, int end, [Node fill]) {
throw new UnsupportedError("Cannot fillRange on Node list");
}
+
+ void removeRange(int start, int end) {
+ throw new UnsupportedError("Cannot removeRange on Node list");
+ }
// -- end List<Node> mixins.
// TODO(jacobr): benchmark whether this is more efficient or whether caching
@@ -36968,7 +36972,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 +42910,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 +42921,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 +42943,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 +46318,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);
}
/**

Powered by Google App Engine
This is Rietveld 408576698