OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of service; | 5 part of service; |
6 | 6 |
7 /// Recursively upgrades all [ServiceObject]s inside [collection] which must | 7 /// Recursively upgrades all [ServiceObject]s inside [collection] which must |
8 /// be an [ObservableMap] or an [ObservableList]. Upgraded elements will be | 8 /// be an [ObservableMap] or an [ObservableList]. Upgraded elements will be |
9 /// associated with [vm] and [isolate]. | 9 /// associated with [vm] and [isolate]. |
10 void upgradeCollection(collection, VM vm, Isolate isolate) { | 10 void upgradeCollection(collection, VM vm, Isolate isolate) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (m == null) { | 47 if (m == null) { |
48 return null; | 48 return null; |
49 } | 49 } |
50 if (!ServiceObject.isServiceMap(m)) { | 50 if (!ServiceObject.isServiceMap(m)) { |
51 Logger.root.severe("Malformed service object: $m"); | 51 Logger.root.severe("Malformed service object: $m"); |
52 } | 52 } |
53 assert(ServiceObject.isServiceMap(m)); | 53 assert(ServiceObject.isServiceMap(m)); |
54 var type = ServiceObject.stripRef(m['type']); | 54 var type = ServiceObject.stripRef(m['type']); |
55 switch (type) { | 55 switch (type) { |
56 case 'Error': | 56 case 'Error': |
57 return new ServiceError.fromMap(isolate, m); | 57 if (isolate != null) { |
58 case 'IsolateList': | 58 return new ServiceError.fromMap(isolate, m); |
59 vm.isolates.update(m); | 59 } else { |
60 return vm.isolates; | 60 return new ServiceError.fromMap(vm, m); |
| 61 } |
| 62 break; |
61 case 'Script': | 63 case 'Script': |
62 return isolate.scripts.putIfAbsent(m); | 64 return isolate.scripts.putIfAbsent(m); |
63 case 'Code': | 65 case 'Code': |
64 return isolate.codes.putIfAbsent(m); | 66 return isolate.codes.putIfAbsent(m); |
65 case 'Isolate': | 67 case 'Isolate': |
66 return vm.isolates.getIsolateFromMap(m); | 68 return vm.isolates.getIsolateFromMap(m); |
67 case 'Class': | 69 case 'Class': |
68 return isolate.classes.putIfAbsent(m); | 70 return isolate.classes.putIfAbsent(m); |
69 case 'Function': | 71 case 'Function': |
70 return isolate.functions.putIfAbsent(m); | 72 return isolate.functions.putIfAbsent(m); |
| 73 case 'VM': |
| 74 return vm.update(m); |
71 } | 75 } |
72 return new ServiceMap.fromMap(isolate, m); | 76 return new ServiceMap.fromMap(isolate, m); |
73 } | 77 } |
OLD | NEW |