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

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

Issue 536273002: Teach the Observatory about WeakProperties (ephemerons). (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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 bool get isContext => vmType == 'Context'; 43 bool get isContext => vmType == 'Context';
44 bool get isDouble => vmType == 'Double'; 44 bool get isDouble => vmType == 'Double';
45 bool get isError => vmType == 'Error'; 45 bool get isError => vmType == 'Error';
46 bool get isInstance => vmType == 'Instance'; 46 bool get isInstance => vmType == 'Instance';
47 bool get isInt => vmType == 'Smi' || vmType == 'Mint' || vmType == 'Bigint'; 47 bool get isInt => vmType == 'Smi' || vmType == 'Mint' || vmType == 'Bigint';
48 bool get isList => vmType == 'GrowableObjectArray' || vmType == 'Array'; 48 bool get isList => vmType == 'GrowableObjectArray' || vmType == 'Array';
49 bool get isNull => vmType == 'Null'; 49 bool get isNull => vmType == 'Null';
50 bool get isSentinel => vmType == 'Sentinel'; 50 bool get isSentinel => vmType == 'Sentinel';
51 bool get isString => vmType == 'String'; 51 bool get isString => vmType == 'String';
52 bool get isType => vmType == 'Type'; 52 bool get isType => vmType == 'Type';
53 bool get isWeakProperty => vmType == 'WeakProperty';
53 54
54 /// The complete service url of this object. 55 /// The complete service url of this object.
55 @reflectable String get link => _owner.relativeLink(_id); 56 @reflectable String get link => _owner.relativeLink(_id);
56 57
57 /// Has this object been fully loaded? 58 /// Has this object been fully loaded?
58 bool get loaded => _loaded; 59 bool get loaded => _loaded;
59 bool _loaded = false; 60 bool _loaded = false;
60 // TODO(turnidge): Make loaded observable and get rid of loading 61 // TODO(turnidge): Make loaded observable and get rid of loading
61 // from Isolate. 62 // from Isolate.
62 63
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 case 'Bool': 114 case 'Bool':
114 case 'Double': 115 case 'Double':
115 case 'GrowableObjectArray': 116 case 'GrowableObjectArray':
116 case 'Instance': 117 case 'Instance':
117 case 'Mint': 118 case 'Mint':
118 case 'Null': 119 case 'Null':
119 case 'Sentinel': // TODO(rmacnak): Separate this out. 120 case 'Sentinel': // TODO(rmacnak): Separate this out.
120 case 'Smi': 121 case 'Smi':
121 case 'String': 122 case 'String':
122 case 'Type': 123 case 'Type':
124 case 'WeakProperty':
123 obj = new Instance._empty(owner); 125 obj = new Instance._empty(owner);
124 break; 126 break;
125 case 'Isolate': 127 case 'Isolate':
126 obj = new Isolate._empty(owner.vm); 128 obj = new Isolate._empty(owner.vm);
127 break; 129 break;
128 case 'Library': 130 case 'Library':
129 obj = new Library._empty(owner); 131 obj = new Library._empty(owner);
130 break; 132 break;
131 case 'ServiceError': 133 case 'ServiceError':
132 obj = new ServiceError._empty(owner); 134 obj = new ServiceError._empty(owner);
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 @observable ServiceFunction closureFunc; // If a closure. 1482 @observable ServiceFunction closureFunc; // If a closure.
1481 @observable Context closureCtxt; // If a closure. 1483 @observable Context closureCtxt; // If a closure.
1482 @observable String name; // If a Type. 1484 @observable String name; // If a Type.
1483 @observable int length; // If a List. 1485 @observable int length; // If a List.
1484 1486
1485 @observable var typeClass; 1487 @observable var typeClass;
1486 @observable var fields; 1488 @observable var fields;
1487 @observable var nativeFields; 1489 @observable var nativeFields;
1488 @observable var elements; 1490 @observable var elements;
1489 @observable var userName; 1491 @observable var userName;
1492 @observable Instance key; // If a WeakProperty.
1493 @observable Instance value; // If a WeakProperty.
Cutch 2014/09/04 15:27:24 I wonder if we should start subclassing Instance s
rmacnak 2014/09/04 20:36:07 Right, and there are a lot more special Instance t
1490 1494
1491 bool get isClosure => closureFunc != null; 1495 bool get isClosure => closureFunc != null;
1492 1496
1493 Instance._empty(ServiceObjectOwner owner) : super._empty(owner); 1497 Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
1494 1498
1495 void _update(ObservableMap map, bool mapIsRef) { 1499 void _update(ObservableMap map, bool mapIsRef) {
1496 // Extract full properties. 1500 // Extract full properties.
1497 _upgradeCollection(map, isolate); 1501 _upgradeCollection(map, isolate);
1498 1502
1499 clazz = map['class']; 1503 clazz = map['class'];
1500 size = map['size']; 1504 size = map['size'];
1501 valueAsString = map['valueAsString']; 1505 valueAsString = map['valueAsString'];
1502 closureFunc = map['closureFunc']; 1506 closureFunc = map['closureFunc'];
1503 closureCtxt = map['closureCtxt']; 1507 closureCtxt = map['closureCtxt'];
1504 name = map['name']; 1508 name = map['name'];
1505 length = map['length']; 1509 length = map['length'];
1506 1510
1507 if (mapIsRef) { 1511 if (mapIsRef) {
1508 return; 1512 return;
1509 } 1513 }
1510 1514
1511 nativeFields = map['nativeFields']; 1515 nativeFields = map['nativeFields'];
1512 fields = map['fields']; 1516 fields = map['fields'];
1513 elements = map['elements']; 1517 elements = map['elements'];
1514 typeClass = map['type_class']; 1518 typeClass = map['type_class'];
1515 userName = map['user_name']; 1519 userName = map['user_name'];
1520 key = map['key'];
1521 value = map['value'];
1516 1522
1517 // We are fully loaded. 1523 // We are fully loaded.
1518 _loaded = true; 1524 _loaded = true;
1519 } 1525 }
1520 1526
1521 String get shortName => valueAsString != null ? valueAsString : 'a ${clazz.nam e}'; 1527 String get shortName => valueAsString != null ? valueAsString : 'a ${clazz.nam e}';
1522 1528
1523 String toString() => 'Instance($shortName)'; 1529 String toString() => 'Instance($shortName)';
1524 } 1530 }
1525 1531
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 var v = list[i]; 2530 var v = list[i];
2525 if ((v is ObservableMap) && _isServiceMap(v)) { 2531 if ((v is ObservableMap) && _isServiceMap(v)) {
2526 list[i] = owner.getFromMap(v); 2532 list[i] = owner.getFromMap(v);
2527 } else if (v is ObservableList) { 2533 } else if (v is ObservableList) {
2528 _upgradeObservableList(v, owner); 2534 _upgradeObservableList(v, owner);
2529 } else if (v is ObservableMap) { 2535 } else if (v is ObservableMap) {
2530 _upgradeObservableMap(v, owner); 2536 _upgradeObservableMap(v, owner);
2531 } 2537 }
2532 } 2538 }
2533 } 2539 }
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/elements/service_view.dart ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698