| 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 26 matching lines...) Expand all Loading... |
| 37 _visited.cleanup(); | 37 _visited.cleanup(); |
| 38 } | 38 } |
| 39 return result; | 39 return result; |
| 40 } | 40 } |
| 41 | 41 |
| 42 _dispatch(var x) { | 42 _dispatch(var x) { |
| 43 if (isPrimitive(x)) return visitPrimitive(x); | 43 if (isPrimitive(x)) return visitPrimitive(x); |
| 44 if (x is List) return visitList(x); | 44 if (x is List) return visitList(x); |
| 45 if (x is Map) return visitMap(x); | 45 if (x is Map) return visitMap(x); |
| 46 if (x is SendPort) return visitSendPort(x); | 46 if (x is SendPort) return visitSendPort(x); |
| 47 if (x is SendPortSync) return visitSendPortSync(x); | |
| 48 | 47 |
| 49 // Overridable fallback. | 48 // Overridable fallback. |
| 50 return visitObject(x); | 49 return visitObject(x); |
| 51 } | 50 } |
| 52 | 51 |
| 53 visitPrimitive(x); | 52 visitPrimitive(x); |
| 54 visitList(List x); | 53 visitList(List x); |
| 55 visitMap(Map x); | 54 visitMap(Map x); |
| 56 visitSendPort(SendPort x); | 55 visitSendPort(SendPort x); |
| 57 visitSendPortSync(SendPortSync x); | |
| 58 | 56 |
| 59 visitObject(Object x) { | 57 visitObject(Object x) { |
| 60 // TODO(floitsch): make this a real exception. (which one)? | 58 // TODO(floitsch): make this a real exception. (which one)? |
| 61 throw "Message serialization: Illegal value $x passed"; | 59 throw "Message serialization: Illegal value $x passed"; |
| 62 } | 60 } |
| 63 | 61 |
| 64 static bool isPrimitive(x) { | 62 static bool isPrimitive(x) { |
| 65 return (x == null) || (x is String) || (x is num) || (x is bool); | 63 return (x == null) || (x is String) || (x is num) || (x is bool); |
| 66 } | 64 } |
| 67 } | 65 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 169 } |
| 172 | 170 |
| 173 deserializeSendPort(List x); | 171 deserializeSendPort(List x); |
| 174 | 172 |
| 175 deserializeObject(List x) { | 173 deserializeObject(List x) { |
| 176 // TODO(floitsch): Use real exception (which one?). | 174 // TODO(floitsch): Use real exception (which one?). |
| 177 throw "Unexpected serialized object"; | 175 throw "Unexpected serialized object"; |
| 178 } | 176 } |
| 179 } | 177 } |
| 180 | 178 |
| OLD | NEW |