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

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: build 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 isMirrorReference => vmType == 'MirrorReference'; 49 bool get isMirrorReference => vmType == 'MirrorReference';
50 bool get isNull => vmType == 'Null'; 50 bool get isNull => vmType == 'Null';
51 bool get isSentinel => vmType == 'Sentinel'; 51 bool get isSentinel => vmType == 'Sentinel';
52 bool get isString => vmType == 'String'; 52 bool get isString => vmType == 'String';
53 bool get isType => vmType == 'Type'; 53 bool get isType => vmType == 'Type';
54 bool get isWeakProperty => vmType == 'WeakProperty';
54 55
55 /// The complete service url of this object. 56 /// The complete service url of this object.
56 @reflectable String get link => _owner.relativeLink(_id); 57 @reflectable String get link => _owner.relativeLink(_id);
57 58
58 /// Has this object been fully loaded? 59 /// Has this object been fully loaded?
59 bool get loaded => _loaded; 60 bool get loaded => _loaded;
60 bool _loaded = false; 61 bool _loaded = false;
61 // TODO(turnidge): Make loaded observable and get rid of loading 62 // TODO(turnidge): Make loaded observable and get rid of loading
62 // from Isolate. 63 // from Isolate.
63 64
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 case 'Double': 116 case 'Double':
116 case 'GrowableObjectArray': 117 case 'GrowableObjectArray':
117 case 'Instance': 118 case 'Instance':
118 case 'Mint': 119 case 'Mint':
119 case 'MirrorReference': 120 case 'MirrorReference':
120 case 'Null': 121 case 'Null':
121 case 'Sentinel': // TODO(rmacnak): Separate this out. 122 case 'Sentinel': // TODO(rmacnak): Separate this out.
122 case 'Smi': 123 case 'Smi':
123 case 'String': 124 case 'String':
124 case 'Type': 125 case 'Type':
126 case 'WeakProperty':
125 obj = new Instance._empty(owner); 127 obj = new Instance._empty(owner);
126 break; 128 break;
127 case 'Isolate': 129 case 'Isolate':
128 obj = new Isolate._empty(owner.vm); 130 obj = new Isolate._empty(owner.vm);
129 break; 131 break;
130 case 'Library': 132 case 'Library':
131 obj = new Library._empty(owner); 133 obj = new Library._empty(owner);
132 break; 134 break;
133 case 'ServiceError': 135 case 'ServiceError':
134 obj = new ServiceError._empty(owner); 136 obj = new ServiceError._empty(owner);
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 @observable Context closureCtxt; // If a closure. 1485 @observable Context closureCtxt; // If a closure.
1484 @observable String name; // If a Type. 1486 @observable String name; // If a Type.
1485 @observable int length; // If a List. 1487 @observable int length; // If a List.
1486 1488
1487 @observable var typeClass; 1489 @observable var typeClass;
1488 @observable var fields; 1490 @observable var fields;
1489 @observable var nativeFields; 1491 @observable var nativeFields;
1490 @observable var elements; 1492 @observable var elements;
1491 @observable var userName; 1493 @observable var userName;
1492 @observable var referent; // If a MirrorReference. 1494 @observable var referent; // If a MirrorReference.
1495 @observable Instance key; // If a WeakProperty.
1496 @observable Instance value; // If a WeakProperty.
1493 1497
1494 bool get isClosure => closureFunc != null; 1498 bool get isClosure => closureFunc != null;
1495 1499
1496 Instance._empty(ServiceObjectOwner owner) : super._empty(owner); 1500 Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
1497 1501
1498 void _update(ObservableMap map, bool mapIsRef) { 1502 void _update(ObservableMap map, bool mapIsRef) {
1499 // Extract full properties. 1503 // Extract full properties.
1500 _upgradeCollection(map, isolate); 1504 _upgradeCollection(map, isolate);
1501 1505
1502 clazz = map['class']; 1506 clazz = map['class'];
1503 size = map['size']; 1507 size = map['size'];
1504 valueAsString = map['valueAsString']; 1508 valueAsString = map['valueAsString'];
1505 closureFunc = map['closureFunc']; 1509 closureFunc = map['closureFunc'];
1506 closureCtxt = map['closureCtxt']; 1510 closureCtxt = map['closureCtxt'];
1507 name = map['name']; 1511 name = map['name'];
1508 length = map['length']; 1512 length = map['length'];
1509 1513
1510 if (mapIsRef) { 1514 if (mapIsRef) {
1511 return; 1515 return;
1512 } 1516 }
1513 1517
1514 nativeFields = map['nativeFields']; 1518 nativeFields = map['nativeFields'];
1515 fields = map['fields']; 1519 fields = map['fields'];
1516 elements = map['elements']; 1520 elements = map['elements'];
1517 typeClass = map['type_class']; 1521 typeClass = map['type_class'];
1518 userName = map['user_name']; 1522 userName = map['user_name'];
1519 referent = map['referent']; 1523 referent = map['referent'];
1524 key = map['key'];
1525 value = map['value'];
1520 1526
1521 // We are fully loaded. 1527 // We are fully loaded.
1522 _loaded = true; 1528 _loaded = true;
1523 } 1529 }
1524 1530
1525 String get shortName => valueAsString != null ? valueAsString : 'a ${clazz.nam e}'; 1531 String get shortName => valueAsString != null ? valueAsString : 'a ${clazz.nam e}';
1526 1532
1527 String toString() => 'Instance($shortName)'; 1533 String toString() => 'Instance($shortName)';
1528 } 1534 }
1529 1535
(...skipping 994 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

Powered by Google App Engine
This is Rietveld 408576698