| 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 d521e63d3bf8740f857a2dbe01c1438b7941b4c0..59f2f57a7490f34bb6ce0c7721fd82a285b9b6d5 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;
|
| @@ -118,6 +118,12 @@ int _getNewIsolateId() {
|
| _callPortSync(int id, message) {
|
| return JS('var', r'ReceivePortSync.dispatchCall(#, #)', id, message);
|
| }
|
| +
|
| +_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);
|
| +}
|
| // 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.
|
| @@ -12075,9 +12081,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()
|
| @@ -16390,10 +16407,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()
|
| @@ -17383,7 +17412,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
|
| @@ -20642,9 +20671,20 @@ 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;
|
| +
|
| + @JSName('getStats')
|
| + @DomName('RTCPeerConnection.getStats')
|
| + @DocsEditable()
|
| + Future<RtcStatsResponse> getStats(MediaStreamTrack selector) {
|
| + var completer = new Completer<RtcStatsResponse>();
|
| + _getStats(selector,
|
| + (value) { completer.complete(value); });
|
| + return completer.future;
|
| + }
|
|
|
| @DomName('RTCPeerConnection.getStreamById')
|
| @DocsEditable()
|
| @@ -22515,13 +22555,37 @@ class StorageInfoUsage {
|
| @Experimental()
|
| class StorageQuota extends Interceptor native "StorageQuota" {
|
|
|
| + @JSName('queryUsageAndQuota')
|
| + @DomName('StorageQuota.queryUsageAndQuota')
|
| + @DocsEditable()
|
| + void _queryUsageAndQuota(StorageUsageCallback usageCallback, [StorageErrorCallback errorCallback]) native;
|
| +
|
| + @JSName('queryUsageAndQuota')
|
| @DomName('StorageQuota.queryUsageAndQuota')
|
| @DocsEditable()
|
| - void queryUsageAndQuota(StorageUsageCallback usageCallback, [StorageErrorCallback errorCallback]) native;
|
| + Future<int> queryUsageAndQuota() {
|
| + var completer = new Completer<int>();
|
| + _queryUsageAndQuota(
|
| + (value) { completer.complete(value); },
|
| + (error) { completer.completeError(error); });
|
| + return completer.future;
|
| + }
|
| +
|
| + @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
|
| @@ -25300,7 +25364,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) {
|
| @@ -29280,12 +29344,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;
|
|
|
|
|