| 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 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { | 10 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 676 } |
| 677 } | 677 } |
| 678 return Future.wait(futureClasses); | 678 return Future.wait(futureClasses); |
| 679 } | 679 } |
| 680 | 680 |
| 681 /// Builds the class hierarchy and returns the Object class. | 681 /// Builds the class hierarchy and returns the Object class. |
| 682 Future<Class> _buildClassHierarchy(List<Class> classes) { | 682 Future<Class> _buildClassHierarchy(List<Class> classes) { |
| 683 rootClasses.clear(); | 683 rootClasses.clear(); |
| 684 objectClass = null; | 684 objectClass = null; |
| 685 for (var cls in classes) { | 685 for (var cls in classes) { |
| 686 if (cls.superClass == null) { | 686 if (cls.superclass == null) { |
| 687 rootClasses.add(cls); | 687 rootClasses.add(cls); |
| 688 } | 688 } |
| 689 if ((cls.vmName == 'Object') && (cls.isPatch == false)) { | 689 if ((cls.vmName == 'Object') && (cls.isPatch == false)) { |
| 690 objectClass = cls; | 690 objectClass = cls; |
| 691 } | 691 } |
| 692 } | 692 } |
| 693 assert(objectClass != null); | 693 assert(objectClass != null); |
| 694 return new Future.value(objectClass); | 694 return new Future.value(objectClass); |
| 695 } | 695 } |
| 696 | 696 |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 current.instances = stats[LIVE_AFTER_GC] + stats[ALLOCATED_SINCE_GC]; | 1275 current.instances = stats[LIVE_AFTER_GC] + stats[ALLOCATED_SINCE_GC]; |
| 1276 current.bytes = stats[LIVE_AFTER_GC_SIZE] + stats[ALLOCATED_SINCE_GC_SIZE]; | 1276 current.bytes = stats[LIVE_AFTER_GC_SIZE] + stats[ALLOCATED_SINCE_GC_SIZE]; |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 bool get empty => accumulated.empty && current.empty; | 1279 bool get empty => accumulated.empty && current.empty; |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 class Class extends ServiceObject with Coverage { | 1282 class Class extends ServiceObject with Coverage { |
| 1283 @observable Library library; | 1283 @observable Library library; |
| 1284 @observable Script script; | 1284 @observable Script script; |
| 1285 @observable Class superClass; | |
| 1286 | 1285 |
| 1287 @observable bool isAbstract; | 1286 @observable bool isAbstract; |
| 1288 @observable bool isConst; | 1287 @observable bool isConst; |
| 1289 @observable bool isFinalized; | 1288 @observable bool isFinalized; |
| 1290 @observable bool isPatch; | 1289 @observable bool isPatch; |
| 1291 @observable bool isImplemented; | 1290 @observable bool isImplemented; |
| 1292 | 1291 |
| 1293 @observable int tokenPos; | 1292 @observable int tokenPos; |
| 1294 @observable int endTokenPos; | 1293 @observable int endTokenPos; |
| 1295 | 1294 |
| 1296 @observable ServiceMap error; | 1295 @observable ServiceMap error; |
| 1297 | 1296 |
| 1298 final Allocations newSpace = new Allocations(); | 1297 final Allocations newSpace = new Allocations(); |
| 1299 final Allocations oldSpace = new Allocations(); | 1298 final Allocations oldSpace = new Allocations(); |
| 1300 final AllocationCount promotedByLastNewGC = new AllocationCount(); | 1299 final AllocationCount promotedByLastNewGC = new AllocationCount(); |
| 1301 | 1300 |
| 1302 bool get hasNoAllocations => newSpace.empty && oldSpace.empty; | 1301 bool get hasNoAllocations => newSpace.empty && oldSpace.empty; |
| 1303 | 1302 |
| 1304 @reflectable final children = new ObservableList<Class>(); | |
| 1305 @reflectable final subClasses = new ObservableList<Class>(); | |
| 1306 @reflectable final fields = new ObservableList<ServiceMap>(); | 1303 @reflectable final fields = new ObservableList<ServiceMap>(); |
| 1307 @reflectable final functions = new ObservableList<ServiceFunction>(); | 1304 @reflectable final functions = new ObservableList<ServiceFunction>(); |
| 1305 |
| 1306 @observable Class superclass; |
| 1308 @reflectable final interfaces = new ObservableList<Class>(); | 1307 @reflectable final interfaces = new ObservableList<Class>(); |
| 1308 @reflectable final subclasses = new ObservableList<Class>(); |
| 1309 | 1309 |
| 1310 bool get canCache => true; | 1310 bool get canCache => true; |
| 1311 bool get immutable => false; | 1311 bool get immutable => false; |
| 1312 | 1312 |
| 1313 Class._empty(ServiceObjectOwner owner) : super._empty(owner); | 1313 Class._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 1314 | 1314 |
| 1315 String toString() { | 1315 String toString() { |
| 1316 return 'Service Class: $vmName'; | 1316 return 'Service Class: $vmName'; |
| 1317 } | 1317 } |
| 1318 | 1318 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1341 | 1341 |
| 1342 isAbstract = map['abstract']; | 1342 isAbstract = map['abstract']; |
| 1343 isConst = map['const']; | 1343 isConst = map['const']; |
| 1344 isFinalized = map['finalized']; | 1344 isFinalized = map['finalized']; |
| 1345 isPatch = map['patch']; | 1345 isPatch = map['patch']; |
| 1346 isImplemented = map['implemented']; | 1346 isImplemented = map['implemented']; |
| 1347 | 1347 |
| 1348 tokenPos = map['tokenPos']; | 1348 tokenPos = map['tokenPos']; |
| 1349 endTokenPos = map['endTokenPos']; | 1349 endTokenPos = map['endTokenPos']; |
| 1350 | 1350 |
| 1351 subClasses.clear(); | 1351 subclasses.clear(); |
| 1352 subClasses.addAll(map['subclasses']); | 1352 subclasses.addAll(map['subclasses']); |
| 1353 subClasses.sort(ServiceObject.LexicalSortName); | 1353 subclasses.sort(ServiceObject.LexicalSortName); |
| 1354 | 1354 |
| 1355 fields.clear(); | 1355 fields.clear(); |
| 1356 fields.addAll(map['fields']); | 1356 fields.addAll(map['fields']); |
| 1357 fields.sort(ServiceObject.LexicalSortName); | 1357 fields.sort(ServiceObject.LexicalSortName); |
| 1358 | 1358 |
| 1359 functions.clear(); | 1359 functions.clear(); |
| 1360 functions.addAll(map['functions']); | 1360 functions.addAll(map['functions']); |
| 1361 functions.sort(ServiceObject.LexicalSortName); | 1361 functions.sort(ServiceObject.LexicalSortName); |
| 1362 | 1362 |
| 1363 superClass = map['super']; | 1363 superclass = map['super']; |
| 1364 if (superClass != null) { | 1364 // Work-around Object not tracking its subclasses in the VM. |
| 1365 superClass._addToChildren(this); | 1365 if (superclass != null && superclass.name == "Object") { |
| 1366 superclass._addSubclass(this); |
| 1366 } | 1367 } |
| 1367 error = map['error']; | 1368 error = map['error']; |
| 1368 | 1369 |
| 1369 var allocationStats = map['allocationStats']; | 1370 var allocationStats = map['allocationStats']; |
| 1370 if (allocationStats != null) { | 1371 if (allocationStats != null) { |
| 1371 newSpace.update(allocationStats['new']); | 1372 newSpace.update(allocationStats['new']); |
| 1372 oldSpace.update(allocationStats['old']); | 1373 oldSpace.update(allocationStats['old']); |
| 1373 promotedByLastNewGC.instances = allocationStats['promotedInstances']; | 1374 promotedByLastNewGC.instances = allocationStats['promotedInstances']; |
| 1374 promotedByLastNewGC.bytes = allocationStats['promotedBytes']; | 1375 promotedByLastNewGC.bytes = allocationStats['promotedBytes']; |
| 1375 } | 1376 } |
| 1376 } | 1377 } |
| 1377 | 1378 |
| 1378 void _addToChildren(Class cls) { | 1379 void _addSubclass(Class subclass) { |
| 1379 if (children.contains(cls)) { | 1380 if (subclasses.contains(subclass)) { |
| 1380 return; | 1381 return; |
| 1381 } | 1382 } |
| 1382 children.add(cls); | 1383 subclasses.add(subclass); |
| 1384 subclasses.sort(ServiceObject.LexicalSortName); |
| 1383 } | 1385 } |
| 1384 | 1386 |
| 1385 Future<ServiceObject> get(String command) { | 1387 Future<ServiceObject> get(String command) { |
| 1386 return isolate.get(id + "/$command"); | 1388 return isolate.get(id + "/$command"); |
| 1387 } | 1389 } |
| 1388 } | 1390 } |
| 1389 | 1391 |
| 1390 // TODO(koda): Sync this with VM. | 1392 // TODO(koda): Sync this with VM. |
| 1391 class FunctionKind { | 1393 class FunctionKind { |
| 1392 final String _strValue; | 1394 final String _strValue; |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2260 var v = list[i]; | 2262 var v = list[i]; |
| 2261 if ((v is ObservableMap) && _isServiceMap(v)) { | 2263 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 2262 list[i] = owner.getFromMap(v); | 2264 list[i] = owner.getFromMap(v); |
| 2263 } else if (v is ObservableList) { | 2265 } else if (v is ObservableList) { |
| 2264 _upgradeObservableList(v, owner); | 2266 _upgradeObservableList(v, owner); |
| 2265 } else if (v is ObservableMap) { | 2267 } else if (v is ObservableMap) { |
| 2266 _upgradeObservableMap(v, owner); | 2268 _upgradeObservableMap(v, owner); |
| 2267 } | 2269 } |
| 2268 } | 2270 } |
| 2269 } | 2271 } |
| OLD | NEW |