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

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

Issue 561053003: Give fields a model class in the service library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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 /// 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 break; 135 break;
136 case 'Context': 136 case 'Context':
137 obj = new Context._empty(owner); 137 obj = new Context._empty(owner);
138 break; 138 break;
139 case 'Counter': 139 case 'Counter':
140 obj = new ServiceMetric._empty(owner); 140 obj = new ServiceMetric._empty(owner);
141 break; 141 break;
142 case 'Error': 142 case 'Error':
143 obj = new DartError._empty(owner); 143 obj = new DartError._empty(owner);
144 break; 144 break;
145 case 'Field':
146 obj = new Field._empty(owner);
147 break;
145 case 'Function': 148 case 'Function':
146 obj = new ServiceFunction._empty(owner); 149 obj = new ServiceFunction._empty(owner);
147 break; 150 break;
148 case 'Gauge': 151 case 'Gauge':
149 obj = new ServiceMetric._empty(owner); 152 obj = new ServiceMetric._empty(owner);
150 break; 153 break;
151 case 'Isolate': 154 case 'Isolate':
152 obj = new Isolate._empty(owner.vm); 155 obj = new Isolate._empty(owner.vm);
153 break; 156 break;
154 case 'Library': 157 case 'Library':
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 return 'ServiceEvent of type $eventType with ' 1327 return 'ServiceEvent of type $eventType with '
1325 '${data == null ? 0 : data.lengthInBytes} bytes of binary data'; 1328 '${data == null ? 0 : data.lengthInBytes} bytes of binary data';
1326 } 1329 }
1327 } 1330 }
1328 1331
1329 class Library extends ServiceObject with Coverage { 1332 class Library extends ServiceObject with Coverage {
1330 @observable String url; 1333 @observable String url;
1331 @reflectable final imports = new ObservableList<Library>(); 1334 @reflectable final imports = new ObservableList<Library>();
1332 @reflectable final scripts = new ObservableList<Script>(); 1335 @reflectable final scripts = new ObservableList<Script>();
1333 @reflectable final classes = new ObservableList<Class>(); 1336 @reflectable final classes = new ObservableList<Class>();
1334 @reflectable final variables = new ObservableList<ServiceMap>(); 1337 @reflectable final variables = new ObservableList<Field>();
1335 @reflectable final functions = new ObservableList<ServiceFunction>(); 1338 @reflectable final functions = new ObservableList<ServiceFunction>();
1336 1339
1337 bool get canCache => true; 1340 bool get canCache => true;
1338 bool get immutable => false; 1341 bool get immutable => false;
1339 1342
1340 Library._empty(ServiceObjectOwner owner) : super._empty(owner); 1343 Library._empty(ServiceObjectOwner owner) : super._empty(owner);
1341 1344
1342 void _update(ObservableMap map, bool mapIsRef) { 1345 void _update(ObservableMap map, bool mapIsRef) {
1343 url = map['url']; 1346 url = map['url'];
1344 var shortUrl = url; 1347 var shortUrl = url;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 @observable int endTokenPos; 1428 @observable int endTokenPos;
1426 1429
1427 @observable ServiceMap error; 1430 @observable ServiceMap error;
1428 1431
1429 final Allocations newSpace = new Allocations(); 1432 final Allocations newSpace = new Allocations();
1430 final Allocations oldSpace = new Allocations(); 1433 final Allocations oldSpace = new Allocations();
1431 final AllocationCount promotedByLastNewGC = new AllocationCount(); 1434 final AllocationCount promotedByLastNewGC = new AllocationCount();
1432 1435
1433 bool get hasNoAllocations => newSpace.empty && oldSpace.empty; 1436 bool get hasNoAllocations => newSpace.empty && oldSpace.empty;
1434 1437
1435 @reflectable final fields = new ObservableList<ServiceMap>(); 1438 @reflectable final fields = new ObservableList<Field>();
1436 @reflectable final functions = new ObservableList<ServiceFunction>(); 1439 @reflectable final functions = new ObservableList<ServiceFunction>();
1437 1440
1438 @observable Class superclass; 1441 @observable Class superclass;
1439 @reflectable final interfaces = new ObservableList<Class>(); 1442 @reflectable final interfaces = new ObservableList<Class>();
1440 @reflectable final subclasses = new ObservableList<Class>(); 1443 @reflectable final subclasses = new ObservableList<Class>();
1441 1444
1442 bool get canCache => true; 1445 bool get canCache => true;
1443 bool get immutable => false; 1446 bool get immutable => false;
1444 1447
1445 Class._empty(ServiceObjectOwner owner) : super._empty(owner); 1448 Class._empty(ServiceObjectOwner owner) : super._empty(owner);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 qualifiedName = (owningClass != null) ? 1712 qualifiedName = (owningClass != null) ?
1710 "${owningClass.name}.${name}" : 1713 "${owningClass.name}.${name}" :
1711 name; 1714 name;
1712 } else { 1715 } else {
1713 qualifiedName = "${parent.qualifiedName}.${name}"; 1716 qualifiedName = "${parent.qualifiedName}.${name}";
1714 } 1717 }
1715 1718
1716 } 1719 }
1717 } 1720 }
1718 1721
1722
1723 class Field extends ServiceObject {
1724 @observable var /* Library or Class */ owner;
turnidge 2014/09/11 16:48:38 var -> ServiceObject? Can you use types instead o
rmacnak 2014/09/11 17:25:59 It's better to use dynamic for a union type; other
1725 @observable var declaredType;
1726 @observable bool isStatic;
1727 @observable bool isFinal;
1728 @observable bool isConst;
1729 @observable var value;
1730 @observable var name;
1731 @observable var vmName;
1732
1733 @observable var guardNullable;
1734 @observable var guardClass;
1735 @observable var guardLength;
1736 @observable var script;
1737 @observable var tokenPos;
1738
1739 Field._empty(ServiceObjectOwner owner) : super._empty(owner);
1740
1741 void _update(ObservableMap map, bool mapIsRef) {
1742 // Extract full properties.
1743 _upgradeCollection(map, isolate);
1744
1745 name = map['name'];
1746 vmName = (map.containsKey('vmName') ? map['vmName'] : name);
1747 owner = map['owner'];
1748 declaredType = map['declaredType'];
1749 isStatic = map['static'];
1750 isFinal = map['final'];
1751 isConst = map['const'];
1752 value = map['value'];
1753
1754 if (mapIsRef) {
1755 return;
1756 }
1757
1758 guardNullable = map['guardNullable'];
1759 guardClass = map['guardClass'];
1760 guardLength = map['guardLength'];
1761 script = map['script'];
1762 tokenPos = map['tokenPos'];
1763
1764 _loaded = true;
1765 }
1766
1767 String toString() => 'Field(${owner.name}.$name)';
1768 }
1769
1770
1719 class ScriptLine extends Observable { 1771 class ScriptLine extends Observable {
1720 final Script script; 1772 final Script script;
1721 final int line; 1773 final int line;
1722 final String text; 1774 final String text;
1723 @observable int hits; 1775 @observable int hits;
1724 @observable ServiceMap bpt; 1776 @observable ServiceMap bpt;
1725 @observable bool possibleBpt = true; 1777 @observable bool possibleBpt = true;
1726 1778
1727 static bool _isTrivialToken(String token) { 1779 static bool _isTrivialToken(String token) {
1728 if (token == 'else') { 1780 if (token == 'else') {
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 var v = list[i]; 2719 var v = list[i];
2668 if ((v is ObservableMap) && _isServiceMap(v)) { 2720 if ((v is ObservableMap) && _isServiceMap(v)) {
2669 list[i] = owner.getFromMap(v); 2721 list[i] = owner.getFromMap(v);
2670 } else if (v is ObservableList) { 2722 } else if (v is ObservableList) {
2671 _upgradeObservableList(v, owner); 2723 _upgradeObservableList(v, owner);
2672 } else if (v is ObservableMap) { 2724 } else if (v is ObservableMap) {
2673 _upgradeObservableMap(v, owner); 2725 _upgradeObservableMap(v, owner);
2674 } 2726 }
2675 } 2727 }
2676 } 2728 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698