| 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 /// An RpcException represents an exceptional event that happened | 7 /// An RpcException represents an exceptional event that happened |
| 8 /// while invoking an rpc. | 8 /// while invoking an rpc. |
| 9 abstract class RpcException implements Exception { | 9 abstract class RpcException implements Exception { |
| 10 RpcException(this.message); | 10 RpcException(this.message); |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 | 1246 |
| 1247 Future<ServiceObject> _eval(ServiceObject target, | 1247 Future<ServiceObject> _eval(ServiceObject target, |
| 1248 String expression) { | 1248 String expression) { |
| 1249 Map params = { | 1249 Map params = { |
| 1250 'targetId': target.id, | 1250 'targetId': target.id, |
| 1251 'expression': expression, | 1251 'expression': expression, |
| 1252 }; | 1252 }; |
| 1253 return invokeRpc('evaluate', params); | 1253 return invokeRpc('evaluate', params); |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 Future<ServiceObject> evalFrame(int framePos, | 1256 Future<ServiceObject> evalFrame(int frameIndex, |
| 1257 String expression) { | 1257 String expression) { |
| 1258 Map params = { | 1258 Map params = { |
| 1259 'frame': framePos, | 1259 'frameIndex': frameIndex, |
| 1260 'expression': expression, | 1260 'expression': expression, |
| 1261 }; | 1261 }; |
| 1262 return invokeRpc('evaluateInFrame', params); | 1262 return invokeRpc('evaluateInFrame', params); |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 Future<ServiceObject> getRetainedSize(ServiceObject target) { | 1265 Future<ServiceObject> getRetainedSize(ServiceObject target) { |
| 1266 Map params = { | 1266 Map params = { |
| 1267 'targetId': target.id, | 1267 'targetId': target.id, |
| 1268 }; | 1268 }; |
| 1269 return invokeRpc('_getRetainedSize', params); | 1269 return invokeRpc('_getRetainedSize', params); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 Stream<List<ChangeRecord>> get changes => _map.changes; | 1405 Stream<List<ChangeRecord>> get changes => _map.changes; |
| 1406 bool get hasObservers => _map.hasObservers; | 1406 bool get hasObservers => _map.hasObservers; |
| 1407 | 1407 |
| 1408 String toString() => "ServiceMap($_map)"; | 1408 String toString() => "ServiceMap($_map)"; |
| 1409 } | 1409 } |
| 1410 | 1410 |
| 1411 /// A [DartError] is peered to a Dart Error object. | 1411 /// A [DartError] is peered to a Dart Error object. |
| 1412 class DartError extends ServiceObject { | 1412 class DartError extends ServiceObject { |
| 1413 DartError._empty(ServiceObject owner) : super._empty(owner); | 1413 DartError._empty(ServiceObject owner) : super._empty(owner); |
| 1414 | 1414 |
| 1415 @observable String kind; | |
| 1416 @observable String message; | 1415 @observable String message; |
| 1417 @observable Instance exception; | 1416 @observable Instance exception; |
| 1418 @observable Instance stacktrace; | 1417 @observable Instance stacktrace; |
| 1419 | 1418 |
| 1420 void _update(ObservableMap map, bool mapIsRef) { | 1419 void _update(ObservableMap map, bool mapIsRef) { |
| 1421 kind = map['kind']; | |
| 1422 message = map['message']; | 1420 message = map['message']; |
| 1423 exception = new ServiceObject._fromMap(owner, map['exception']); | 1421 exception = new ServiceObject._fromMap(owner, map['exception']); |
| 1424 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); | 1422 stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']); |
| 1425 name = 'DartError $kind'; | 1423 name = 'DartError($message)'; |
| 1426 vmName = name; | 1424 vmName = name; |
| 1427 } | 1425 } |
| 1428 | 1426 |
| 1429 String toString() => 'DartError($message)'; | 1427 String toString() => 'DartError($message)'; |
| 1430 } | 1428 } |
| 1431 | 1429 |
| 1432 /// A [ServiceEvent] is an asynchronous event notification from the vm. | 1430 /// A [ServiceEvent] is an asynchronous event notification from the vm. |
| 1433 class ServiceEvent extends ServiceObject { | 1431 class ServiceEvent extends ServiceObject { |
| 1434 /// The possible 'eventType' values. | 1432 /// The possible 'eventType' values. |
| 1435 static const kIsolateStart = 'IsolateStart'; | 1433 static const kIsolateStart = 'IsolateStart'; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 if (map['library'] is Library) { | 1729 if (map['library'] is Library) { |
| 1732 library = map['library']; | 1730 library = map['library']; |
| 1733 } else { | 1731 } else { |
| 1734 library = null; | 1732 library = null; |
| 1735 } | 1733 } |
| 1736 | 1734 |
| 1737 script = map['script']; | 1735 script = map['script']; |
| 1738 | 1736 |
| 1739 isAbstract = map['abstract']; | 1737 isAbstract = map['abstract']; |
| 1740 isConst = map['const']; | 1738 isConst = map['const']; |
| 1741 isFinalized = map['finalized']; | 1739 isFinalized = map['_finalized']; |
| 1742 isPatch = map['patch']; | 1740 isPatch = map['_patch']; |
| 1743 isImplemented = map['implemented']; | 1741 isImplemented = map['_implemented']; |
| 1744 | 1742 |
| 1745 tokenPos = map['tokenPos']; | 1743 tokenPos = map['tokenPos']; |
| 1746 endTokenPos = map['endTokenPos']; | 1744 endTokenPos = map['endTokenPos']; |
| 1747 | 1745 |
| 1748 subclasses.clear(); | 1746 subclasses.clear(); |
| 1749 subclasses.addAll(map['subclasses']); | 1747 subclasses.addAll(map['subclasses']); |
| 1750 subclasses.sort(ServiceObject.LexicalSortName); | 1748 subclasses.sort(ServiceObject.LexicalSortName); |
| 1751 | 1749 |
| 1752 interfaces.clear(); | 1750 interfaces.clear(); |
| 1753 interfaces.addAll(map['interfaces']); | 1751 interfaces.addAll(map['interfaces']); |
| 1754 interfaces.sort(ServiceObject.LexicalSortName); | 1752 interfaces.sort(ServiceObject.LexicalSortName); |
| 1755 | 1753 |
| 1756 fields.clear(); | 1754 fields.clear(); |
| 1757 fields.addAll(map['fields']); | 1755 fields.addAll(map['fields']); |
| 1758 fields.sort(ServiceObject.LexicalSortName); | 1756 fields.sort(ServiceObject.LexicalSortName); |
| 1759 | 1757 |
| 1760 functions.clear(); | 1758 functions.clear(); |
| 1761 functions.addAll(map['functions']); | 1759 functions.addAll(map['functions']); |
| 1762 functions.sort(ServiceObject.LexicalSortName); | 1760 functions.sort(ServiceObject.LexicalSortName); |
| 1763 | 1761 |
| 1764 superclass = map['super']; | 1762 superclass = map['super']; |
| 1765 // Work-around Object not tracking its subclasses in the VM. | 1763 // Work-around Object not tracking its subclasses in the VM. |
| 1766 if (superclass != null && superclass.name == "Object") { | 1764 if (superclass != null && superclass.name == "Object") { |
| 1767 superclass._addSubclass(this); | 1765 superclass._addSubclass(this); |
| 1768 } | 1766 } |
| 1769 error = map['error']; | 1767 error = map['error']; |
| 1770 | 1768 |
| 1771 var allocationStats = map['allocationStats']; | 1769 var allocationStats = map['_allocationStats']; |
| 1772 if (allocationStats != null) { | 1770 if (allocationStats != null) { |
| 1773 newSpace.update(allocationStats['new']); | 1771 newSpace.update(allocationStats['new']); |
| 1774 oldSpace.update(allocationStats['old']); | 1772 oldSpace.update(allocationStats['old']); |
| 1775 notifyPropertyChange(#hasNoAllocations, 0, 1); | 1773 notifyPropertyChange(#hasNoAllocations, 0, 1); |
| 1776 promotedByLastNewGC.instances = allocationStats['promotedInstances']; | 1774 promotedByLastNewGC.instances = allocationStats['promotedInstances']; |
| 1777 promotedByLastNewGC.bytes = allocationStats['promotedBytes']; | 1775 promotedByLastNewGC.bytes = allocationStats['promotedBytes']; |
| 1778 } | 1776 } |
| 1779 } | 1777 } |
| 1780 | 1778 |
| 1781 void _addSubclass(Class subclass) { | 1779 void _addSubclass(Class subclass) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1828 valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true; | 1826 valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true; |
| 1829 function = map['function']; | 1827 function = map['function']; |
| 1830 context = map['context']; | 1828 context = map['context']; |
| 1831 name = map['name']; | 1829 name = map['name']; |
| 1832 length = map['length']; | 1830 length = map['length']; |
| 1833 | 1831 |
| 1834 if (mapIsRef) { | 1832 if (mapIsRef) { |
| 1835 return; | 1833 return; |
| 1836 } | 1834 } |
| 1837 | 1835 |
| 1838 nativeFields = map['nativeFields']; | 1836 nativeFields = map['_nativeFields']; |
| 1839 fields = map['fields']; | 1837 fields = map['fields']; |
| 1840 elements = map['elements']; | 1838 elements = map['elements']; |
| 1841 typeClass = map['type_class']; | 1839 typeClass = map['type_class']; |
| 1842 userName = map['user_name']; | 1840 userName = map['user_name']; |
| 1843 referent = map['referent']; | 1841 referent = map['referent']; |
| 1844 key = map['key']; | 1842 key = map['key']; |
| 1845 value = map['value']; | 1843 value = map['value']; |
| 1846 | 1844 |
| 1847 // We are fully loaded. | 1845 // We are fully loaded. |
| 1848 _loaded = true; | 1846 _loaded = true; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 | 1975 |
| 1978 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); | 1976 ServiceFunction._empty(ServiceObject owner) : super._empty(owner); |
| 1979 | 1977 |
| 1980 void _update(ObservableMap map, bool mapIsRef) { | 1978 void _update(ObservableMap map, bool mapIsRef) { |
| 1981 name = map['name']; | 1979 name = map['name']; |
| 1982 vmName = (map.containsKey('vmName') ? map['vmName'] : name); | 1980 vmName = (map.containsKey('vmName') ? map['vmName'] : name); |
| 1983 | 1981 |
| 1984 _upgradeCollection(map, isolate); | 1982 _upgradeCollection(map, isolate); |
| 1985 | 1983 |
| 1986 dartOwner = map['owner']; | 1984 dartOwner = map['owner']; |
| 1987 kind = FunctionKind.fromJSON(map['kind']); | 1985 kind = FunctionKind.fromJSON(map['_kind']); |
| 1988 isDart = !kind.isSynthetic(); | 1986 isDart = !kind.isSynthetic(); |
| 1989 | 1987 |
| 1990 if (dartOwner is ServiceFunction) { | 1988 if (dartOwner is ServiceFunction) { |
| 1991 ServiceFunction ownerFunction = dartOwner; | 1989 ServiceFunction ownerFunction = dartOwner; |
| 1992 library = ownerFunction.library; | 1990 library = ownerFunction.library; |
| 1993 qualifiedName = "${ownerFunction.qualifiedName}.${name}"; | 1991 qualifiedName = "${ownerFunction.qualifiedName}.${name}"; |
| 1994 | 1992 |
| 1995 } else if (dartOwner is Class) { | 1993 } else if (dartOwner is Class) { |
| 1996 Class ownerClass = dartOwner; | 1994 Class ownerClass = dartOwner; |
| 1997 library = ownerClass.library; | 1995 library = ownerClass.library; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2023 | 2021 |
| 2024 | 2022 |
| 2025 class Field extends ServiceObject { | 2023 class Field extends ServiceObject { |
| 2026 // Library or Class. | 2024 // Library or Class. |
| 2027 @observable ServiceObject dartOwner; | 2025 @observable ServiceObject dartOwner; |
| 2028 @observable Library library; | 2026 @observable Library library; |
| 2029 @observable Instance declaredType; | 2027 @observable Instance declaredType; |
| 2030 @observable bool isStatic; | 2028 @observable bool isStatic; |
| 2031 @observable bool isFinal; | 2029 @observable bool isFinal; |
| 2032 @observable bool isConst; | 2030 @observable bool isConst; |
| 2033 @observable Instance value; | 2031 @observable Instance staticValue; |
| 2034 @observable String name; | 2032 @observable String name; |
| 2035 @observable String vmName; | 2033 @observable String vmName; |
| 2036 | 2034 |
| 2037 @observable bool guardNullable; | 2035 @observable bool guardNullable; |
| 2038 @observable String guardClass; | 2036 @observable String guardClass; |
| 2039 @observable String guardLength; | 2037 @observable String guardLength; |
| 2040 @observable Script script; | 2038 @observable Script script; |
| 2041 @observable int tokenPos; | 2039 @observable int tokenPos; |
| 2042 | 2040 |
| 2043 Field._empty(ServiceObjectOwner owner) : super._empty(owner); | 2041 Field._empty(ServiceObjectOwner owner) : super._empty(owner); |
| 2044 | 2042 |
| 2045 void _update(ObservableMap map, bool mapIsRef) { | 2043 void _update(ObservableMap map, bool mapIsRef) { |
| 2046 // Extract full properties. | 2044 // Extract full properties. |
| 2047 _upgradeCollection(map, isolate); | 2045 _upgradeCollection(map, isolate); |
| 2048 | 2046 |
| 2049 name = map['name']; | 2047 name = map['name']; |
| 2050 vmName = (map.containsKey('vmName') ? map['vmName'] : name); | 2048 vmName = (map.containsKey('vmName') ? map['vmName'] : name); |
| 2051 dartOwner = map['owner']; | 2049 dartOwner = map['owner']; |
| 2052 declaredType = map['declaredType']; | 2050 declaredType = map['declaredType']; |
| 2053 isStatic = map['static']; | 2051 isStatic = map['static']; |
| 2054 isFinal = map['final']; | 2052 isFinal = map['final']; |
| 2055 isConst = map['const']; | 2053 isConst = map['const']; |
| 2056 value = map['value']; | 2054 staticValue = map['staticValue']; |
| 2057 | 2055 |
| 2058 if (dartOwner is Class) { | 2056 if (dartOwner is Class) { |
| 2059 Class ownerClass = dartOwner; | 2057 Class ownerClass = dartOwner; |
| 2060 library = ownerClass.library; | 2058 library = ownerClass.library; |
| 2061 | 2059 |
| 2062 } else { | 2060 } else { |
| 2063 library = dartOwner; | 2061 library = dartOwner; |
| 2064 } | 2062 } |
| 2065 | 2063 |
| 2066 if (mapIsRef) { | 2064 if (mapIsRef) { |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3159 var v = list[i]; | 3157 var v = list[i]; |
| 3160 if ((v is ObservableMap) && _isServiceMap(v)) { | 3158 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 3161 list[i] = owner.getFromMap(v); | 3159 list[i] = owner.getFromMap(v); |
| 3162 } else if (v is ObservableList) { | 3160 } else if (v is ObservableList) { |
| 3163 _upgradeObservableList(v, owner); | 3161 _upgradeObservableList(v, owner); |
| 3164 } else if (v is ObservableMap) { | 3162 } else if (v is ObservableMap) { |
| 3165 _upgradeObservableMap(v, owner); | 3163 _upgradeObservableMap(v, owner); |
| 3166 } | 3164 } |
| 3167 } | 3165 } |
| 3168 } | 3166 } |
| OLD | NEW |