Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 2005983002: Make the object store visible in Observatory. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add missing files Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Some value smaller than the object ring, so requesting a large array 7 // Some value smaller than the object ring, so requesting a large array
8 // doesn't result in an expired ref because the elements lapped it in the 8 // doesn't result in an expired ref because the elements lapped it in the
9 // object ring. 9 // object ring.
10 const int kDefaultFieldLimit = 100; 10 const int kDefaultFieldLimit = 100;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 obj = new ObjectPool._empty(owner); 246 obj = new ObjectPool._empty(owner);
247 break; 247 break;
248 case 'PcDescriptors': 248 case 'PcDescriptors':
249 obj = new PcDescriptors._empty(owner); 249 obj = new PcDescriptors._empty(owner);
250 break; 250 break;
251 case 'TokenStream': 251 case 'TokenStream':
252 obj = new TokenStream._empty(owner); 252 obj = new TokenStream._empty(owner);
253 break; 253 break;
254 } 254 }
255 break; 255 break;
256 case '_ObjectStore':
257 obj = new ObjectStore._empty(owner);
258 break;
256 case 'Event': 259 case 'Event':
257 obj = new ServiceEvent._empty(owner); 260 obj = new ServiceEvent._empty(owner);
258 break; 261 break;
259 case 'Script': 262 case 'Script':
260 obj = new Script._empty(owner); 263 obj = new Script._empty(owner);
261 break; 264 break;
262 case 'Socket': 265 case 'Socket':
263 obj = new Socket._empty(owner); 266 obj = new Socket._empty(owner);
264 break; 267 break;
265 case 'Instance': 268 case 'Instance':
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1330
1328 Future<ObservableMap> _fetchDirect({int count: kDefaultFieldLimit}) async { 1331 Future<ObservableMap> _fetchDirect({int count: kDefaultFieldLimit}) async {
1329 return invokeRpcNoUpgrade('getIsolate', {}); 1332 return invokeRpcNoUpgrade('getIsolate', {});
1330 } 1333 }
1331 1334
1332 @observable Class objectClass; 1335 @observable Class objectClass;
1333 @observable final rootClasses = new ObservableList<Class>(); 1336 @observable final rootClasses = new ObservableList<Class>();
1334 Map<int, Class> _classesByCid = new Map<int, Class>(); 1337 Map<int, Class> _classesByCid = new Map<int, Class>();
1335 1338
1336 @observable Library rootLibrary; 1339 @observable Library rootLibrary;
1340 @observable ObjectStore objectStore;
1337 @observable ObservableList<Library> libraries = 1341 @observable ObservableList<Library> libraries =
1338 new ObservableList<Library>(); 1342 new ObservableList<Library>();
1339 @observable Frame topFrame; 1343 @observable Frame topFrame;
1340 1344
1341 @observable String name; 1345 @observable String name;
1342 @observable String vmName; 1346 @observable String vmName;
1343 @observable ServiceFunction entry; 1347 @observable ServiceFunction entry;
1344 1348
1345 final HeapSpace newSpace = new HeapSpace(); 1349 final HeapSpace newSpace = new HeapSpace();
1346 final HeapSpace oldSpace = new HeapSpace(); 1350 final HeapSpace oldSpace = new HeapSpace();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 number = int.parse(map['number'], onError:(_) => null); 1412 number = int.parse(map['number'], onError:(_) => null);
1409 if (mapIsRef) { 1413 if (mapIsRef) {
1410 return; 1414 return;
1411 } 1415 }
1412 _loaded = true; 1416 _loaded = true;
1413 loading = false; 1417 loading = false;
1414 runnable = map['runnable'] == true; 1418 runnable = map['runnable'] == true;
1415 _upgradeCollection(map, isolate); 1419 _upgradeCollection(map, isolate);
1416 originNumber = int.parse(map['_originNumber'], onError:(_) => null); 1420 originNumber = int.parse(map['_originNumber'], onError:(_) => null);
1417 rootLibrary = map['rootLib']; 1421 rootLibrary = map['rootLib'];
1422 objectStore = map['_objectStore'];
1418 if (map['entry'] != null) { 1423 if (map['entry'] != null) {
1419 entry = map['entry']; 1424 entry = map['entry'];
1420 } 1425 }
1421 var savedStartTime = startTime; 1426 var savedStartTime = startTime;
1422 int startTimeInMillis = map['startTime']; 1427 int startTimeInMillis = map['startTime'];
1423 startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeInMillis); 1428 startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeInMillis);
1424 notifyPropertyChange(#upTime, 0, 1); 1429 notifyPropertyChange(#upTime, 0, 1);
1425 var countersMap = map['_tagCounters']; 1430 var countersMap = map['_tagCounters'];
1426 if (countersMap != null) { 1431 if (countersMap != null) {
1427 var names = countersMap['names']; 1432 var names = countersMap['names'];
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 return _refreshMetrics('Native', nativeMetrics); 1742 return _refreshMetrics('Native', nativeMetrics);
1738 } 1743 }
1739 1744
1740 Future refreshMetrics() { 1745 Future refreshMetrics() {
1741 return Future.wait([refreshDartMetrics(), refreshNativeMetrics()]); 1746 return Future.wait([refreshDartMetrics(), refreshNativeMetrics()]);
1742 } 1747 }
1743 1748
1744 String toString() => "Isolate($name)"; 1749 String toString() => "Isolate($name)";
1745 } 1750 }
1746 1751
1752
1753 class NamedField {
1754 final String name;
1755 final ServiceObject value;
1756 NamedField(this.name, this.value);
1757 }
1758
1759
1760 class ObjectStore extends ServiceObject {
1761 @observable List<NamedField> fields = new List<NamedField>();
1762
1763 ObjectStore._empty(ServiceObjectOwner owner) : super._empty(owner);
1764
1765 void _update(ObservableMap map, bool mapIsRef) {
1766 // Extract full properties.
1767 _upgradeCollection(map, isolate);
1768
1769 if (mapIsRef) {
1770 return;
1771 }
1772
1773 fields.clear();
1774 map['fields'].forEach((key, value) {
1775 fields.add(new NamedField(key, value));
1776 });
1777 _loaded = true;
1778 }
1779 }
1780
1781
1747 /// A [ServiceObject] which implements [ObservableMap]. 1782 /// A [ServiceObject] which implements [ObservableMap].
1748 class ServiceMap extends ServiceObject implements ObservableMap { 1783 class ServiceMap extends ServiceObject implements ObservableMap {
1749 final ObservableMap _map = new ObservableMap(); 1784 final ObservableMap _map = new ObservableMap();
1750 static String objectIdRingPrefix = 'objects/'; 1785 static String objectIdRingPrefix = 'objects/';
1751 1786
1752 bool get canCache { 1787 bool get canCache {
1753 return (_type == 'Class' || 1788 return (_type == 'Class' ||
1754 _type == 'Function' || 1789 _type == 'Function' ||
1755 _type == 'Field') && 1790 _type == 'Field') &&
1756 !_id.startsWith(objectIdRingPrefix); 1791 !_id.startsWith(objectIdRingPrefix);
(...skipping 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after
4073 var v = list[i]; 4108 var v = list[i];
4074 if ((v is ObservableMap) && _isServiceMap(v)) { 4109 if ((v is ObservableMap) && _isServiceMap(v)) {
4075 list[i] = owner.getFromMap(v); 4110 list[i] = owner.getFromMap(v);
4076 } else if (v is ObservableList) { 4111 } else if (v is ObservableList) {
4077 _upgradeObservableList(v, owner); 4112 _upgradeObservableList(v, owner);
4078 } else if (v is ObservableMap) { 4113 } else if (v is ObservableMap) {
4079 _upgradeObservableMap(v, owner); 4114 _upgradeObservableMap(v, owner);
4080 } 4115 }
4081 } 4116 }
4082 } 4117 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/service_view.dart ('k') | runtime/observatory/observatory_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698