| 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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 _snapshotFetch.add(latestSnapshot); | 1011 _snapshotFetch.add(latestSnapshot); |
| 1012 _snapshotFetch.close(); | 1012 _snapshotFetch.close(); |
| 1013 }); | 1013 }); |
| 1014 } | 1014 } |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 Stream fetchHeapSnapshot() { | 1017 Stream fetchHeapSnapshot() { |
| 1018 if (_snapshotFetch == null || _snapshotFetch.isClosed) { | 1018 if (_snapshotFetch == null || _snapshotFetch.isClosed) { |
| 1019 _snapshotFetch = new StreamController(); | 1019 _snapshotFetch = new StreamController(); |
| 1020 // isolate.vm.streamListen('_Graph'); | 1020 // isolate.vm.streamListen('_Graph'); |
| 1021 isolate.invokeRpcNoUpgrade('requestHeapSnapshot', {}); | 1021 isolate.invokeRpcNoUpgrade('_requestHeapSnapshot', {}); |
| 1022 } | 1022 } |
| 1023 return _snapshotFetch.stream; | 1023 return _snapshotFetch.stream; |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 void updateHeapsFromMap(ObservableMap map) { | 1026 void updateHeapsFromMap(ObservableMap map) { |
| 1027 newSpace.update(map['new']); | 1027 newSpace.update(map['new']); |
| 1028 oldSpace.update(map['old']); | 1028 oldSpace.update(map['old']); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 void _update(ObservableMap map, bool mapIsRef) { | 1031 void _update(ObservableMap map, bool mapIsRef) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 pauseEvent = map['pauseEvent']; | 1087 pauseEvent = map['pauseEvent']; |
| 1088 _updateRunState(); | 1088 _updateRunState(); |
| 1089 error = map['error']; | 1089 error = map['error']; |
| 1090 | 1090 |
| 1091 libraries.clear(); | 1091 libraries.clear(); |
| 1092 libraries.addAll(map['libraries']); | 1092 libraries.addAll(map['libraries']); |
| 1093 libraries.sort(ServiceObject.LexicalSortName); | 1093 libraries.sort(ServiceObject.LexicalSortName); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 Future<TagProfile> updateTagProfile() { | 1096 Future<TagProfile> updateTagProfile() { |
| 1097 return isolate.invokeRpcNoUpgrade('getTagProfile', {}).then( | 1097 return isolate.invokeRpcNoUpgrade('_getTagProfile', {}).then( |
| 1098 (ObservableMap map) { | 1098 (ObservableMap map) { |
| 1099 var seconds = new DateTime.now().millisecondsSinceEpoch / 1000.0; | 1099 var seconds = new DateTime.now().millisecondsSinceEpoch / 1000.0; |
| 1100 tagProfile._processTagProfile(seconds, map); | 1100 tagProfile._processTagProfile(seconds, map); |
| 1101 return tagProfile; | 1101 return tagProfile; |
| 1102 }); | 1102 }); |
| 1103 } | 1103 } |
| 1104 | 1104 |
| 1105 ObservableMap<int, Breakpoint> breakpoints = new ObservableMap(); | 1105 ObservableMap<int, Breakpoint> breakpoints = new ObservableMap(); |
| 1106 | 1106 |
| 1107 void _updateBreakpoints(List newBpts) { | 1107 void _updateBreakpoints(List newBpts) { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 'targetId': target.id, | 1282 'targetId': target.id, |
| 1283 'limit': limit.toString(), | 1283 'limit': limit.toString(), |
| 1284 }; | 1284 }; |
| 1285 return invokeRpc('_getInboundReferences', params); | 1285 return invokeRpc('_getInboundReferences', params); |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 Future<ServiceObject> getTypeArgumentsList(bool onlyWithInstantiations) { | 1288 Future<ServiceObject> getTypeArgumentsList(bool onlyWithInstantiations) { |
| 1289 Map params = { | 1289 Map params = { |
| 1290 'onlyWithInstantiations': onlyWithInstantiations, | 1290 'onlyWithInstantiations': onlyWithInstantiations, |
| 1291 }; | 1291 }; |
| 1292 return invokeRpc('getTypeArgumentsList', params); | 1292 return invokeRpc('_getTypeArgumentsList', params); |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 Future<ServiceObject> getInstances(Class cls, var limit) { | 1295 Future<ServiceObject> getInstances(Class cls, var limit) { |
| 1296 Map params = { | 1296 Map params = { |
| 1297 'classId': cls.id, | 1297 'classId': cls.id, |
| 1298 'limit': limit.toString(), | 1298 'limit': limit.toString(), |
| 1299 }; | 1299 }; |
| 1300 return invokeRpc('_getInstances', params); | 1300 return invokeRpc('_getInstances', params); |
| 1301 } | 1301 } |
| 1302 | 1302 |
| 1303 Future<ServiceObject> getObjectByAddress(String address, [bool ref=true]) { | 1303 Future<ServiceObject> getObjectByAddress(String address, [bool ref=true]) { |
| 1304 Map params = { | 1304 Map params = { |
| 1305 'address': address, | 1305 'address': address, |
| 1306 'ref': ref, | 1306 'ref': ref, |
| 1307 }; | 1307 }; |
| 1308 return invokeRpc('getObjectByAddress', params); | 1308 return invokeRpc('_getObjectByAddress', params); |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 final ObservableMap<String, ServiceMetric> dartMetrics = | 1311 final ObservableMap<String, ServiceMetric> dartMetrics = |
| 1312 new ObservableMap<String, ServiceMetric>(); | 1312 new ObservableMap<String, ServiceMetric>(); |
| 1313 | 1313 |
| 1314 final ObservableMap<String, ServiceMetric> nativeMetrics = | 1314 final ObservableMap<String, ServiceMetric> nativeMetrics = |
| 1315 new ObservableMap<String, ServiceMetric>(); | 1315 new ObservableMap<String, ServiceMetric>(); |
| 1316 | 1316 |
| 1317 Future<ObservableMap<String, ServiceMetric>> _refreshMetrics( | 1317 Future<ObservableMap<String, ServiceMetric>> _refreshMetrics( |
| 1318 String metricType, | 1318 String metricType, |
| 1319 ObservableMap<String, ServiceMetric> metricsMap) { | 1319 ObservableMap<String, ServiceMetric> metricsMap) { |
| 1320 return invokeRpc('getIsolateMetricList', | 1320 return invokeRpc('_getIsolateMetricList', |
| 1321 { 'type': metricType }).then((result) { | 1321 { 'type': metricType }).then((result) { |
| 1322 // Clear metrics map. | 1322 // Clear metrics map. |
| 1323 metricsMap.clear(); | 1323 metricsMap.clear(); |
| 1324 // Repopulate metrics map. | 1324 // Repopulate metrics map. |
| 1325 var metrics = result['metrics']; | 1325 var metrics = result['metrics']; |
| 1326 for (var metric in metrics) { | 1326 for (var metric in metrics) { |
| 1327 metricsMap[metric.id] = metric; | 1327 metricsMap[metric.id] = metric; |
| 1328 } | 1328 } |
| 1329 return metricsMap; | 1329 return metricsMap; |
| 1330 }); | 1330 }); |
| (...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3042 new ObservableList<MetricSample>(); | 3042 new ObservableList<MetricSample>(); |
| 3043 int _sampleBufferSize = 100; | 3043 int _sampleBufferSize = 100; |
| 3044 int get sampleBufferSize => _sampleBufferSize; | 3044 int get sampleBufferSize => _sampleBufferSize; |
| 3045 set sampleBufferSize(int size) { | 3045 set sampleBufferSize(int size) { |
| 3046 _sampleBufferSize = size; | 3046 _sampleBufferSize = size; |
| 3047 _removeOld(); | 3047 _removeOld(); |
| 3048 } | 3048 } |
| 3049 | 3049 |
| 3050 Future<ObservableMap> _fetchDirect() { | 3050 Future<ObservableMap> _fetchDirect() { |
| 3051 assert(owner is Isolate); | 3051 assert(owner is Isolate); |
| 3052 return isolate.invokeRpcNoUpgrade('getIsolateMetric', { 'metricId': id }); | 3052 return isolate.invokeRpcNoUpgrade('_getIsolateMetric', { 'metricId': id }); |
| 3053 } | 3053 } |
| 3054 | 3054 |
| 3055 | 3055 |
| 3056 void addSample(MetricSample sample) { | 3056 void addSample(MetricSample sample) { |
| 3057 samples.add(sample); | 3057 samples.add(sample); |
| 3058 _removeOld(); | 3058 _removeOld(); |
| 3059 } | 3059 } |
| 3060 | 3060 |
| 3061 void _removeOld() { | 3061 void _removeOld() { |
| 3062 // TODO(johnmccutchan): If this becomes hot, consider using a circular | 3062 // TODO(johnmccutchan): If this becomes hot, consider using a circular |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3159 var v = list[i]; | 3159 var v = list[i]; |
| 3160 if ((v is ObservableMap) && _isServiceMap(v)) { | 3160 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 3161 list[i] = owner.getFromMap(v); | 3161 list[i] = owner.getFromMap(v); |
| 3162 } else if (v is ObservableList) { | 3162 } else if (v is ObservableList) { |
| 3163 _upgradeObservableList(v, owner); | 3163 _upgradeObservableList(v, owner); |
| 3164 } else if (v is ObservableMap) { | 3164 } else if (v is ObservableMap) { |
| 3165 _upgradeObservableMap(v, owner); | 3165 _upgradeObservableMap(v, owner); |
| 3166 } | 3166 } |
| 3167 } | 3167 } |
| 3168 } | 3168 } |
| OLD | NEW |