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

Side by Side Diff: lib/html/src/dart2js_Conversions.dart

Issue 11065003: Convert between Dart and JavaScript SerializedScriptValues on postMessage. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 5
6 // Conversions for IDBKey. 6 // Conversions for IDBKey.
7 // 7 //
8 // Per http://www.w3.org/TR/IndexedDB/#key-construct 8 // Per http://www.w3.org/TR/IndexedDB/#key-construct
9 // 9 //
10 // "A value is said to be a valid key if it is one of the following types: Array 10 // "A value is said to be a valid key if it is one of the following types: Array
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 * If necessary, [dartKey] may be copied to ensure all lists are converted into 122 * If necessary, [dartKey] may be copied to ensure all lists are converted into
123 * JavaScript Arrays and Dart Dates into JavaScript Dates. 123 * JavaScript Arrays and Dart Dates into JavaScript Dates.
124 */ 124 */
125 _convertDartToNative_IDBKey(dartKey) { 125 _convertDartToNative_IDBKey(dartKey) {
126 // TODO: Implement. 126 // TODO: Implement.
127 return dartKey; 127 return dartKey;
128 } 128 }
129 129
130 130
131 131
132 // May modify original. If so, action is idempotent. 132 /// May modify original. If so, action is idempotent.
133 _convertNativeToDart_IDBAny(object) { 133 _convertNativeToDart_IDBAny(object) {
134 return _convertNativeToDart_AcceptStructuredClone(object); 134 return _convertNativeToDart_AcceptStructuredClone(object);
135 } 135 }
136 136
137 /// Converts a Dart value into 137 /// Converts a Dart value into a JavaScript SerializedScriptValue.
138 _convertDartToNative_SerializedScriptValue(value) { 138 _convertDartToNative_SerializedScriptValue(value) {
139 return _convertDartToNative_PrepareForStructuredClone(value); 139 return _convertDartToNative_PrepareForStructuredClone(value);
140 } 140 }
141 141
142 /// May modify original. If so, action is idempotent.
143 _convertNativeToDart_SerializedScriptValue(object) {
144 return _convertNativeToDart_AcceptStructuredClone(object);
145 }
146
142 147
143 /** 148 /**
144 * Converts a Dart value into a JavaScript SerializedScriptValue. Returns the 149 * Converts a Dart value into a JavaScript SerializedScriptValue. Returns the
145 * original input or a functional 'copy'. Does not mutate the original. 150 * original input or a functional 'copy'. Does not mutate the original.
146 * 151 *
147 * The main transformation is the translation of Dart Maps are converted to 152 * The main transformation is the translation of Dart Maps are converted to
148 * JavaScript Objects. 153 * JavaScript Objects.
149 * 154 *
150 * The algorithm is essentially a dry-run of the structured clone algorithm 155 * The algorithm is essentially a dry-run of the structured clone algorithm
151 * described at 156 * described at
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 390 }
386 391
387 392
388 bool _isJavaScriptDate(value) => JS('bool', '# instanceof Date', value); 393 bool _isJavaScriptDate(value) => JS('bool', '# instanceof Date', value);
389 bool _isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value); 394 bool _isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value);
390 bool _isJavaScriptArray(value) => JS('bool', '# instanceof Array', value); 395 bool _isJavaScriptArray(value) => JS('bool', '# instanceof Array', value);
391 bool _isJavaScriptSimpleObject(value) => 396 bool _isJavaScriptSimpleObject(value) =>
392 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value); 397 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value);
393 bool _isImmutableJavaScriptArray(value) => 398 bool _isImmutableJavaScriptArray(value) =>
394 JS('bool', r'!!(#.immutable$list)', value); 399 JS('bool', r'!!(#.immutable$list)', value);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698