| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); | 47 if (x is SendPortSync) return visitSendPortSync(x); |
| 48 | 48 |
| 49 // Overridable fallback. | 49 // Overridable fallback. |
| 50 return visitObject(x); | 50 return visitObject(x); |
| 51 } | 51 } |
| 52 | 52 |
| 53 abstract visitPrimitive(x); | 53 visitPrimitive(x); |
| 54 abstract visitList(List x); | 54 visitList(List x); |
| 55 abstract visitMap(Map x); | 55 visitMap(Map x); |
| 56 abstract visitSendPort(SendPort x); | 56 visitSendPort(SendPort x); |
| 57 abstract visitSendPortSync(SendPortSync x); | 57 visitSendPortSync(SendPortSync x); |
| 58 | 58 |
| 59 visitObject(Object x) { | 59 visitObject(Object x) { |
| 60 // TODO(floitsch): make this a real exception. (which one)? | 60 // TODO(floitsch): make this a real exception. (which one)? |
| 61 throw "Message serialization: Illegal value $x passed"; | 61 throw "Message serialization: Illegal value $x passed"; |
| 62 } | 62 } |
| 63 | 63 |
| 64 static bool isPrimitive(x) { | 64 static bool isPrimitive(x) { |
| 65 return (x == null) || (x is String) || (x is num) || (x is bool); | 65 return (x == null) || (x is String) || (x is num) || (x is bool); |
| 66 } | 66 } |
| 67 } | 67 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 int len = keys.length; | 198 int len = keys.length; |
| 199 assert(len == values.length); | 199 assert(len == values.length); |
| 200 for (int i = 0; i < len; i++) { | 200 for (int i = 0; i < len; i++) { |
| 201 var key = _deserializeHelper(keys[i]); | 201 var key = _deserializeHelper(keys[i]); |
| 202 var value = _deserializeHelper(values[i]); | 202 var value = _deserializeHelper(values[i]); |
| 203 result[key] = value; | 203 result[key] = value; |
| 204 } | 204 } |
| 205 return result; | 205 return result; |
| 206 } | 206 } |
| 207 | 207 |
| 208 abstract 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 |
| OLD | NEW |