| OLD | NEW |
| 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 // Patch file for the dart:isolate library. | 5 // Patch file for the dart:isolate library. |
| 6 | 6 |
| 7 part of html; | 7 part of html; |
| 8 | 8 |
| 9 /******************************************************** | 9 /******************************************************** |
| 10 Inserted from lib/isolate/serialization.dart | 10 Inserted from lib/isolate/serialization.dart |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // TODO(floitsch): we are losing the generic type. | 83 // TODO(floitsch): we are losing the generic type. |
| 84 return ['list', id, jsArray]; | 84 return ['list', id, jsArray]; |
| 85 } | 85 } |
| 86 | 86 |
| 87 visitMap(Map map) { | 87 visitMap(Map map) { |
| 88 int copyId = _visited[map]; | 88 int copyId = _visited[map]; |
| 89 if (copyId != null) return ['ref', copyId]; | 89 if (copyId != null) return ['ref', copyId]; |
| 90 | 90 |
| 91 int id = _nextFreeRefId++; | 91 int id = _nextFreeRefId++; |
| 92 _visited[map] = id; | 92 _visited[map] = id; |
| 93 var keys = _serializeList(map.keys); | 93 var keys = _serializeList(map.keys.toList()); |
| 94 var values = _serializeList(map.values); | 94 var values = _serializeList(map.values.toList()); |
| 95 // TODO(floitsch): we are losing the generic type. | 95 // TODO(floitsch): we are losing the generic type. |
| 96 return ['map', id, keys, values]; | 96 return ['map', id, keys, values]; |
| 97 } | 97 } |
| 98 | 98 |
| 99 _serializeList(List list) { | 99 _serializeList(List list) { |
| 100 int len = list.length; | 100 int len = list.length; |
| 101 var result = new List(len); | 101 var result = new List.fixedLength(len); |
| 102 for (int i = 0; i < len; i++) { | 102 for (int i = 0; i < len; i++) { |
| 103 result[i] = _dispatch(list[i]); | 103 result[i] = _dispatch(list[i]); |
| 104 } | 104 } |
| 105 return result; | 105 return result; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 /** Deserializes arrays created with [_Serializer]. */ | 109 /** Deserializes arrays created with [_Serializer]. */ |
| 110 abstract class _Deserializer { | 110 abstract class _Deserializer { |
| 111 Map<int, dynamic> _deserialized; | 111 Map<int, dynamic> _deserialized; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 deserializeSendPort(List x); | 173 deserializeSendPort(List x); |
| 174 | 174 |
| 175 deserializeObject(List x) { | 175 deserializeObject(List x) { |
| 176 // TODO(floitsch): Use real exception (which one?). | 176 // TODO(floitsch): Use real exception (which one?). |
| 177 throw "Unexpected serialized object"; | 177 throw "Unexpected serialized object"; |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| OLD | NEW |