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

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

Issue 509563004: Give instances their own model class; move DartErrors out of instance-ref into their own error-ref. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase and build Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/elements/stack_frame.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/observatory/lib/src/service/object.dart
diff --git a/runtime/bin/vmservice/observatory/lib/src/service/object.dart b/runtime/bin/vmservice/observatory/lib/src/service/object.dart
index bc57bb6647b0587397739c14a0ecced4c2a44ed5..78d29702c4e608a24253bff04931e67260858a78 100644
--- a/runtime/bin/vmservice/observatory/lib/src/service/object.dart
+++ b/runtime/bin/vmservice/observatory/lib/src/service/object.dart
@@ -34,6 +34,17 @@ abstract class ServiceObject extends Observable {
@reflectable String get serviceType => _serviceType;
String _serviceType;
+ bool get isBool => serviceType == 'Bool';
+ bool get isDouble => serviceType == 'Double';
+ bool get isError => serviceType == 'Error';
+ bool get isInstance => serviceType == 'Instance';
+ bool get isInt => serviceType == 'Smi' || serviceType == 'Mint' || serviceType == 'Bigint';
+ bool get isList => serviceType == 'GrowableObjectArray' || serviceType == 'Array';
+ bool get isNull => serviceType == 'Null';
+ bool get isSentinel => serviceType == 'Sentinel';
+ bool get isString => serviceType == 'String';
+ bool get isType => serviceType == 'Type';
+
/// The complete service url of this object.
@reflectable String get link => _owner.relativeLink(_id);
@@ -88,6 +99,20 @@ abstract class ServiceObject extends Observable {
case 'Gauge':
obj = new ServiceMetric._empty(owner);
break;
+ case 'Array':
+ case 'Bigint':
+ case 'Bool':
+ case 'Double':
+ case 'GrowableObjectArray':
+ case 'Instance':
+ case 'Mint':
+ case 'Null':
+ case 'Sentinel': // TODO(rmacnak): Separate this out.
+ case 'Smi':
+ case 'String':
+ case 'Type':
+ obj = new Instance._empty(owner);
+ break;
case 'Isolate':
obj = new Isolate._empty(owner.vm);
break;
@@ -1159,7 +1184,7 @@ class DartError extends ServiceObject {
@observable String kind;
@observable String message;
- @observable ServiceMap exception;
+ @observable Instance exception;
@observable ServiceMap stacktrace;
void _update(ObservableMap map, bool mapIsRef) {
@@ -1439,6 +1464,54 @@ class Class extends ServiceObject with Coverage {
String toString() => 'Class($vmName)';
}
+class Instance extends ServiceObject {
+ @observable Class clazz;
+ @observable String valueAsString;
+ @observable int size;
+ @observable ServiceFunction closureFunc; // If a closure.
+ @observable String name; // If a Type.
+
+ @observable var typeClass;
+ @observable var length;
+ @observable var fields;
+ @observable var nativeFields;
+ @observable var elements;
+ @observable var userName;
+
+ bool get isClosure => closureFunc != null;
+
+ Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
+
+ void _update(ObservableMap map, bool mapIsRef) {
+ // Extract full properties.
+ _upgradeCollection(map, isolate);
+
+ clazz = map['class'];
+ valueAsString = map['valueAsString'];
+ size = map['size'];
+ closureFunc = map['closureFunc'];
+ name = map['name'];
+
+ if (mapIsRef) {
+ return;
+ }
+
+ nativeFields = map['nativeFields'];
+ fields = map['fields'];
+ length = map['length'];
+ elements = map['elements'];
+ typeClass = map['type_class'];
+ userName = map['user_name'];
+
+ // We are fully loaded.
+ _loaded = true;
+ }
+
+ String get shortName => valueAsString != null ? valueAsString : 'a ${clazz.name}';
+
+ String toString() => 'Instance($shortName)';
+}
+
// TODO(koda): Sync this with VM.
class FunctionKind {
final String _strValue;
@@ -2356,8 +2429,7 @@ class MetricPoller {
// Convert any ServiceMaps representing a null instance into an actual null.
_convertNull(obj) {
- if (obj is ServiceMap &&
- obj.serviceType == 'Null') {
+ if (obj.isNull) {
return null;
}
return obj;
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/elements/stack_frame.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698