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

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

Issue 14367012: Move to new dart:typeddata types for dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 // TODO(sra): The JavaScript objects suitable for direct cloning by the 133 // TODO(sra): The JavaScript objects suitable for direct cloning by the
134 // structured clone algorithm could be tagged with an private interface. 134 // structured clone algorithm could be tagged with an private interface.
135 135
136 if (e is File) return e; 136 if (e is File) return e;
137 if (e is Blob) return e; 137 if (e is Blob) return e;
138 if (e is FileList) return e; 138 if (e is FileList) return e;
139 139
140 // TODO(sra): Firefox: How to convert _TypedImageData on the other end? 140 // TODO(sra): Firefox: How to convert _TypedImageData on the other end?
141 if (e is ImageData) return e; 141 if (e is ImageData) return e;
142 if (e is ArrayBuffer) return e; 142 if (e is ByteBuffer) return e;
143 143
144 if (e is ArrayBufferView) return e; 144 if (e is TypedData) return e;
145 145
146 if (e is Map) { 146 if (e is Map) {
147 var slot = findSlot(e); 147 var slot = findSlot(e);
148 var copy = readSlot(slot); 148 var copy = readSlot(slot);
149 if (copy != null) return copy; 149 if (copy != null) return copy;
150 copy = JS('var', '{}'); 150 copy = JS('var', '{}');
151 writeSlot(slot, copy); 151 writeSlot(slot, copy);
152 e.forEach((key, value) { 152 e.forEach((key, value) {
153 JS('void', '#[#] = #', copy, key, walk(value)); 153 JS('void', '#[#] = #', copy, key, walk(value));
154 }); 154 });
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 bool isJavaScriptSimpleObject(value) => 321 bool isJavaScriptSimpleObject(value) =>
322 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value); 322 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value);
323 bool isImmutableJavaScriptArray(value) => 323 bool isImmutableJavaScriptArray(value) =>
324 JS('bool', r'!!(#.immutable$list)', value); 324 JS('bool', r'!!(#.immutable$list)', value);
325 325
326 326
327 327
328 const String _serializedScriptValue = 328 const String _serializedScriptValue =
329 'num|String|bool|' 329 'num|String|bool|'
330 '=List|=Object|' 330 '=List|=Object|'
331 'Blob|File|ArrayBuffer|ArrayBufferView' 331 'Blob|File|ByteBuffer|TypedData'
332 // TODO(sra): Add Date, RegExp. 332 // TODO(sra): Add Date, RegExp.
333 ; 333 ;
334 const annotation_Creates_SerializedScriptValue = 334 const annotation_Creates_SerializedScriptValue =
335 const Creates(_serializedScriptValue); 335 const Creates(_serializedScriptValue);
336 const annotation_Returns_SerializedScriptValue = 336 const annotation_Returns_SerializedScriptValue =
337 const Returns(_serializedScriptValue); 337 const Returns(_serializedScriptValue);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698