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

Side by Side Diff: lib/isolate/serialization.dart

Issue 10690142: Move function serialization to sync ports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
« no previous file with comments | « lib/html/src/Isolates.dart ('k') | tests/html/js_interop_func_passing_test.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 class _MessageTraverserVisitedMap { 5 class _MessageTraverserVisitedMap {
6 6
7 operator[](var object) => null; 7 operator[](var object) => null;
8 void operator[]=(var object, var info) { } 8 void operator[]=(var object, var info) { }
9 9
10 void reset() { } 10 void reset() { }
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 return result; 31 return result;
32 } 32 }
33 33
34 _dispatch(var x) { 34 _dispatch(var x) {
35 if (isPrimitive(x)) return visitPrimitive(x); 35 if (isPrimitive(x)) return visitPrimitive(x);
36 if (x is List) return visitList(x); 36 if (x is List) return visitList(x);
37 if (x is Map) return visitMap(x); 37 if (x is Map) return visitMap(x);
38 if (x is SendPort) return visitSendPort(x); 38 if (x is SendPort) return visitSendPort(x);
39 if (x is SendPortSync) return visitSendPortSync(x); 39 if (x is SendPortSync) return visitSendPortSync(x);
40 if (x is Function) return visitFunction(x);
40 41
41 // TODO(floitsch): make this a real exception. (which one)? 42 // TODO(floitsch): make this a real exception. (which one)?
42 throw "Message serialization: Illegal value $x passed"; 43 throw "Message serialization: Illegal value $x passed";
43 } 44 }
44 45
45 abstract visitPrimitive(x); 46 abstract visitPrimitive(x);
46 abstract visitList(List x); 47 abstract visitList(List x);
47 abstract visitMap(Map x); 48 abstract visitMap(Map x);
48 abstract visitSendPort(SendPort x); 49 abstract visitSendPort(SendPort x);
49 abstract visitSendPortSync(SendPortSync x); 50 abstract visitSendPortSync(SendPortSync x);
50 51
52 visitFunction(Function func) {
53 throw "Serialization of functions is not allowed.";
54 }
55
51 static bool isPrimitive(x) { 56 static bool isPrimitive(x) {
52 return (x === null) || (x is String) || (x is num) || (x is bool); 57 return (x === null) || (x is String) || (x is num) || (x is bool);
53 } 58 }
54 } 59 }
55 60
56 61
57 /** A visitor that recursively copies a message. */ 62 /** A visitor that recursively copies a message. */
58 class _Copier extends _MessageTraverser { 63 class _Copier extends _MessageTraverser {
59 64
60 visitPrimitive(x) => x; 65 visitPrimitive(x) => x;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 var key = _deserializeHelper(keys[i]); 194 var key = _deserializeHelper(keys[i]);
190 var value = _deserializeHelper(values[i]); 195 var value = _deserializeHelper(values[i]);
191 result[key] = value; 196 result[key] = value;
192 } 197 }
193 return result; 198 return result;
194 } 199 }
195 200
196 abstract deserializeSendPort(List x); 201 abstract deserializeSendPort(List x);
197 202
198 } 203 }
OLDNEW
« no previous file with comments | « lib/html/src/Isolates.dart ('k') | tests/html/js_interop_func_passing_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698