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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 27240004: Making all callbacks use zones (take 2) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 6c139bdbced56e181bb1050596bed85cb8c5bdc0..57b4bf831daea51987007bd7bf9589a2ec93a32f 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -56,7 +56,7 @@ import 'dart:_js_helper' show
makeLeafDispatchRecord;
import 'dart:_interceptors' show
Interceptor, JSExtendableArray, findInterceptorConstructorForType,
- findConstructorForWebComponentType, getNativeInterceptor,
+ findConstructorForWebComponentType, getNativeInterceptor,
setDispatchProperty, findInterceptorForType;
export 'dart:math' show Rectangle, Point;
@@ -85,9 +85,6 @@ Window get window => JS('Window', 'window');
*/
HtmlDocument get document => JS('HtmlDocument', 'document');
-Element query(String selector) => document.query(selector);
-ElementList queryAll(String selector) => document.queryAll(selector);
-
// Workaround for tags like <cite> that lack their own Element subclass --
// Dart issue 1990.
class HtmlElement extends Element native "HTMLElement" {
@@ -12153,9 +12150,20 @@ class FontLoader extends EventTarget native "FontLoader" {
@DocsEditable()
void _loadFont_1(params) native;
+ @JSName('notifyWhenFontsReady')
@DomName('FontLoader.notifyWhenFontsReady')
@DocsEditable()
- void notifyWhenFontsReady(VoidCallback callback) native;
+ void _notifyWhenFontsReady(VoidCallback callback) native;
+
+ @JSName('notifyWhenFontsReady')
+ @DomName('FontLoader.notifyWhenFontsReady')
+ @DocsEditable()
+ Future notifyWhenFontsReady() {
+ var completer = new Completer();
+ _notifyWhenFontsReady(
+ () { completer.complete(); });
+ return completer.future;
+ }
@DomName('FontLoader.onerror')
@DocsEditable()
@@ -16506,10 +16514,22 @@ class MediaStreamTrack extends EventTarget native "MediaStreamTrack" {
@DocsEditable()
final String readyState;
+ @JSName('getSources')
+ @DomName('MediaStreamTrack.getSources')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static void _getSources(MediaStreamTrackSourcesCallback callback) native;
+
+ @JSName('getSources')
@DomName('MediaStreamTrack.getSources')
@DocsEditable()
@Experimental() // untriaged
- static void getSources(MediaStreamTrackSourcesCallback callback) native;
+ static Future<List<SourceInfo>> getSources() {
+ var completer = new Completer<List<SourceInfo>>();
+ _getSources(
+ (value) { completer.complete(value); });
+ return completer.future;
+ }
@DomName('MediaStreamTrack.onended')
@DocsEditable()
@@ -17426,8 +17446,6 @@ class MutationEvent extends Event native "MutationEvent" {
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
class MutationObserver extends Interceptor native "MutationObserver,WebKitMutationObserver" {
- // To suppress missing implicit constructor warnings.
- factory MutationObserver._() { throw new UnsupportedError("Not supported"); }
@DomName('MutationObserver.disconnect')
@DocsEditable()
@@ -17513,7 +17531,7 @@ class MutationObserver extends Interceptor native "MutationObserver,WebKitMutati
return JS('MutationObserver',
'new(window.MutationObserver||window.WebKitMutationObserver||'
'window.MozMutationObserver)(#)',
- convertDartClosureToJS(callback, 2));
+ convertDartClosureToJS(_wrapZone(callback), 2));
}
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -20666,6 +20684,13 @@ class RtcPeerConnection extends EventTarget native "RTCPeerConnection,mozRTCPeer
(error) { completer.completeError(error); }, mediaConstraints);
return completer.future;
}
+
+ @DomName('RTCPeerConnection.getStats')
+ Future<RtcStatsResponse> getStats(MediaStreamTrack selector) {
+ var completer = new Completer<RtcStatsResponse>();
+ _getStats((value) { completer.complete(value); }, selector);
+ return completer.future;
+ }
// To suppress missing implicit constructor warnings.
factory RtcPeerConnection._() { throw new UnsupportedError("Not supported"); }
@@ -20816,9 +20841,10 @@ class RtcPeerConnection extends EventTarget native "RTCPeerConnection,mozRTCPeer
@DocsEditable()
List<MediaStream> getRemoteStreams() native;
+ @JSName('getStats')
@DomName('RTCPeerConnection.getStats')
@DocsEditable()
- void getStats(RtcStatsCallback successCallback, MediaStreamTrack selector) native;
+ void _getStats(RtcStatsCallback successCallback, MediaStreamTrack selector) native;
@DomName('RTCPeerConnection.getStreamById')
@DocsEditable()
@@ -22727,9 +22753,21 @@ class StorageQuota extends Interceptor native "StorageQuota" {
@DocsEditable()
void queryUsageAndQuota(StorageUsageCallback usageCallback, [StorageErrorCallback errorCallback]) native;
+ @JSName('requestQuota')
+ @DomName('StorageQuota.requestQuota')
+ @DocsEditable()
+ void _requestQuota(int newQuotaInBytes, [StorageQuotaCallback quotaCallback, StorageErrorCallback errorCallback]) native;
+
+ @JSName('requestQuota')
@DomName('StorageQuota.requestQuota')
@DocsEditable()
- void requestQuota(int newQuotaInBytes, [StorageQuotaCallback quotaCallback, StorageErrorCallback errorCallback]) native;
+ Future<int> requestQuota(int newQuotaInBytes) {
+ var completer = new Completer<int>();
+ _requestQuota(newQuotaInBytes,
+ (value) { completer.complete(value); },
+ (error) { completer.completeError(error); });
+ return completer.future;
+ }
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -25528,7 +25566,7 @@ class Window extends EventTarget implements WindowBase, WindowTimers, WindowBase
@DomName('Window.requestAnimationFrame')
int requestAnimationFrame(RequestAnimationFrameCallback callback) {
_ensureRequestAnimationFrame();
- return _requestAnimationFrame(callback);
+ return _requestAnimationFrame(_wrapZone(callback));
}
void cancelAnimationFrame(int id) {
@@ -29576,12 +29614,6 @@ class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
_tryResume();
}
- static _wrapZone(callback) {
- // For performance reasons avoid wrapping if we are in the root zone.
- if (Zone.current == Zone.ROOT) return callback;
- return Zone.current.bindUnaryCallback(callback, runGuarded: true);
- }
-
void cancel() {
if (_canceled) return;
@@ -33375,6 +33407,19 @@ class Platform {
// BSD-style license that can be found in the LICENSE file.
+_wrapZone(callback) {
+ // For performance reasons avoid wrapping if we are in the root zone.
+ if (Zone.current == Zone.ROOT) return callback;
+ return Zone.current.bindUnaryCallback(callback, runGuarded: true);
+}
+
+Element query(String selector) => document.query(selector);
+ElementList queryAll(String selector) => document.queryAll(selector);
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+
/**
* Interface used to validate that only accepted elements and attributes are
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698