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

Side by Side Diff: sdk/lib/html/html_common/conversions_dart2js.dart

Issue 1832713002: Optimize dartium dart:html bindings so real world application performance is acceptable. Improves d… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: update cached patches Created 4 years, 8 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 part of html_common; 1 part of html_common;
2 2
3 /// Converts a JavaScript object with properties into a Dart Map. 3 /// Converts a JavaScript object with properties into a Dart Map.
4 /// Not suitable for nested objects. 4 /// Not suitable for nested objects.
5 Map convertNativeToDart_Dictionary(object) { 5 Map convertNativeToDart_Dictionary(object) {
6 if (object == null) return null; 6 if (object == null) return null;
7 var dict = {}; 7 var dict = {};
8 var keys = JS('JSExtendableArray', 'Object.getOwnPropertyNames(#)', object); 8 var keys = JS('JSExtendableArray', 'Object.getOwnPropertyNames(#)', object);
9 for (final key in keys) { 9 for (final key in keys) {
10 dict[key] = JS('var', '#[#]', object, key); 10 dict[key] = JS('var', '#[#]', object, key);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 bool isJavaScriptPromise(value) => 84 bool isJavaScriptPromise(value) =>
85 JS('bool', r'typeof Promise != "undefined" && # instanceof Promise', value); 85 JS('bool', r'typeof Promise != "undefined" && # instanceof Promise', value);
86 86
87 Future convertNativePromiseToDartFuture(promise) { 87 Future convertNativePromiseToDartFuture(promise) {
88 var completer = new Completer(); 88 var completer = new Completer();
89 var then = convertDartClosureToJS((result) => completer.complete(result), 1); 89 var then = convertDartClosureToJS((result) => completer.complete(result), 1);
90 var error = convertDartClosureToJS((result) => completer.completeError(result) , 1); 90 var error = convertDartClosureToJS((result) => completer.completeError(result) , 1);
91 var newPromise = JS('', '#.then(#)["catch"](#)', promise, then, error); 91 var newPromise = JS('', '#.then(#)["catch"](#)', promise, then, error);
92 return completer.future; 92 return completer.future;
93 } 93 }
94
95 /// Wrap a JS object with an instance of the matching dart:html class. Used only in Dartium.
96 wrap_jso(jsObject) => jsObject;
97
98 /// Find the underlying JS object for a dart:html Dart object.
99 unwrap_jso(dartClass_instance) => dartClass_instance;
OLDNEW
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/html/html_common/conversions_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698