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

Side by Side Diff: sdk/lib/html/src/Serialization.dart

Issue 11312122: Change List constructors. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload. Adapt code for List.fixedLength. Created 8 years 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/html/src/native_DOMImplementation.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 visitPrimitive(x) => x; 73 visitPrimitive(x) => x;
74 74
75 List visitList(List list) { 75 List visitList(List list) {
76 List copy = _visited[list]; 76 List copy = _visited[list];
77 if (copy != null) return copy; 77 if (copy != null) return copy;
78 78
79 int len = list.length; 79 int len = list.length;
80 80
81 // TODO(floitsch): we loose the generic type of the List. 81 // TODO(floitsch): we loose the generic type of the List.
82 copy = new List(len); 82 copy = new List.fixedLength(len);
83 _visited[list] = copy; 83 _visited[list] = copy;
84 for (int i = 0; i < len; i++) { 84 for (int i = 0; i < len; i++) {
85 copy[i] = _dispatch(list[i]); 85 copy[i] = _dispatch(list[i]);
86 } 86 }
87 return copy; 87 return copy;
88 } 88 }
89 89
90 Map visitMap(Map map) { 90 Map visitMap(Map map) {
91 Map copy = _visited[map]; 91 Map copy = _visited[map];
92 if (copy != null) return copy; 92 if (copy != null) return copy;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 int id = _nextFreeRefId++; 126 int id = _nextFreeRefId++;
127 _visited[map] = id; 127 _visited[map] = id;
128 var keys = _serializeList(map.keys); 128 var keys = _serializeList(map.keys);
129 var values = _serializeList(map.values); 129 var values = _serializeList(map.values);
130 // TODO(floitsch): we are losing the generic type. 130 // TODO(floitsch): we are losing the generic type.
131 return ['map', id, keys, values]; 131 return ['map', id, keys, values];
132 } 132 }
133 133
134 _serializeList(List list) { 134 _serializeList(List list) {
135 int len = list.length; 135 int len = list.length;
136 var result = new List(len); 136 var result = new List.fixedLength(len);
137 for (int i = 0; i < len; i++) { 137 for (int i = 0; i < len; i++) {
138 result[i] = _dispatch(list[i]); 138 result[i] = _dispatch(list[i]);
139 } 139 }
140 return result; 140 return result;
141 } 141 }
142 } 142 }
143 143
144 /** Deserializes arrays created with [_Serializer]. */ 144 /** Deserializes arrays created with [_Serializer]. */
145 class _Deserializer { 145 class _Deserializer {
146 Map<int, dynamic> _deserialized; 146 Map<int, dynamic> _deserialized;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 207
208 deserializeSendPort(List x); 208 deserializeSendPort(List x);
209 209
210 deserializeObject(List x) { 210 deserializeObject(List x) {
211 // TODO(floitsch): Use real exception (which one?). 211 // TODO(floitsch): Use real exception (which one?).
212 throw "Unexpected serialized object"; 212 throw "Unexpected serialized object";
213 } 213 }
214 } 214 }
215 215
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/html/src/native_DOMImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698