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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 return isolate.invokeRpc('getObject', params); | 932 return isolate.invokeRpc('getObject', params); |
933 } | 933 } |
934 | 934 |
935 Future<ObservableMap> _fetchDirect() { | 935 Future<ObservableMap> _fetchDirect() { |
936 return invokeRpcNoUpgrade('getIsolate', {}); | 936 return invokeRpcNoUpgrade('getIsolate', {}); |
937 } | 937 } |
938 | 938 |
939 @observable Class objectClass; | 939 @observable Class objectClass; |
940 @observable final rootClasses = new ObservableList<Class>(); | 940 @observable final rootClasses = new ObservableList<Class>(); |
941 | 941 |
942 @observable Library rootLib; | 942 @observable Library rootLibrary; |
943 @observable ObservableList<Library> libraries = | 943 @observable ObservableList<Library> libraries = |
944 new ObservableList<Library>(); | 944 new ObservableList<Library>(); |
945 @observable ObservableMap topFrame; | 945 @observable ObservableMap topFrame; |
946 | 946 |
947 @observable String name; | 947 @observable String name; |
948 @observable String vmName; | 948 @observable String vmName; |
949 @observable ServiceFunction entry; | 949 @observable ServiceFunction entry; |
950 | 950 |
951 @observable final Map<String, double> timers = | 951 @observable final Map<String, double> timers = |
952 toObservable(new Map<String, double>()); | 952 toObservable(new Map<String, double>()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 _loaded = true; | 990 _loaded = true; |
991 loading = false; | 991 loading = false; |
992 | 992 |
993 _upgradeCollection(map, isolate); | 993 _upgradeCollection(map, isolate); |
994 if (map['rootLib'] == null || | 994 if (map['rootLib'] == null || |
995 map['timers'] == null || | 995 map['timers'] == null || |
996 map['heaps'] == null) { | 996 map['heaps'] == null) { |
997 Logger.root.severe("Malformed 'Isolate' response: $map"); | 997 Logger.root.severe("Malformed 'Isolate' response: $map"); |
998 return; | 998 return; |
999 } | 999 } |
1000 rootLib = map['rootLib']; | 1000 rootLibrary = map['rootLib']; |
1001 if (map['entry'] != null) { | 1001 if (map['entry'] != null) { |
1002 entry = map['entry']; | 1002 entry = map['entry']; |
1003 } | 1003 } |
1004 var startTimeInMillis = map['startTime']; | 1004 var startTimeInMillis = map['startTime']; |
1005 startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeInMillis); | 1005 startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeInMillis); |
1006 notifyPropertyChange(#upTime, 0, 1); | 1006 notifyPropertyChange(#upTime, 0, 1); |
1007 var countersMap = map['tagCounters']; | 1007 var countersMap = map['tagCounters']; |
1008 if (countersMap != null) { | 1008 if (countersMap != null) { |
1009 var names = countersMap['names']; | 1009 var names = countersMap['names']; |
1010 var counts = countersMap['counters']; | 1010 var counts = countersMap['counters']; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 } | 1198 } |
1199 | 1199 |
1200 Future setName(String newName) { | 1200 Future setName(String newName) { |
1201 return invokeRpc('setName', {'name': newName}); | 1201 return invokeRpc('setName', {'name': newName}); |
1202 } | 1202 } |
1203 | 1203 |
1204 Future<ServiceMap> getStack() { | 1204 Future<ServiceMap> getStack() { |
1205 return invokeRpc('getStack', {}); | 1205 return invokeRpc('getStack', {}); |
1206 } | 1206 } |
1207 | 1207 |
1208 Future<ServiceObject> eval(ServiceObject target, | 1208 Future<ServiceObject> _eval(ServiceObject target, |
1209 String expression) { | 1209 String expression) { |
1210 Map params = { | 1210 Map params = { |
1211 'targetId': target.id, | 1211 'targetId': target.id, |
1212 'expression': expression, | 1212 'expression': expression, |
1213 }; | 1213 }; |
1214 return invokeRpc('eval', params); | 1214 return invokeRpc('evaluate', params); |
1215 } | 1215 } |
1216 | 1216 |
1217 Future<ServiceObject> evalFrame(int framePos, | 1217 Future<ServiceObject> evalFrame(int framePos, |
1218 String expression) { | 1218 String expression) { |
1219 Map params = { | 1219 Map params = { |
1220 'frame': framePos, | 1220 'frame': framePos, |
1221 'expression': expression, | 1221 'expression': expression, |
1222 }; | 1222 }; |
1223 return invokeRpc('evalFrame', params); | 1223 return invokeRpc('evaluateInFrame', params); |
1224 } | 1224 } |
1225 | 1225 |
1226 Future<ServiceObject> getRetainedSize(ServiceObject target) { | 1226 Future<ServiceObject> getRetainedSize(ServiceObject target) { |
1227 Map params = { | 1227 Map params = { |
1228 'targetId': target.id, | 1228 'targetId': target.id, |
1229 }; | 1229 }; |
1230 return invokeRpc('_getRetainedSize', params); | 1230 return invokeRpc('_getRetainedSize', params); |
1231 } | 1231 } |
1232 | 1232 |
1233 Future<ServiceObject> getRetainingPath(ServiceObject target, var limit) { | 1233 Future<ServiceObject> getRetainingPath(ServiceObject target, var limit) { |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 classes.addAll(map['classes']); | 1577 classes.addAll(map['classes']); |
1578 classes.sort(ServiceObject.LexicalSortName); | 1578 classes.sort(ServiceObject.LexicalSortName); |
1579 variables.clear(); | 1579 variables.clear(); |
1580 variables.addAll(map['variables']); | 1580 variables.addAll(map['variables']); |
1581 variables.sort(ServiceObject.LexicalSortName); | 1581 variables.sort(ServiceObject.LexicalSortName); |
1582 functions.clear(); | 1582 functions.clear(); |
1583 functions.addAll(map['functions']); | 1583 functions.addAll(map['functions']); |
1584 functions.sort(ServiceObject.LexicalSortName); | 1584 functions.sort(ServiceObject.LexicalSortName); |
1585 } | 1585 } |
1586 | 1586 |
| 1587 Future<ServiceObject> evaluate(String expression) { |
| 1588 return isolate._eval(this, expression); |
| 1589 } |
| 1590 |
1587 String toString() => "Library($url)"; | 1591 String toString() => "Library($url)"; |
1588 } | 1592 } |
1589 | 1593 |
1590 class AllocationCount extends Observable { | 1594 class AllocationCount extends Observable { |
1591 @observable int instances = 0; | 1595 @observable int instances = 0; |
1592 @observable int bytes = 0; | 1596 @observable int bytes = 0; |
1593 | 1597 |
1594 void reset() { | 1598 void reset() { |
1595 instances = 0; | 1599 instances = 0; |
1596 bytes = 0; | 1600 bytes = 0; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 } | 1730 } |
1727 | 1731 |
1728 void _addSubclass(Class subclass) { | 1732 void _addSubclass(Class subclass) { |
1729 if (subclasses.contains(subclass)) { | 1733 if (subclasses.contains(subclass)) { |
1730 return; | 1734 return; |
1731 } | 1735 } |
1732 subclasses.add(subclass); | 1736 subclasses.add(subclass); |
1733 subclasses.sort(ServiceObject.LexicalSortName); | 1737 subclasses.sort(ServiceObject.LexicalSortName); |
1734 } | 1738 } |
1735 | 1739 |
| 1740 Future<ServiceObject> evaluate(String expression) { |
| 1741 return isolate._eval(this, expression); |
| 1742 } |
| 1743 |
1736 String toString() => 'Class($vmName)'; | 1744 String toString() => 'Class($vmName)'; |
1737 } | 1745 } |
1738 | 1746 |
1739 class Instance extends ServiceObject { | 1747 class Instance extends ServiceObject { |
1740 @observable Class clazz; | 1748 @observable Class clazz; |
1741 @observable int size; | 1749 @observable int size; |
1742 @observable int retainedSize; | 1750 @observable int retainedSize; |
1743 @observable String valueAsString; // If primitive. | 1751 @observable String valueAsString; // If primitive. |
1744 @observable bool valueAsStringIsTruncated; | 1752 @observable bool valueAsStringIsTruncated; |
1745 @observable ServiceFunction closureFunc; // If a closure. | 1753 @observable ServiceFunction closureFunc; // If a closure. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 String get shortName { | 1802 String get shortName { |
1795 if (isClosure) { | 1803 if (isClosure) { |
1796 return closureFunc.qualifiedName; | 1804 return closureFunc.qualifiedName; |
1797 } | 1805 } |
1798 if (valueAsString != null) { | 1806 if (valueAsString != null) { |
1799 return valueAsString; | 1807 return valueAsString; |
1800 } | 1808 } |
1801 return 'a ${clazz.name}'; | 1809 return 'a ${clazz.name}'; |
1802 } | 1810 } |
1803 | 1811 |
| 1812 Future<ServiceObject> evaluate(String expression) { |
| 1813 return isolate._eval(this, expression); |
| 1814 } |
| 1815 |
1804 String toString() => 'Instance($shortName)'; | 1816 String toString() => 'Instance($shortName)'; |
1805 } | 1817 } |
1806 | 1818 |
1807 | 1819 |
1808 class Context extends ServiceObject { | 1820 class Context extends ServiceObject { |
1809 @observable Class clazz; | 1821 @observable Class clazz; |
1810 @observable int size; | 1822 @observable int size; |
1811 | 1823 |
1812 @observable var parentContext; | 1824 @observable var parentContext; |
1813 @observable int length; | 1825 @observable int length; |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 var v = list[i]; | 3110 var v = list[i]; |
3099 if ((v is ObservableMap) && _isServiceMap(v)) { | 3111 if ((v is ObservableMap) && _isServiceMap(v)) { |
3100 list[i] = owner.getFromMap(v); | 3112 list[i] = owner.getFromMap(v); |
3101 } else if (v is ObservableList) { | 3113 } else if (v is ObservableList) { |
3102 _upgradeObservableList(v, owner); | 3114 _upgradeObservableList(v, owner); |
3103 } else if (v is ObservableMap) { | 3115 } else if (v is ObservableMap) { |
3104 _upgradeObservableMap(v, owner); | 3116 _upgradeObservableMap(v, owner); |
3105 } | 3117 } |
3106 } | 3118 } |
3107 } | 3119 } |
OLD | NEW |