mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Revert "[ Observatory ] Add basic records support to Observatory"
This reverts commit fca7813650
.
Reason for revert: Broke analyzer tryjob
Original change's description:
> [ Observatory ] Add basic records support to Observatory
>
> Fixes https://github.com/dart-lang/sdk/issues/50405
>
> TEST=Manual testing
>
> Change-Id: If14f434792c89e3509895fcdd17561df810798e3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268581
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Derek Xu <derekx@google.com>
TBR=bkonyi@google.com,rmacnak@google.com,derekx@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com
Change-Id: I30c4404adb9ac8f1851a89a0c846cb70461e410c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269220
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Auto-Submit: Derek Xu <derekx@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
This commit is contained in:
parent
5adeb03c2f
commit
3ab116198c
13 changed files with 42 additions and 142 deletions
|
@ -93,8 +93,6 @@ Element anyRef(M.IsolateRef isolate, ref, M.ObjectRepository objects,
|
||||||
}
|
}
|
||||||
} else if (ref is M.Sentinel) {
|
} else if (ref is M.Sentinel) {
|
||||||
return new SentinelValueElement(ref, queue: queue).element;
|
return new SentinelValueElement(ref, queue: queue).element;
|
||||||
} else if (ref is num || ref is String) {
|
|
||||||
return new SpanElement()..text = ref.toString();
|
|
||||||
}
|
}
|
||||||
throw new Exception('Unknown ref type (${ref.runtimeType})');
|
throw new Exception('Unknown ref type (${ref.runtimeType})');
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,6 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
||||||
case M.InstanceKind.functionType:
|
case M.InstanceKind.functionType:
|
||||||
case M.InstanceKind.typeRef:
|
case M.InstanceKind.typeRef:
|
||||||
case M.InstanceKind.typeParameter:
|
case M.InstanceKind.typeParameter:
|
||||||
case M.InstanceKind.recordType:
|
|
||||||
return [
|
return [
|
||||||
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||||
..text = _instance.name
|
..text = _instance.name
|
||||||
|
@ -195,10 +194,12 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
case M.InstanceKind.mirrorReference:
|
case M.InstanceKind.mirrorReference:
|
||||||
|
return [
|
||||||
|
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||||
|
..classes = ['emphasize']
|
||||||
|
..text = _instance.clazz!.name
|
||||||
|
];
|
||||||
case M.InstanceKind.weakProperty:
|
case M.InstanceKind.weakProperty:
|
||||||
case M.InstanceKind.finalizer:
|
|
||||||
case M.InstanceKind.weakReference:
|
|
||||||
case M.InstanceKind.record:
|
|
||||||
return [
|
return [
|
||||||
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||||
..classes = ['emphasize']
|
..classes = ['emphasize']
|
||||||
|
@ -215,7 +216,6 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
||||||
case M.InstanceKind.mirrorReference:
|
case M.InstanceKind.mirrorReference:
|
||||||
case M.InstanceKind.stackTrace:
|
case M.InstanceKind.stackTrace:
|
||||||
case M.InstanceKind.weakProperty:
|
case M.InstanceKind.weakProperty:
|
||||||
case M.InstanceKind.recordType:
|
|
||||||
return true;
|
return true;
|
||||||
case M.InstanceKind.list:
|
case M.InstanceKind.list:
|
||||||
case M.InstanceKind.map:
|
case M.InstanceKind.map:
|
||||||
|
@ -339,18 +339,6 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
||||||
queue: _r.queue)
|
queue: _r.queue)
|
||||||
.element,
|
.element,
|
||||||
];
|
];
|
||||||
case M.InstanceKind.recordType:
|
|
||||||
final fields = _loadedInstance!.fields!.toList();
|
|
||||||
return [
|
|
||||||
for (int i = 0; i < fields.length; ++i) ...[
|
|
||||||
new SpanElement()..text = '${fields[i].name} = ',
|
|
||||||
new InstanceRefElement(
|
|
||||||
_isolate, fields[i].value!.asValue!, _objects,
|
|
||||||
queue: _r.queue)
|
|
||||||
.element,
|
|
||||||
if (i + 1 != fields.length) new BRElement(),
|
|
||||||
]
|
|
||||||
];
|
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,12 +335,9 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
||||||
..content = <Element>[
|
..content = <Element>[
|
||||||
new DivElement()
|
new DivElement()
|
||||||
..classes = ['memberList']
|
..classes = ['memberList']
|
||||||
..children = fields.map<Element>((f) {
|
..children = fields
|
||||||
final name = _instance.kind == M.InstanceKind.record
|
.map<Element>((f) => member(f.decl, f.value))
|
||||||
? f.name
|
.toList()
|
||||||
: f.decl;
|
|
||||||
return member(name, f.value);
|
|
||||||
}).toList()
|
|
||||||
])
|
])
|
||||||
.element
|
.element
|
||||||
]
|
]
|
||||||
|
|
|
@ -126,18 +126,6 @@ enum InstanceKind {
|
||||||
|
|
||||||
/// An instance of the Dart class RawReceivePort
|
/// An instance of the Dart class RawReceivePort
|
||||||
receivePort,
|
receivePort,
|
||||||
|
|
||||||
/// An instance of Record.
|
|
||||||
record,
|
|
||||||
|
|
||||||
/// An instance of RecordType
|
|
||||||
recordType,
|
|
||||||
|
|
||||||
/// An instance of Finalizer
|
|
||||||
finalizer,
|
|
||||||
|
|
||||||
/// An instance of WeakReference
|
|
||||||
weakReference,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTypedData(InstanceKind? kind) {
|
bool isTypedData(InstanceKind? kind) {
|
||||||
|
@ -475,8 +463,7 @@ abstract class Instance extends Object implements InstanceRef {
|
||||||
|
|
||||||
abstract class BoundField {
|
abstract class BoundField {
|
||||||
FieldRef? get decl;
|
FieldRef? get decl;
|
||||||
Guarded<dynamic>? get value;
|
Guarded<InstanceRef>? get value;
|
||||||
dynamic get name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class NativeField {
|
abstract class NativeField {
|
||||||
|
|
|
@ -2108,7 +2108,7 @@ class ServiceMap extends ServiceObject
|
||||||
_map.clear();
|
_map.clear();
|
||||||
map.forEach((k, v) => _map[k] = v);
|
map.forEach((k, v) => _map[k] = v);
|
||||||
|
|
||||||
name = _map['name']?.toString();
|
name = _map['name'];
|
||||||
vmName = (_map.containsKey('_vmName') ? _map['_vmName'] : name);
|
vmName = (_map.containsKey('_vmName') ? _map['_vmName'] : name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2791,33 +2791,25 @@ M.InstanceKind stringToInstanceKind(String s) {
|
||||||
return M.InstanceKind.typeRef;
|
return M.InstanceKind.typeRef;
|
||||||
case 'ReceivePort':
|
case 'ReceivePort':
|
||||||
return M.InstanceKind.receivePort;
|
return M.InstanceKind.receivePort;
|
||||||
case '_RecordType':
|
|
||||||
return M.InstanceKind.recordType;
|
|
||||||
case '_Record':
|
|
||||||
return M.InstanceKind.record;
|
|
||||||
case 'Finalizer':
|
|
||||||
return M.InstanceKind.finalizer;
|
|
||||||
case 'WeakReference':
|
|
||||||
return M.InstanceKind.weakReference;
|
|
||||||
}
|
}
|
||||||
var message = 'Unrecognized instance kind: $s';
|
var message = 'Unrecognized instance kind: $s';
|
||||||
Logger.root.severe(message);
|
Logger.root.severe(message);
|
||||||
throw new ArgumentError(message);
|
throw new ArgumentError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Guarded<T> implements M.Guarded<T> {
|
class Guarded<T extends ServiceObject> implements M.Guarded<T> {
|
||||||
bool get isValue => asValue != null;
|
bool get isValue => asValue != null;
|
||||||
bool get isSentinel => asSentinel != null;
|
bool get isSentinel => asSentinel != null;
|
||||||
final Sentinel? asSentinel;
|
final Sentinel? asSentinel;
|
||||||
final T? asValue;
|
final T? asValue;
|
||||||
|
|
||||||
factory Guarded(dynamic obj) {
|
factory Guarded(ServiceObject obj) {
|
||||||
if (obj is Sentinel) {
|
if (obj is Sentinel) {
|
||||||
return new Guarded.fromSentinel(obj);
|
return new Guarded.fromSentinel(obj);
|
||||||
} else if (obj is T) {
|
} else if (obj is T) {
|
||||||
return new Guarded.fromValue(obj);
|
return new Guarded.fromValue(obj);
|
||||||
}
|
}
|
||||||
throw new Exception('${obj.runtimeType} is neither Sentinel or $T');
|
throw new Exception('${obj.type} is neither Sentinel or $T');
|
||||||
}
|
}
|
||||||
|
|
||||||
Guarded.fromSentinel(this.asSentinel) : asValue = null;
|
Guarded.fromSentinel(this.asSentinel) : asValue = null;
|
||||||
|
@ -2825,11 +2817,9 @@ class Guarded<T> implements M.Guarded<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class BoundField implements M.BoundField {
|
class BoundField implements M.BoundField {
|
||||||
final Field? decl;
|
final Field decl;
|
||||||
// String|int
|
final Guarded<Instance> value;
|
||||||
final dynamic name;
|
BoundField(this.decl, value) : value = new Guarded(value);
|
||||||
final Guarded<dynamic> value;
|
|
||||||
BoundField(this.decl, this.name, value) : value = new Guarded(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class NativeField implements M.NativeField {
|
class NativeField implements M.NativeField {
|
||||||
|
@ -2926,7 +2916,7 @@ class Instance extends HeapObject implements M.Instance {
|
||||||
Instance._empty(ServiceObjectOwner? owner) : super._empty(owner);
|
Instance._empty(ServiceObjectOwner? owner) : super._empty(owner);
|
||||||
|
|
||||||
void _update(Map map, bool mapIsRef) {
|
void _update(Map map, bool mapIsRef) {
|
||||||
// Extract full properties.
|
// Extract full properties.1
|
||||||
_upgradeCollection(map, isolate);
|
_upgradeCollection(map, isolate);
|
||||||
super._update(map, mapIsRef);
|
super._update(map, mapIsRef);
|
||||||
|
|
||||||
|
@ -2935,7 +2925,7 @@ class Instance extends HeapObject implements M.Instance {
|
||||||
// Coerce absence to false.
|
// Coerce absence to false.
|
||||||
valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true;
|
valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true;
|
||||||
closureFunction = map['closureFunction'];
|
closureFunction = map['closureFunction'];
|
||||||
name = map['name']?.toString();
|
name = map['name'];
|
||||||
length = map['length'];
|
length = map['length'];
|
||||||
pattern = map['pattern'];
|
pattern = map['pattern'];
|
||||||
typeClass = map['typeClass'];
|
typeClass = map['typeClass'];
|
||||||
|
@ -2968,7 +2958,7 @@ class Instance extends HeapObject implements M.Instance {
|
||||||
if (map['fields'] != null) {
|
if (map['fields'] != null) {
|
||||||
var fields = <BoundField>[];
|
var fields = <BoundField>[];
|
||||||
for (var f in map['fields']) {
|
for (var f in map['fields']) {
|
||||||
fields.add(new BoundField(f['decl'], f['name'], f['value']));
|
fields.add(new BoundField(f['decl'], f['value']));
|
||||||
}
|
}
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
// for details. All rights reserved. Use of this source code is governed by a
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.19
|
|
||||||
|
|
||||||
// See inspector.txt for expected behavior.
|
// See inspector.txt for expected behavior.
|
||||||
|
|
||||||
library manual_inspector_test;
|
library manual_inspector_test;
|
||||||
|
@ -45,13 +43,10 @@ class Node {
|
||||||
var blockCopying;
|
var blockCopying;
|
||||||
var blockFull;
|
var blockFull;
|
||||||
var blockFullWithChain;
|
var blockFullWithChain;
|
||||||
var blockType;
|
|
||||||
var boundedType;
|
var boundedType;
|
||||||
var capability;
|
var capability;
|
||||||
var counter;
|
var counter;
|
||||||
var expando;
|
var expando;
|
||||||
var finalizer;
|
|
||||||
var finalizerEntry;
|
|
||||||
var float32x4;
|
var float32x4;
|
||||||
var float64;
|
var float64;
|
||||||
var float64x2;
|
var float64x2;
|
||||||
|
@ -67,10 +62,7 @@ class Node {
|
||||||
var mirrorReference;
|
var mirrorReference;
|
||||||
var portReceive;
|
var portReceive;
|
||||||
var portSend;
|
var portSend;
|
||||||
var record;
|
|
||||||
var recordType;
|
|
||||||
var regex;
|
var regex;
|
||||||
late var sentinel; // Not initialized
|
|
||||||
var smi;
|
var smi;
|
||||||
var stacktrace;
|
var stacktrace;
|
||||||
var string;
|
var string;
|
||||||
|
@ -84,12 +76,9 @@ class Node {
|
||||||
var theTrue;
|
var theTrue;
|
||||||
var type;
|
var type;
|
||||||
var typeParameter;
|
var typeParameter;
|
||||||
var typedDataArray;
|
var typedData;
|
||||||
var typedDataView;
|
|
||||||
var typedDataUnmodifiableView;
|
|
||||||
var userTag;
|
var userTag;
|
||||||
var weakProperty;
|
var weakProperty;
|
||||||
var weakReference;
|
|
||||||
|
|
||||||
genStackTrace() {
|
genStackTrace() {
|
||||||
try {
|
try {
|
||||||
|
@ -152,19 +141,16 @@ class Node {
|
||||||
array[0] = 1;
|
array[0] = 1;
|
||||||
array[1] = 2;
|
array[1] = 2;
|
||||||
array[2] = 3;
|
array[2] = 3;
|
||||||
bigint = BigInt.one << 65;
|
bigint = 1 << 65;
|
||||||
blockClean = genCleanBlock();
|
blockClean = genCleanBlock();
|
||||||
blockCopying = genCopyingBlock();
|
blockCopying = genCopyingBlock();
|
||||||
blockFull = genFullBlock();
|
blockFull = genFullBlock();
|
||||||
blockFullWithChain = genFullBlockWithChain();
|
blockFullWithChain = genFullBlockWithChain();
|
||||||
blockType = blockClean.runtimeType;
|
|
||||||
boundedType = extractPrivateField(
|
boundedType = extractPrivateField(
|
||||||
reflect(new B<int>()).type.typeVariables.single, '_reflectee');
|
reflect(new B<int>()).type.typeVariables.single, '_reflectee');
|
||||||
counter = new Counter("CounterName", "Counter description");
|
counter = new Counter("CounterName", "Counter description");
|
||||||
expando = new Expando("expando-name");
|
expando = new Expando("expando-name");
|
||||||
expando[array] = 'The weakly associated value';
|
expando[array] = 'The weakly associated value';
|
||||||
finalizer = Finalizer<dynamic>((_){});
|
|
||||||
finalizer.attach(this, this);
|
|
||||||
float32x4 = new Float32x4(0.0, -1.0, 3.14, 2e28);
|
float32x4 = new Float32x4(0.0, -1.0, 3.14, 2e28);
|
||||||
float64 = 3.14;
|
float64 = 3.14;
|
||||||
float64x2 = new Float64x2(0.0, 3.14);
|
float64x2 = new Float64x2(0.0, 3.14);
|
||||||
|
@ -184,8 +170,6 @@ class Node {
|
||||||
mirrorReference = extractPrivateField(mirrorClass, '_reflectee');
|
mirrorReference = extractPrivateField(mirrorClass, '_reflectee');
|
||||||
portReceive = new RawReceivePort();
|
portReceive = new RawReceivePort();
|
||||||
portSend = portReceive.sendPort;
|
portSend = portReceive.sendPort;
|
||||||
record = (1, 2, three: 3, four: 4);
|
|
||||||
recordType = record.runtimeType;
|
|
||||||
regex = new RegExp("a*b+c");
|
regex = new RegExp("a*b+c");
|
||||||
smi = 7;
|
smi = 7;
|
||||||
stacktrace = genStackTrace();
|
stacktrace = genStackTrace();
|
||||||
|
@ -201,13 +185,10 @@ class Node {
|
||||||
type = String;
|
type = String;
|
||||||
typeParameter =
|
typeParameter =
|
||||||
extractPrivateField(reflectClass(A).typeVariables.single, '_reflectee');
|
extractPrivateField(reflectClass(A).typeVariables.single, '_reflectee');
|
||||||
typedDataArray = Uint8List(32);
|
typedData = extractPrivateField(new ByteData(64), '_typedData');
|
||||||
typedDataView = Uint8List.view(typedDataArray.buffer, 16);
|
|
||||||
typedDataUnmodifiableView = UnmodifiableUint8ListView(typedDataArray);
|
|
||||||
userTag = new UserTag("Example tag name");
|
userTag = new UserTag("Example tag name");
|
||||||
weakProperty =
|
weakProperty =
|
||||||
extractPrivateField(expando, '_data').firstWhere((e) => e != null);
|
extractPrivateField(expando, '_data').firstWhere((e) => e != null);
|
||||||
weakReference = WeakReference(this);
|
|
||||||
|
|
||||||
Isolate.spawn(secondMain, "Hello2").then((otherIsolate) {
|
Isolate.spawn(secondMain, "Hello2").then((otherIsolate) {
|
||||||
isolate = otherIsolate;
|
isolate = otherIsolate;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
// for details. All rights reserved. Use of this source code is governed by a
|
// for details. All rights reserved. Use of this source code is governed by a
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.19
|
|
||||||
|
|
||||||
part of manual_inspector_test;
|
part of manual_inspector_test;
|
||||||
|
|
||||||
functionInPart() {}
|
functionInPart() {}
|
||||||
|
|
|
@ -93,8 +93,6 @@ Element anyRef(M.IsolateRef isolate, ref, M.ObjectRepository objects,
|
||||||
}
|
}
|
||||||
} else if (ref is M.Sentinel) {
|
} else if (ref is M.Sentinel) {
|
||||||
return new SentinelValueElement(ref, queue: queue).element;
|
return new SentinelValueElement(ref, queue: queue).element;
|
||||||
} else if (ref is num || ref is String) {
|
|
||||||
return new SpanElement()..text = ref.toString();
|
|
||||||
}
|
}
|
||||||
throw new Exception('Unknown ref type (${ref.runtimeType})');
|
throw new Exception('Unknown ref type (${ref.runtimeType})');
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,6 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
||||||
case M.InstanceKind.functionType:
|
case M.InstanceKind.functionType:
|
||||||
case M.InstanceKind.typeRef:
|
case M.InstanceKind.typeRef:
|
||||||
case M.InstanceKind.typeParameter:
|
case M.InstanceKind.typeParameter:
|
||||||
case M.InstanceKind.recordType:
|
|
||||||
return [
|
return [
|
||||||
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||||
..text = _instance.name
|
..text = _instance.name
|
||||||
|
@ -193,10 +192,12 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
case M.InstanceKind.mirrorReference:
|
case M.InstanceKind.mirrorReference:
|
||||||
|
return [
|
||||||
|
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||||
|
..classes = ['emphasize']
|
||||||
|
..text = _instance.clazz.name
|
||||||
|
];
|
||||||
case M.InstanceKind.weakProperty:
|
case M.InstanceKind.weakProperty:
|
||||||
case M.InstanceKind.finalizer:
|
|
||||||
case M.InstanceKind.weakReference:
|
|
||||||
case M.InstanceKind.record:
|
|
||||||
return [
|
return [
|
||||||
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
new AnchorElement(href: Uris.inspect(_isolate, object: _instance))
|
||||||
..classes = ['emphasize']
|
..classes = ['emphasize']
|
||||||
|
@ -213,7 +214,6 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
||||||
case M.InstanceKind.mirrorReference:
|
case M.InstanceKind.mirrorReference:
|
||||||
case M.InstanceKind.stackTrace:
|
case M.InstanceKind.stackTrace:
|
||||||
case M.InstanceKind.weakProperty:
|
case M.InstanceKind.weakProperty:
|
||||||
case M.InstanceKind.recordType:
|
|
||||||
return true;
|
return true;
|
||||||
case M.InstanceKind.list:
|
case M.InstanceKind.list:
|
||||||
case M.InstanceKind.map:
|
case M.InstanceKind.map:
|
||||||
|
@ -337,17 +337,6 @@ class InstanceRefElement extends CustomElement implements Renderable {
|
||||||
queue: _r.queue)
|
queue: _r.queue)
|
||||||
.element,
|
.element,
|
||||||
];
|
];
|
||||||
case M.InstanceKind.recordType:
|
|
||||||
final fields = _loadedInstance.fields.toList();
|
|
||||||
return [
|
|
||||||
for (int i = 0; i < fields.length; ++i) ...[
|
|
||||||
new SpanElement()..text = '${fields[i].name} = ',
|
|
||||||
new InstanceRefElement(_isolate, fields[i].value.asValue, _objects,
|
|
||||||
queue: _r.queue)
|
|
||||||
.element,
|
|
||||||
if (i + 1 != fields.length) new BRElement(),
|
|
||||||
]
|
|
||||||
];
|
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,12 +334,9 @@ class InstanceViewElement extends CustomElement implements Renderable {
|
||||||
..content = <Element>[
|
..content = <Element>[
|
||||||
new DivElement()
|
new DivElement()
|
||||||
..classes = ['memberList']
|
..classes = ['memberList']
|
||||||
..children = fields.map<Element>((f) {
|
..children = fields
|
||||||
final name = _instance.kind == M.InstanceKind.record
|
.map<Element>((f) => member(f.decl, f.value))
|
||||||
? f.name
|
.toList()
|
||||||
: f.decl;
|
|
||||||
return member(name, f.value);
|
|
||||||
}).toList()
|
|
||||||
])
|
])
|
||||||
.element
|
.element
|
||||||
]
|
]
|
||||||
|
|
|
@ -126,18 +126,6 @@ enum InstanceKind {
|
||||||
|
|
||||||
/// An instance of the Dart class RawReceivePort
|
/// An instance of the Dart class RawReceivePort
|
||||||
receivePort,
|
receivePort,
|
||||||
|
|
||||||
/// An instance of Record.
|
|
||||||
record,
|
|
||||||
|
|
||||||
/// An instance of RecordType
|
|
||||||
recordType,
|
|
||||||
|
|
||||||
/// An instance of Finalizer
|
|
||||||
finalizer,
|
|
||||||
|
|
||||||
/// An instance of WeakReference
|
|
||||||
weakReference,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTypedData(InstanceKind kind) {
|
bool isTypedData(InstanceKind kind) {
|
||||||
|
@ -466,8 +454,7 @@ abstract class Instance extends Object implements InstanceRef {
|
||||||
|
|
||||||
abstract class BoundField {
|
abstract class BoundField {
|
||||||
FieldRef get decl;
|
FieldRef get decl;
|
||||||
dynamic get name;
|
Guarded<InstanceRef> get value;
|
||||||
Guarded<dynamic> get value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class NativeField {
|
abstract class NativeField {
|
||||||
|
|
|
@ -2118,7 +2118,7 @@ class ServiceMap extends ServiceObject
|
||||||
_map.clear();
|
_map.clear();
|
||||||
_map.addAll(map);
|
_map.addAll(map);
|
||||||
|
|
||||||
name = _map['name']?.toString();
|
name = _map['name'];
|
||||||
vmName = (_map.containsKey('_vmName') ? _map['_vmName'] : name);
|
vmName = (_map.containsKey('_vmName') ? _map['_vmName'] : name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2800,33 +2800,25 @@ M.InstanceKind stringToInstanceKind(String s) {
|
||||||
return M.InstanceKind.typeRef;
|
return M.InstanceKind.typeRef;
|
||||||
case 'ReceivePort':
|
case 'ReceivePort':
|
||||||
return M.InstanceKind.receivePort;
|
return M.InstanceKind.receivePort;
|
||||||
case '_Record':
|
|
||||||
return M.InstanceKind.record;
|
|
||||||
case '_RecordType':
|
|
||||||
return M.InstanceKind.recordType;
|
|
||||||
case 'Finalizer':
|
|
||||||
return M.InstanceKind.finalizer;
|
|
||||||
case 'WeakReference':
|
|
||||||
return M.InstanceKind.weakReference;
|
|
||||||
}
|
}
|
||||||
var message = 'Unrecognized instance kind: $s';
|
var message = 'Unrecognized instance kind: $s';
|
||||||
Logger.root.severe(message);
|
Logger.root.severe(message);
|
||||||
throw new ArgumentError(message);
|
throw new ArgumentError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Guarded<T> implements M.Guarded<T> {
|
class Guarded<T extends ServiceObject> implements M.Guarded<T> {
|
||||||
bool get isValue => asValue != null;
|
bool get isValue => asValue != null;
|
||||||
bool get isSentinel => asSentinel != null;
|
bool get isSentinel => asSentinel != null;
|
||||||
final Sentinel asSentinel;
|
final Sentinel asSentinel;
|
||||||
final T asValue;
|
final T asValue;
|
||||||
|
|
||||||
factory Guarded(dynamic obj) {
|
factory Guarded(ServiceObject obj) {
|
||||||
if (obj is Sentinel) {
|
if (obj is Sentinel) {
|
||||||
return new Guarded.fromSentinel(obj);
|
return new Guarded.fromSentinel(obj);
|
||||||
} else if (obj is T) {
|
} else if (obj is T) {
|
||||||
return new Guarded.fromValue(obj);
|
return new Guarded.fromValue(obj);
|
||||||
}
|
}
|
||||||
throw new Exception('${obj.runtimeType} is neither Sentinel or $T');
|
throw new Exception('${obj.type} is neither Sentinel or $T');
|
||||||
}
|
}
|
||||||
|
|
||||||
Guarded.fromSentinel(this.asSentinel) : asValue = null;
|
Guarded.fromSentinel(this.asSentinel) : asValue = null;
|
||||||
|
@ -2835,10 +2827,8 @@ class Guarded<T> implements M.Guarded<T> {
|
||||||
|
|
||||||
class BoundField implements M.BoundField {
|
class BoundField implements M.BoundField {
|
||||||
final Field decl;
|
final Field decl;
|
||||||
// String|int
|
final Guarded<Instance> value;
|
||||||
final dynamic name;
|
BoundField(this.decl, value) : value = new Guarded(value);
|
||||||
final Guarded<dynamic> value;
|
|
||||||
BoundField(this.decl, this.name, value) : value = new Guarded(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class NativeField implements M.NativeField {
|
class NativeField implements M.NativeField {
|
||||||
|
@ -2939,7 +2929,7 @@ class Instance extends HeapObject implements M.Instance {
|
||||||
Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
|
Instance._empty(ServiceObjectOwner owner) : super._empty(owner);
|
||||||
|
|
||||||
void _update(Map map, bool mapIsRef) {
|
void _update(Map map, bool mapIsRef) {
|
||||||
// Extract full properties.
|
// Extract full properties.1
|
||||||
_upgradeCollection(map, isolate);
|
_upgradeCollection(map, isolate);
|
||||||
super._update(map, mapIsRef);
|
super._update(map, mapIsRef);
|
||||||
|
|
||||||
|
@ -2948,7 +2938,7 @@ class Instance extends HeapObject implements M.Instance {
|
||||||
// Coerce absence to false.
|
// Coerce absence to false.
|
||||||
valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true;
|
valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true;
|
||||||
closureFunction = map['closureFunction'];
|
closureFunction = map['closureFunction'];
|
||||||
name = map['name']?.toString();
|
name = map['name'];
|
||||||
length = map['length'];
|
length = map['length'];
|
||||||
pattern = map['pattern'];
|
pattern = map['pattern'];
|
||||||
typeClass = map['typeClass'];
|
typeClass = map['typeClass'];
|
||||||
|
@ -2981,7 +2971,7 @@ class Instance extends HeapObject implements M.Instance {
|
||||||
if (map['fields'] != null) {
|
if (map['fields'] != null) {
|
||||||
var fields = <BoundField>[];
|
var fields = <BoundField>[];
|
||||||
for (var f in map['fields']) {
|
for (var f in map['fields']) {
|
||||||
fields.add(new BoundField(f['decl'], f['name'], f['value']));
|
fields.add(new BoundField(f['decl'], f['value']));
|
||||||
}
|
}
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1128,7 +1128,7 @@ void Instance::PrintSharedInstanceJSON(JSONObject* jsobj,
|
||||||
|
|
||||||
Array& field_array = Array::Handle();
|
Array& field_array = Array::Handle();
|
||||||
Field& field = Field::Handle();
|
Field& field = Field::Handle();
|
||||||
Object& field_value = Object::Handle();
|
Instance& field_value = Instance::Handle();
|
||||||
{
|
{
|
||||||
JSONArray jsarr(jsobj, "fields");
|
JSONArray jsarr(jsobj, "fields");
|
||||||
for (intptr_t i = classes.length() - 1; i >= 0; i--) {
|
for (intptr_t i = classes.length() - 1; i >= 0; i--) {
|
||||||
|
@ -1137,7 +1137,7 @@ void Instance::PrintSharedInstanceJSON(JSONObject* jsobj,
|
||||||
for (intptr_t j = 0; j < field_array.Length(); j++) {
|
for (intptr_t j = 0; j < field_array.Length(); j++) {
|
||||||
field ^= field_array.At(j);
|
field ^= field_array.At(j);
|
||||||
if (!field.is_static()) {
|
if (!field.is_static()) {
|
||||||
field_value = GetField(field);
|
field_value ^= GetField(field);
|
||||||
JSONObject jsfield(&jsarr);
|
JSONObject jsfield(&jsarr);
|
||||||
jsfield.AddProperty("type", "BoundField");
|
jsfield.AddProperty("type", "BoundField");
|
||||||
jsfield.AddProperty("decl", field);
|
jsfield.AddProperty("decl", field);
|
||||||
|
|
Loading…
Reference in a new issue