| 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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 | 1068 |
| 1069 void _update(ObservableMap map, bool mapIsRef) { | 1069 void _update(ObservableMap map, bool mapIsRef) { |
| 1070 _loaded = !mapIsRef; | 1070 _loaded = !mapIsRef; |
| 1071 | 1071 |
| 1072 // TODO(turnidge): Currently _map.clear() prevents us from | 1072 // TODO(turnidge): Currently _map.clear() prevents us from |
| 1073 // upgrading an already upgraded submap. Is clearing really the | 1073 // upgrading an already upgraded submap. Is clearing really the |
| 1074 // right thing to do here? | 1074 // right thing to do here? |
| 1075 _map.clear(); | 1075 _map.clear(); |
| 1076 _map.addAll(map); | 1076 _map.addAll(map); |
| 1077 | 1077 |
| 1078 name = _map['user_name']; | 1078 name = _map['name']; |
| 1079 vmName = _map['name']; | 1079 vmName = (_map.containsKey('vmName') ? _map['vmName'] : name); |
| 1080 _upgradeValues(); | 1080 _upgradeValues(); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 // Forward Map interface calls. | 1083 // Forward Map interface calls. |
| 1084 void addAll(Map other) => _map.addAll(other); | 1084 void addAll(Map other) => _map.addAll(other); |
| 1085 void clear() => _map.clear(); | 1085 void clear() => _map.clear(); |
| 1086 bool containsValue(v) => _map.containsValue(v); | 1086 bool containsValue(v) => _map.containsValue(v); |
| 1087 bool containsKey(k) => _map.containsKey(k); | 1087 bool containsKey(k) => _map.containsKey(k); |
| 1088 void forEach(Function f) => _map.forEach(f); | 1088 void forEach(Function f) => _map.forEach(f); |
| 1089 putIfAbsent(key, Function ifAbsent) => _map.putIfAbsent(key, ifAbsent); | 1089 putIfAbsent(key, Function ifAbsent) => _map.putIfAbsent(key, ifAbsent); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 | 1209 |
| 1210 Library._empty(ServiceObjectOwner owner) : super._empty(owner); | 1210 Library._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 1211 | 1211 |
| 1212 void _update(ObservableMap map, bool mapIsRef) { | 1212 void _update(ObservableMap map, bool mapIsRef) { |
| 1213 url = map['url']; | 1213 url = map['url']; |
| 1214 var shortUrl = url; | 1214 var shortUrl = url; |
| 1215 if (url.startsWith('file://') || | 1215 if (url.startsWith('file://') || |
| 1216 url.startsWith('http://')) { | 1216 url.startsWith('http://')) { |
| 1217 shortUrl = url.substring(url.lastIndexOf('/') + 1); | 1217 shortUrl = url.substring(url.lastIndexOf('/') + 1); |
| 1218 } | 1218 } |
| 1219 name = map['user_name']; | 1219 name = map['name']; |
| 1220 if (name.isEmpty) { | 1220 if (name.isEmpty) { |
| 1221 // When there is no name for a library, use the shortUrl. |
| 1221 name = shortUrl; | 1222 name = shortUrl; |
| 1222 } | 1223 } |
| 1223 vmName = map['name']; | 1224 vmName = (map.containsKey('vmName') ? map['vmName'] : name); |
| 1224 if (mapIsRef) { | 1225 if (mapIsRef) { |
| 1225 return; | 1226 return; |
| 1226 } | 1227 } |
| 1227 _loaded = true; | 1228 _loaded = true; |
| 1228 _upgradeCollection(map, isolate); | 1229 _upgradeCollection(map, isolate); |
| 1229 imports.clear(); | 1230 imports.clear(); |
| 1230 imports.addAll(removeDuplicatesAndSortLexical(map['imports'])); | 1231 imports.addAll(removeDuplicatesAndSortLexical(map['imports'])); |
| 1231 scripts.clear(); | 1232 scripts.clear(); |
| 1232 scripts.addAll(removeDuplicatesAndSortLexical(map['scripts'])); | 1233 scripts.addAll(removeDuplicatesAndSortLexical(map['scripts'])); |
| 1233 classes.clear(); | 1234 classes.clear(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 bool get canCache => true; | 1310 bool get canCache => true; |
| 1310 bool get immutable => false; | 1311 bool get immutable => false; |
| 1311 | 1312 |
| 1312 Class._empty(ServiceObjectOwner owner) : super._empty(owner); | 1313 Class._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 1313 | 1314 |
| 1314 String toString() { | 1315 String toString() { |
| 1315 return 'Service Class: $vmName'; | 1316 return 'Service Class: $vmName'; |
| 1316 } | 1317 } |
| 1317 | 1318 |
| 1318 void _update(ObservableMap map, bool mapIsRef) { | 1319 void _update(ObservableMap map, bool mapIsRef) { |
| 1319 name = map['user_name']; | 1320 name = map['name']; |
| 1320 vmName = map['name']; | 1321 vmName = (map.containsKey('vmName') ? map['vmName'] : name); |
| 1321 | 1322 |
| 1322 if (mapIsRef) { | 1323 if (mapIsRef) { |
| 1323 return; | 1324 return; |
| 1324 } | 1325 } |
| 1325 | 1326 |
| 1326 // We are fully loaded. | 1327 // We are fully loaded. |
| 1327 _loaded = true; | 1328 _loaded = true; |
| 1328 | 1329 |
| 1329 // Extract full properties. | 1330 // Extract full properties. |
| 1330 _upgradeCollection(map, isolate); | 1331 _upgradeCollection(map, isolate); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 @observable bool isInlinable; | 1448 @observable bool isInlinable; |
| 1448 @observable FunctionKind kind; | 1449 @observable FunctionKind kind; |
| 1449 @observable int deoptimizations; | 1450 @observable int deoptimizations; |
| 1450 @observable String qualifiedName; | 1451 @observable String qualifiedName; |
| 1451 @observable int usageCounter; | 1452 @observable int usageCounter; |
| 1452 @observable bool isDart; | 1453 @observable bool isDart; |
| 1453 | 1454 |
| 1454 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); | 1455 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); |
| 1455 | 1456 |
| 1456 void _update(ObservableMap map, bool mapIsRef) { | 1457 void _update(ObservableMap map, bool mapIsRef) { |
| 1457 name = map['user_name']; | 1458 name = map['name']; |
| 1458 vmName = map['name']; | 1459 vmName = (map.containsKey('vmName') ? map['vmName'] : name); |
| 1459 | 1460 |
| 1460 _upgradeCollection(map, isolate); | 1461 _upgradeCollection(map, isolate); |
| 1461 | 1462 |
| 1462 owningClass = map.containsKey('owningClass') ? map['owningClass'] : null; | 1463 owningClass = map.containsKey('owningClass') ? map['owningClass'] : null; |
| 1463 owningLibrary = map.containsKey('owningLibrary') ? map['owningLibrary'] : nu
ll; | 1464 owningLibrary = map.containsKey('owningLibrary') ? map['owningLibrary'] : nu
ll; |
| 1464 kind = FunctionKind.fromJSON(map['kind']); | 1465 kind = FunctionKind.fromJSON(map['kind']); |
| 1465 isDart = !kind.isFake(); | 1466 isDart = !kind.isFake(); |
| 1466 | 1467 |
| 1467 if (mapIsRef) { return; } | 1468 if (mapIsRef) { return; } |
| 1468 | 1469 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 } | 1985 } |
| 1985 formattedInclusiveTicks = | 1986 formattedInclusiveTicks = |
| 1986 '${formatPercent(inclusiveTicks, totalSamplesInProfile)} ' | 1987 '${formatPercent(inclusiveTicks, totalSamplesInProfile)} ' |
| 1987 '($inclusiveTicks)'; | 1988 '($inclusiveTicks)'; |
| 1988 formattedExclusiveTicks = | 1989 formattedExclusiveTicks = |
| 1989 '${formatPercent(exclusiveTicks, totalSamplesInProfile)} ' | 1990 '${formatPercent(exclusiveTicks, totalSamplesInProfile)} ' |
| 1990 '($exclusiveTicks)'; | 1991 '($exclusiveTicks)'; |
| 1991 } | 1992 } |
| 1992 | 1993 |
| 1993 void _update(ObservableMap m, bool mapIsRef) { | 1994 void _update(ObservableMap m, bool mapIsRef) { |
| 1994 name = m['user_name']; | 1995 name = m['name']; |
| 1995 vmName = m['name']; | 1996 vmName = (m.containsKey('vmName') ? m['vmName'] : name); |
| 1996 isOptimized = m['isOptimized'] != null ? m['isOptimized'] : false; | 1997 isOptimized = m['isOptimized'] != null ? m['isOptimized'] : false; |
| 1997 kind = CodeKind.fromString(m['kind']); | 1998 kind = CodeKind.fromString(m['kind']); |
| 1998 startAddress = int.parse(m['start'], radix:16); | 1999 startAddress = int.parse(m['start'], radix:16); |
| 1999 endAddress = int.parse(m['end'], radix:16); | 2000 endAddress = int.parse(m['end'], radix:16); |
| 2000 function = isolate.getFromMap(m['function']); | 2001 function = isolate.getFromMap(m['function']); |
| 2001 objectPool = isolate.getFromMap(m['object_pool']); | 2002 objectPool = isolate.getFromMap(m['object_pool']); |
| 2002 var disassembly = m['disassembly']; | 2003 var disassembly = m['disassembly']; |
| 2003 if (disassembly != null) { | 2004 if (disassembly != null) { |
| 2004 _processDisassembly(disassembly); | 2005 _processDisassembly(disassembly); |
| 2005 } | 2006 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2259 var v = list[i]; | 2260 var v = list[i]; |
| 2260 if ((v is ObservableMap) && _isServiceMap(v)) { | 2261 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 2261 list[i] = owner.getFromMap(v); | 2262 list[i] = owner.getFromMap(v); |
| 2262 } else if (v is ObservableList) { | 2263 } else if (v is ObservableList) { |
| 2263 _upgradeObservableList(v, owner); | 2264 _upgradeObservableList(v, owner); |
| 2264 } else if (v is ObservableMap) { | 2265 } else if (v is ObservableMap) { |
| 2265 _upgradeObservableMap(v, owner); | 2266 _upgradeObservableMap(v, owner); |
| 2266 } | 2267 } |
| 2267 } | 2268 } |
| 2268 } | 2269 } |
| OLD | NEW |