| 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 /// A [ServiceObject] is an object known to the VM service and is tied | 7 /// A [ServiceObject] is an object known to the VM service and is tied |
| 8 /// to an owning [Isolate]. | 8 /// to an owning [Isolate]. |
| 9 abstract class ServiceObject extends Observable { | 9 abstract class ServiceObject extends Observable { |
| 10 Isolate _isolate; | 10 Isolate _isolate; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } else if (v is ObservableMap) { | 156 } else if (v is ObservableMap) { |
| 157 _upgradeObservableMap(v, vm, isolate); | 157 _upgradeObservableMap(v, vm, isolate); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 /// Upgrades response ([m]) from [vm] and [isolate] to a [ServiceObject]. | 162 /// Upgrades response ([m]) from [vm] and [isolate] to a [ServiceObject]. |
| 163 /// This acts like a factory which consumes an ObservableMap and returns | 163 /// This acts like a factory which consumes an ObservableMap and returns |
| 164 /// a fully upgraded ServiceObject. | 164 /// a fully upgraded ServiceObject. |
| 165 ServiceObject _upgradeToServiceObject(VM vm, Isolate isolate, ObservableMap m) { | 165 ServiceObject _upgradeToServiceObject(VM vm, Isolate isolate, ObservableMap m) { |
| 166 if (!ServiceObject.isServiceMap(m)) { |
| 167 Logger.root.severe("Malformed service object: $m"); |
| 168 } |
| 166 assert(ServiceObject.isServiceMap(m)); | 169 assert(ServiceObject.isServiceMap(m)); |
| 167 var type = ServiceObject.stripRef(m['type']); | 170 var type = ServiceObject.stripRef(m['type']); |
| 168 switch (type) { | 171 switch (type) { |
| 169 case 'Error': | 172 case 'Error': |
| 170 return new ServiceError.fromMap(isolate, m); | 173 return new ServiceError.fromMap(isolate, m); |
| 171 case 'IsolateList': | 174 case 'IsolateList': |
| 172 vm.isolates.update(m); | 175 vm.isolates.update(m); |
| 173 return vm.isolates; | 176 return vm.isolates; |
| 174 case 'Script': | 177 case 'Script': |
| 175 return isolate.scripts.putIfAbsent(m); | 178 return isolate.scripts.putIfAbsent(m); |
| 176 case 'Code': | 179 case 'Code': |
| 177 return isolate.codes.putIfAbsent(m); | 180 return isolate.codes.putIfAbsent(m); |
| 178 case 'Isolate': | 181 case 'Isolate': |
| 179 return vm.isolates.getIsolateFromMap(m); | 182 return vm.isolates.getIsolateFromMap(m); |
| 180 case 'Class': | 183 case 'Class': |
| 181 return isolate.classes.putIfAbsent(m); | 184 return isolate.classes.putIfAbsent(m); |
| 182 } | 185 } |
| 183 return new ServiceMap.fromMap(isolate, m); | 186 return new ServiceMap.fromMap(isolate, m); |
| 184 } | 187 } |
| OLD | NEW |