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

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

Issue 532063002: Teach the Observatory about Contexts. Factor out object graph information from the instance view. (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 side-by-side diff with in-line comments
Download patch
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 6b15ee6db2e27cc76957ddcfbbd856dd1f51145a..2e92b8b2fa4b477b45dd345aabbcf38a14c30fcb 100644
--- a/runtime/bin/vmservice/observatory/lib/src/service/object.dart
+++ b/runtime/bin/vmservice/observatory/lib/src/service/object.dart
@@ -39,6 +39,8 @@ abstract class ServiceObject extends Observable {
String _vmType;
bool get isBool => vmType == 'Bool';
+ bool get isClosure => false;
+ bool get isContext => vmType == 'Context';
bool get isDouble => vmType == 'Double';
bool get isError => vmType == 'Error';
bool get isInstance => vmType == 'Instance';
@@ -91,6 +93,9 @@ abstract class ServiceObject extends Observable {
case 'Code':
obj = new Code._empty(owner);
break;
+ case 'Context':
+ obj = new Context._empty(owner);
+ break;
case 'Counter':
obj = new ServiceMetric._empty(owner);
break;
@@ -1470,13 +1475,14 @@ class Class extends ServiceObject with Coverage {
class Instance extends ServiceObject {
@observable Class clazz;
- @observable String valueAsString;
@observable int size;
+ @observable String valueAsString; // If primitive.
@observable ServiceFunction closureFunc; // If a closure.
+ @observable Context closureCtxt; // If a closure.
@observable String name; // If a Type.
+ @observable int length; // If a List.
@observable var typeClass;
- @observable var length;
@observable var fields;
@observable var nativeFields;
@observable var elements;
@@ -1491,10 +1497,12 @@ class Instance extends ServiceObject {
_upgradeCollection(map, isolate);
clazz = map['class'];
- valueAsString = map['valueAsString'];
size = map['size'];
+ valueAsString = map['valueAsString'];
closureFunc = map['closureFunc'];
+ closureCtxt = map['closureCtxt'];
name = map['name'];
+ length = map['length'];
if (mapIsRef) {
return;
@@ -1502,7 +1510,6 @@ class Instance extends ServiceObject {
nativeFields = map['nativeFields'];
fields = map['fields'];
- length = map['length'];
elements = map['elements'];
typeClass = map['type_class'];
userName = map['user_name'];
@@ -1516,6 +1523,44 @@ class Instance extends ServiceObject {
String toString() => 'Instance($shortName)';
}
+
+class Context extends ServiceObject {
+ @observable Class clazz;
+ @observable int size;
+
+ @observable ServiceObject parentContext;
+ @observable var length;
+ @observable var variables;
+
+ bool get isClosure => closureFunc != null;
+
+ Context._empty(ServiceObjectOwner owner) : super._empty(owner);
+
+ void _update(ObservableMap map, bool mapIsRef) {
+ // Extract full properties.
+ _upgradeCollection(map, isolate);
+
+ size = map['size'];
+ length = map['length'];
+ parentContext = map['parent'];
+
+ if (mapIsRef) {
+ return;
+ }
+
+ clazz = map['class'];
+ variables = map['variables'];
+
+ // We are fully loaded.
+ _loaded = true;
+ }
+
+ String get shortName => valueAsString != null ? valueAsString : 'a ${clazz.name}';
+
+ String toString() => 'Context($length)';
+}
+
+
// TODO(koda): Sync this with VM.
class FunctionKind {
final String _strValue;
@@ -2003,7 +2048,7 @@ class Code extends ServiceObject {
@reflectable final addressTicks = new ObservableMap<int, CodeTick>();
@observable String formattedInclusiveTicks = '';
@observable String formattedExclusiveTicks = '';
- @observable ServiceMap objectPool;
+ @observable Instance objectPool;
@observable ServiceFunction function;
@observable Script script;
@observable bool isOptimized = false;

Powered by Google App Engine
This is Rietveld 408576698