[observatory] Progress toward static mode compatibility.
Bug: https://github.com/dart-lang/sdk/issues/32503
Change-Id: I4c3358dcc69aa26e3d296275f6ec4da22814c162
Reviewed-on: https://dart-review.googlesource.com/64820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/observatory/lib/object_graph.dart b/runtime/observatory/lib/object_graph.dart
index e89d074..3ccc6c3 100644
--- a/runtime/observatory/lib/object_graph.dart
+++ b/runtime/observatory/lib/object_graph.dart
@@ -359,7 +359,7 @@
var next = _graph._mergedDomNext;
var cids = _graph._cids;
- var domChildren = [];
+ var domChildren = <MergedObjectVertex>[];
var prev = SENTINEL;
var child = _graph._mergedDomHead[_id];
// Walk the list of children and look for the representative objects, i.e.
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index a9f843a..1c70579 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -36,7 +36,7 @@
abstract class DebuggerCommand extends Command {
ObservatoryDebugger debugger;
- DebuggerCommand(this.debugger, name, children) : super(name, children);
+ DebuggerCommand(this.debugger, name, List<Command> children) : super(name, children);
String get helpShort;
String get helpLong;
@@ -46,7 +46,7 @@
// provided by the cli library.
class HelpCommand extends DebuggerCommand {
HelpCommand(Debugger debugger)
- : super(debugger, 'help', [
+ : super(debugger, 'help', <Command>[
new HelpHotkeysCommand(debugger),
]);
@@ -62,7 +62,7 @@
var con = debugger.console;
if (args.length == 0) {
// Print list of all top-level commands.
- var commands = debugger.cmd.matchCommand([], false);
+ var commands = debugger.cmd.matchCommand(<String>[], false);
commands.sort((a, b) => a.name.compareTo(b.name));
con.print('List of commands:\n');
for (DebuggerCommand command in commands) {
@@ -92,7 +92,7 @@
con.printBold(_nameAndAlias(command));
con.print(command.helpLong);
- var newArgs = [];
+ var newArgs = <String>[];
newArgs.addAll(args.take(args.length - 1));
newArgs.add(command.name);
newArgs.add('');
@@ -129,7 +129,7 @@
}
class HelpHotkeysCommand extends DebuggerCommand {
- HelpHotkeysCommand(Debugger debugger) : super(debugger, 'hotkeys', []);
+ HelpHotkeysCommand(Debugger debugger) : super(debugger, 'hotkeys', <Command>[]);
Future run(List<String> args) {
var con = debugger.console;
@@ -160,7 +160,7 @@
}
class PrintCommand extends DebuggerCommand {
- PrintCommand(Debugger debugger) : super(debugger, 'print', []) {
+ PrintCommand(Debugger debugger) : super(debugger, 'print', <Command>[]) {
alias = 'p';
}
@@ -193,7 +193,7 @@
}
class DownCommand extends DebuggerCommand {
- DownCommand(Debugger debugger) : super(debugger, 'down', []);
+ DownCommand(Debugger debugger) : super(debugger, 'down', <Command>[]);
Future run(List<String> args) {
int count = 1;
@@ -227,7 +227,7 @@
}
class UpCommand extends DebuggerCommand {
- UpCommand(Debugger debugger) : super(debugger, 'up', []);
+ UpCommand(Debugger debugger) : super(debugger, 'up', <Command>[]);
Future run(List<String> args) {
int count = 1;
@@ -261,7 +261,7 @@
}
class FrameCommand extends DebuggerCommand {
- FrameCommand(Debugger debugger) : super(debugger, 'frame', []) {
+ FrameCommand(Debugger debugger) : super(debugger, 'frame', <Command>[]) {
alias = 'f';
}
@@ -295,7 +295,7 @@
}
class PauseCommand extends DebuggerCommand {
- PauseCommand(Debugger debugger) : super(debugger, 'pause', []);
+ PauseCommand(Debugger debugger) : super(debugger, 'pause', <Command>[]);
Future run(List<String> args) {
return debugger.pause();
@@ -311,7 +311,7 @@
}
class ContinueCommand extends DebuggerCommand {
- ContinueCommand(Debugger debugger) : super(debugger, 'continue', []) {
+ ContinueCommand(Debugger debugger) : super(debugger, 'continue', <Command>[]) {
alias = 'c';
}
@@ -330,7 +330,7 @@
}
class SmartNextCommand extends DebuggerCommand {
- SmartNextCommand(Debugger debugger) : super(debugger, 'next', []) {
+ SmartNextCommand(Debugger debugger) : super(debugger, 'next', <Command>[]) {
alias = 'n';
}
@@ -352,7 +352,7 @@
}
class SyncNextCommand extends DebuggerCommand {
- SyncNextCommand(Debugger debugger) : super(debugger, 'next-sync', []);
+ SyncNextCommand(Debugger debugger) : super(debugger, 'next-sync', <Command>[]);
Future run(List<String> args) {
return debugger.syncNext();
@@ -368,7 +368,7 @@
}
class AsyncNextCommand extends DebuggerCommand {
- AsyncNextCommand(Debugger debugger) : super(debugger, 'next-async', []);
+ AsyncNextCommand(Debugger debugger) : super(debugger, 'next-async', <Command>[]);
Future run(List<String> args) {
return debugger.asyncNext();
@@ -384,7 +384,7 @@
}
class StepCommand extends DebuggerCommand {
- StepCommand(Debugger debugger) : super(debugger, 'step', []) {
+ StepCommand(Debugger debugger) : super(debugger, 'step', <Command>[]) {
alias = 's';
}
@@ -406,7 +406,7 @@
}
class RewindCommand extends DebuggerCommand {
- RewindCommand(Debugger debugger) : super(debugger, 'rewind', []);
+ RewindCommand(Debugger debugger) : super(debugger, 'rewind', <Command>[]);
Future run(List<String> args) async {
try {
@@ -443,7 +443,7 @@
final M.IsolateRepository _isolates;
ReloadCommand(Debugger debugger, this._isolates)
- : super(debugger, 'reload', []);
+ : super(debugger, 'reload', <Command>[]);
Future run(List<String> args) async {
try {
@@ -477,7 +477,7 @@
}
class ClsCommand extends DebuggerCommand {
- ClsCommand(Debugger debugger) : super(debugger, 'cls', []) {}
+ ClsCommand(Debugger debugger) : super(debugger, 'cls', <Command>[]) {}
Future run(List<String> args) {
debugger.console.clear();
@@ -493,7 +493,7 @@
}
class LogCommand extends DebuggerCommand {
- LogCommand(Debugger debugger) : super(debugger, 'log', []);
+ LogCommand(Debugger debugger) : super(debugger, 'log', <Command>[]);
Future run(List<String> args) async {
if (args.length == 0) {
@@ -560,7 +560,7 @@
}
class FinishCommand extends DebuggerCommand {
- FinishCommand(Debugger debugger) : super(debugger, 'finish', []);
+ FinishCommand(Debugger debugger) : super(debugger, 'finish', <Command>[]);
Future run(List<String> args) {
if (debugger.isolatePaused()) {
@@ -591,7 +591,7 @@
}
class SetCommand extends DebuggerCommand {
- SetCommand(Debugger debugger) : super(debugger, 'set', []);
+ SetCommand(Debugger debugger) : super(debugger, 'set', <Command>[]);
static var _boeValues = ['All', 'None', 'Unhandled'];
static var _boolValues = ['false', 'true'];
@@ -737,7 +737,7 @@
}
class BreakCommand extends DebuggerCommand {
- BreakCommand(Debugger debugger) : super(debugger, 'break', []);
+ BreakCommand(Debugger debugger) : super(debugger, 'break', <Command>[]);
Future run(List<String> args) async {
if (args.length > 1) {
@@ -821,7 +821,7 @@
}
class ClearCommand extends DebuggerCommand {
- ClearCommand(Debugger debugger) : super(debugger, 'clear', []);
+ ClearCommand(Debugger debugger) : super(debugger, 'clear', <Command>[]);
Future run(List<String> args) async {
if (args.length > 1) {
@@ -908,7 +908,7 @@
// TODO(turnidge): Add argument completion.
class DeleteCommand extends DebuggerCommand {
- DeleteCommand(Debugger debugger) : super(debugger, 'delete', []);
+ DeleteCommand(Debugger debugger) : super(debugger, 'delete', <Command>[]);
Future run(List<String> args) {
if (args.length < 1) {
@@ -948,7 +948,7 @@
class InfoBreakpointsCommand extends DebuggerCommand {
InfoBreakpointsCommand(Debugger debugger)
- : super(debugger, 'breakpoints', []);
+ : super(debugger, 'breakpoints', <Command>[]);
Future run(List<String> args) async {
if (debugger.isolate.breakpoints.isEmpty) {
@@ -975,7 +975,7 @@
}
class InfoFrameCommand extends DebuggerCommand {
- InfoFrameCommand(Debugger debugger) : super(debugger, 'frame', []);
+ InfoFrameCommand(Debugger debugger) : super(debugger, 'frame', <Command>[]);
Future run(List<String> args) {
if (args.length > 0) {
@@ -995,7 +995,7 @@
class IsolateCommand extends DebuggerCommand {
IsolateCommand(Debugger debugger)
- : super(debugger, 'isolate', [
+ : super(debugger, 'isolate', <Command>[
new IsolateListCommand(debugger),
new IsolateNameCommand(debugger),
]) {
@@ -1077,7 +1077,7 @@
}
class IsolateListCommand extends DebuggerCommand {
- IsolateListCommand(Debugger debugger) : super(debugger, 'list', []);
+ IsolateListCommand(Debugger debugger) : super(debugger, 'list', <Command>[]);
Future run(List<String> args) async {
if (debugger.vm == null) {
@@ -1123,7 +1123,7 @@
}
class IsolateNameCommand extends DebuggerCommand {
- IsolateNameCommand(Debugger debugger) : super(debugger, 'name', []);
+ IsolateNameCommand(Debugger debugger) : super(debugger, 'name', <Command>[]);
Future run(List<String> args) {
if (args.length != 1) {
@@ -1142,7 +1142,7 @@
class InfoCommand extends DebuggerCommand {
InfoCommand(Debugger debugger)
- : super(debugger, 'info', [
+ : super(debugger, 'info', <Command>[
new InfoBreakpointsCommand(debugger),
new InfoFrameCommand(debugger)
]);
@@ -1160,7 +1160,7 @@
}
class RefreshStackCommand extends DebuggerCommand {
- RefreshStackCommand(Debugger debugger) : super(debugger, 'stack', []);
+ RefreshStackCommand(Debugger debugger) : super(debugger, 'stack', <Command>[]);
Future run(List<String> args) {
return debugger.refreshStack();
@@ -1175,7 +1175,7 @@
class RefreshCommand extends DebuggerCommand {
RefreshCommand(Debugger debugger)
- : super(debugger, 'refresh', [
+ : super(debugger, 'refresh', <Command>[
new RefreshStackCommand(debugger),
]);
@@ -1193,7 +1193,7 @@
}
class VmListCommand extends DebuggerCommand {
- VmListCommand(Debugger debugger) : super(debugger, 'list', []);
+ VmListCommand(Debugger debugger) : super(debugger, 'list', <Command>[]);
Future run(List<String> args) async {
if (args.length > 0) {
@@ -1235,7 +1235,7 @@
}
class VmNameCommand extends DebuggerCommand {
- VmNameCommand(Debugger debugger) : super(debugger, 'name', []);
+ VmNameCommand(Debugger debugger) : super(debugger, 'name', <Command>[]);
Future run(List<String> args) async {
if (args.length != 1) {
@@ -1258,7 +1258,7 @@
class VmCommand extends DebuggerCommand {
VmCommand(Debugger debugger)
- : super(debugger, 'vm', [
+ : super(debugger, 'vm', <Command>[
new VmListCommand(debugger),
new VmNameCommand(debugger),
]);
diff --git a/runtime/observatory/lib/src/elements/function_view.dart b/runtime/observatory/lib/src/elements/function_view.dart
index 3ac4629..57d775a 100644
--- a/runtime/observatory/lib/src/elements/function_view.dart
+++ b/runtime/observatory/lib/src/elements/function_view.dart
@@ -169,19 +169,19 @@
}
List<Element> _createMenu() {
- final menu = [
+ final menu = <Element>[
new NavTopMenuElement(queue: _r.queue),
new NavVMMenuElement(_vm, _events, queue: _r.queue),
new NavIsolateMenuElement(_isolate, _events, queue: _r.queue)
];
if (_library != null) {
- menu.add(new NavLibraryMenuElement(_isolate, _function.dartOwner,
+ menu.add(new NavLibraryMenuElement(_isolate, _library,
queue: _r.queue));
} else if (_function.dartOwner is M.ClassRef) {
menu.add(new NavClassMenuElement(_isolate, _function.dartOwner,
queue: _r.queue));
}
- menu.addAll([
+ menu.addAll(<Element>[
navMenu(_function.name),
new NavRefreshElement(queue: _r.queue)
..onRefresh.listen((e) {
diff --git a/runtime/observatory/lib/src/elements/heap_map.dart b/runtime/observatory/lib/src/elements/heap_map.dart
index 2c12234..6db1ce8 100644
--- a/runtime/observatory/lib/src/elements/heap_map.dart
+++ b/runtime/observatory/lib/src/elements/heap_map.dart
@@ -169,12 +169,12 @@
return [rng.nextInt(128), rng.nextInt(128), rng.nextInt(128), 255];
}
- String _classNameAt(Point<int> point) {
+ String _classNameAt(Point<num> point) {
var color = new PixelReference(_fragmentationData, point).color;
return _classIdToName[_colorToClassId[_packColor(color)]];
}
- ObjectInfo _objectAt(Point<int> point) {
+ ObjectInfo _objectAt(Point<num> point) {
if (_fragmentation == null || _canvas == null) {
return null;
}
@@ -302,13 +302,13 @@
var _dataIndex;
static const NUM_COLOR_COMPONENTS = 4;
- PixelReference(ImageData data, Point<int> point)
+ PixelReference(ImageData data, Point<num> point)
: _data = data,
_dataIndex = (point.y * data.width + point.x) * NUM_COLOR_COMPONENTS;
PixelReference._fromDataIndex(this._data, this._dataIndex);
- Point<int> get point => new Point(index % _data.width, index ~/ _data.width);
+ Point<num> get point => new Point(index % _data.width, index ~/ _data.width);
void set color(Iterable<int> color) {
_data.data.setRange(_dataIndex, _dataIndex + NUM_COLOR_COMPONENTS, color);
diff --git a/runtime/observatory/lib/src/elements/heap_snapshot.dart b/runtime/observatory/lib/src/elements/heap_snapshot.dart
index 9fabccb..3e6e455 100644
--- a/runtime/observatory/lib/src/elements/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/elements/heap_snapshot.dart
@@ -430,8 +430,8 @@
return const [];
}
- void _updateDominator(
- HtmlElement element, M.HeapSnapshotDominatorNode node, int depth) {
+ void _updateDominator(HtmlElement element, nodeDynamic, int depth) {
+ M.HeapSnapshotDominatorNode node = nodeDynamic;
element.children[0].text = Utils.formatSize(node.retainedSize);
_updateLines(element.children[1].children, depth);
if (_getChildrenDominator(node).isNotEmpty) {
@@ -463,8 +463,8 @@
}
}
- void _updateMergedDominator(
- HtmlElement element, M.HeapSnapshotMergedDominatorNode node, int depth) {
+ void _updateMergedDominator(HtmlElement element, nodeDynamic, int depth) {
+ M.HeapSnapshotMergedDominatorNode node = nodeDynamic;
element.children[0].text = Utils.formatSize(node.retainedSize);
_updateLines(element.children[1].children, depth);
if (_getChildrenMergedDominator(node).isNotEmpty) {
diff --git a/runtime/observatory/lib/src/elements/nav/notify.dart b/runtime/observatory/lib/src/elements/nav/notify.dart
index f3cd50e..6b22f32 100644
--- a/runtime/observatory/lib/src/elements/nav/notify.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify.dart
@@ -80,7 +80,7 @@
return true;
}
- HtmlElement _toElement(M.Notification notification) {
+ Element _toElement(M.Notification notification) {
if (notification is M.EventNotification) {
return new NavNotifyEventElement(notification.event, queue: _r.queue)
..onDelete.listen((_) => _repository.delete(notification));
diff --git a/runtime/observatory/lib/src/elements/nav/notify_exception.dart b/runtime/observatory/lib/src/elements/nav/notify_exception.dart
index 8b75dca..58836f6 100644
--- a/runtime/observatory/lib/src/elements/nav/notify_exception.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify_exception.dart
@@ -10,7 +10,7 @@
import 'package:observatory/models.dart' show ConnectionException;
class ExceptionDeleteEvent {
- final Exception exception;
+ final dynamic exception;
final StackTrace stacktrace;
ExceptionDeleteEvent(this.exception, {this.stacktrace});
@@ -28,13 +28,13 @@
new StreamController<ExceptionDeleteEvent>.broadcast();
Stream<ExceptionDeleteEvent> get onDelete => _onDelete.stream;
- Exception _exception;
+ dynamic _exception;
StackTrace _stacktrace;
- Exception get exception => _exception;
+ dynamic get exception => _exception;
StackTrace get stacktrace => _stacktrace;
- factory NavNotifyExceptionElement(Exception exception,
+ factory NavNotifyExceptionElement(dynamic exception,
{StackTrace stacktrace: null, RenderingQueue queue}) {
assert(exception != null);
NavNotifyExceptionElement e = document.createElement(tag.name);
diff --git a/runtime/observatory/lib/src/elements/persistent_handles.dart b/runtime/observatory/lib/src/elements/persistent_handles.dart
index 92d3ee5..57f6196 100644
--- a/runtime/observatory/lib/src/elements/persistent_handles.dart
+++ b/runtime/observatory/lib/src/elements/persistent_handles.dart
@@ -162,17 +162,23 @@
}
switch (_sortingDirection) {
case _SortingDirection.ascending:
- return (a, b) => getter(a).compareTo(getter(b));
+ int sort(M.WeakPersistentHandle a, M.WeakPersistentHandle b) {
+ return getter(a).compareTo(getter(b));
+ }
+ return sort;
case _SortingDirection.descending:
- return (a, b) => getter(b).compareTo(getter(a));
+ int sort(M.WeakPersistentHandle a, M.WeakPersistentHandle b) {
+ return getter(b).compareTo(getter(a));
+ }
+ return sort;
}
}
- static Element _createLine() => new DivElement()
+ static HtmlElement _createLine() => new DivElement()
..classes = ['collection-item']
..text = 'object';
- static Element _createWeakLine() => new DivElement()
+ static HtmlElement _createWeakLine() => new DivElement()
..classes = ['weak-item']
..children = <Element>[
new SpanElement()
@@ -231,7 +237,8 @@
_r.dirty();
}
- void _updateWeakLine(Element e, M.WeakPersistentHandle item, index) {
+ void _updateWeakLine(Element e, itemDynamic, index) {
+ M.WeakPersistentHandle item = itemDynamic;
e.children[0].text = Utils.formatSize(_getExternalSize(item));
e.children[1].text = '${_getPeer(item)}';
e.children[2] = anyRef(_isolate, item.object, _objects, queue: _r.queue)
@@ -241,7 +248,8 @@
..title = '${_getFinalizerCallback(item)}';
}
- void _updateLine(Element e, M.PersistentHandle item, index) {
+ void _updateLine(Element e, itemDynamic, index) {
+ M.PersistentHandle item = itemDynamic;
e.children = <Element>[
anyRef(_isolate, item.object, _objects, queue: _r.queue)
..classes = ['object']
diff --git a/runtime/observatory/lib/src/elements/retaining_path.dart b/runtime/observatory/lib/src/elements/retaining_path.dart
index 1c1b2f6..a72c728 100644
--- a/runtime/observatory/lib/src/elements/retaining_path.dart
+++ b/runtime/observatory/lib/src/elements/retaining_path.dart
@@ -87,7 +87,7 @@
return [new SpanElement()..text = 'Loading'];
}
- var elements = new List();
+ var elements = new List<Element>();
bool first = true;
for (var item in _path.elements) {
elements.add(_createItem(item, first));
diff --git a/runtime/observatory/lib/src/elements/script_inset.dart b/runtime/observatory/lib/src/elements/script_inset.dart
index ef8e767..28ecc97 100644
--- a/runtime/observatory/lib/src/elements/script_inset.dart
+++ b/runtime/observatory/lib/src/elements/script_inset.dart
@@ -150,7 +150,7 @@
int _startLine;
int _endLine;
- Map<int, List<S.ServiceMap>> _rangeMap = {};
+ Map/*<int, List<S.ServiceMap>>*/ _rangeMap = {};
Set _callSites = new Set<S.CallSite>();
Set _possibleBreakpointLines = new Set<int>();
Map<int, ScriptLineProfile> _profileMap = {};
diff --git a/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart b/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
index c14bff7b..9b90eaa 100644
--- a/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
@@ -136,16 +136,16 @@
class HeapSnapshotDominatorNode implements M.HeapSnapshotDominatorNode {
final ObjectVertex v;
final S.Isolate isolate;
- S.HeapObject _preloaded;
+ S.ServiceObject _preloaded;
bool get isStack => v.isStack;
- Future<S.HeapObject> get object {
+ Future<S.ServiceObject> get object {
if (_preloaded != null) {
return new Future.value(_preloaded);
} else {
return isolate.getObjectByAddress(v.address).then((S.ServiceObject obj) {
- return _preloaded = obj as S.HeapObject;
+ return _preloaded = obj;
});
}
}
diff --git a/runtime/observatory/lib/src/models/objects/field.dart b/runtime/observatory/lib/src/models/objects/field.dart
index 8ac61ee..d0d1221 100644
--- a/runtime/observatory/lib/src/models/objects/field.dart
+++ b/runtime/observatory/lib/src/models/objects/field.dart
@@ -32,7 +32,7 @@
abstract class Field extends Object implements FieldRef {
/// [optional] The value of this field, if the field is static.
- InstanceRef get staticValue;
+ ObjectRef get staticValue;
/// [optional] The location of this field in the source code.
SourceLocation get location;
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index 2663949..826897c 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -106,7 +106,7 @@
}
/// A [ServiceObject] represents a persistent object within the vm.
-abstract class ServiceObject {
+abstract class ServiceObject implements M.ObjectRef {
static int LexicalSortName(ServiceObject o1, ServiceObject o2) {
return o1.name.compareTo(o2.name);
}
@@ -1173,17 +1173,18 @@
final Iterable<InboundReference> elements;
InboundReferences(ServiceMap map)
- : this.elements =
- map['references'].map((rmap) => new InboundReference(rmap));
+ : this.elements = map['references']
+ .map<InboundReference>((rmap) => new InboundReference(rmap))
+ .toList();
}
class InboundReference implements M.InboundReference {
- final HeapObject source;
+ final ServiceObject /*HeapObject*/ source;
final Instance parentField;
final int parentListIndex;
final int parentWordOffset;
- InboundReference(ServiceMap map)
+ InboundReference(Map map)
: source = map['source'],
parentField = map['parentField'],
parentListIndex = map['parentListIndex'],
@@ -1194,17 +1195,18 @@
final Iterable<RetainingPathItem> elements;
RetainingPath(ServiceMap map)
- : this.elements =
- map['elements'].map((rmap) => new RetainingPathItem(rmap));
+ : this.elements = map['elements']
+ .map<RetainingPathItem>((rmap) => new RetainingPathItem(rmap))
+ .toList();
}
class RetainingPathItem implements M.RetainingPathItem {
- final HeapObject source;
+ final ServiceObject /*HeapObject*/ source;
final Instance parentField;
final int parentListIndex;
final int parentWordOffset;
- RetainingPathItem(ServiceMap map)
+ RetainingPathItem(Map map)
: source = map['value'],
parentField = map['parentField'],
parentListIndex = map['parentListIndex'],
@@ -1215,7 +1217,8 @@
final Iterable<Port> elements;
Ports(ServiceMap map)
- : this.elements = map['ports'].map((rmap) => new Port(rmap));
+ : this.elements =
+ map['ports'].map<Port>((rmap) => new Port(rmap)).toList();
}
class Port implements M.Port {
@@ -1233,10 +1236,11 @@
PersistentHandles(ServiceMap map)
: this.elements = map['persistentHandles']
- .map<PersistentHandle>((rmap) => new PersistentHandle(rmap)),
+ .map<PersistentHandle>((rmap) => new PersistentHandle(rmap))
+ .toList(),
this.weakElements = map['weakPersistentHandles']
- .map<WeakPersistentHandle>(
- (rmap) => new WeakPersistentHandle(rmap));
+ .map<WeakPersistentHandle>((rmap) => new WeakPersistentHandle(rmap))
+ .toList();
}
class PersistentHandle implements M.PersistentHandle {
@@ -1983,13 +1987,14 @@
return invokeRpc('_getInstances', params);
}
- Future<HeapObject> getObjectByAddress(String address, [bool ref = true]) {
+ Future<ServiceObject /*HeapObject*/ > getObjectByAddress(String address,
+ [bool ref = true]) {
Map params = {
'address': address,
'ref': ref,
};
return invokeRpc('_getObjectByAddress', params)
- .then((result) => result as HeapObject);
+ .then((result) => result as ServiceObject);
}
final Map<String, ServiceMetric> dartMetrics = <String, ServiceMetric>{};
@@ -2121,21 +2126,22 @@
}
/// A [DartError] is peered to a Dart Error object.
-class DartError extends ServiceObject implements M.Error {
+class DartError extends HeapObject implements M.Error {
DartError._empty(ServiceObject owner) : super._empty(owner);
M.ErrorKind kind;
- final M.ClassRef clazz = null;
- final int size = null;
String message;
Instance exception;
Instance stacktrace;
void _update(Map map, bool mapIsRef) {
+ _upgradeCollection(map, owner);
+ super._update(map, mapIsRef);
+
message = map['message'];
kind = stringToErrorKind(map['kind']);
- exception = new ServiceObject._fromMap(owner, map['exception']);
- stacktrace = new ServiceObject._fromMap(owner, map['stacktrace']);
+ exception = map['exception'];
+ stacktrace = map['stacktrace'];
name = 'DartError($message)';
vmName = name;
}
@@ -3310,7 +3316,7 @@
bool isStatic;
bool isFinal;
bool isConst;
- Instance staticValue;
+ ServiceObject staticValue;
String name;
String vmName;
@@ -3960,7 +3966,9 @@
if (mapIsRef) {
return;
}
- entries = map['_entries'].map((map) => new ObjectPoolEntry(map));
+ entries = map['_entries']
+ .map<ObjectPoolEntry>((map) => new ObjectPoolEntry(map))
+ .toList();
}
}
@@ -4120,7 +4128,7 @@
return;
}
count = map['totalCount'];
- samples = map['samples'];
+ samples = new List<HeapObject>.from(map['samples']);
}
}
@@ -4303,12 +4311,15 @@
return;
}
// Load the script and then update descriptors.
- script.load().then(_updateDescriptors);
+ script.load().then((_) => _updateDescriptors(script));
});
return;
}
- // Load the script and then update descriptors.
- function.location.script.load().then(_updateDescriptors);
+ {
+ // Load the script and then update descriptors.
+ var script = function.location.script;
+ script.load().then((_) => _updateDescriptors(script));
+ }
}
/// Reload [this]. Returns a future which completes to [this] or an
diff --git a/runtime/observatory/tests/service/break_on_activation_test.dart b/runtime/observatory/tests/service/break_on_activation_test.dart
index 904ce63..1b56913 100644
--- a/runtime/observatory/tests/service/break_on_activation_test.dart
+++ b/runtime/observatory/tests/service/break_on_activation_test.dart
@@ -65,7 +65,7 @@
valueOfField(String name) async {
var field = rootLib.variables.singleWhere((v) => v.name == name);
await field.load();
- return field.staticValue;
+ return field.staticValue as Instance;
}
var r1Ref = await valueOfField('r1');
@@ -109,7 +109,7 @@
valueOfField(String name) async {
var field = rootLib.variables.singleWhere((v) => v.name == name);
await field.load();
- return field.staticValue;
+ return field.staticValue as Instance;
}
var r1Ref = await valueOfField('r1_named');
@@ -153,7 +153,7 @@
valueOfField(String name) async {
var field = rootLib.variables.singleWhere((v) => v.name == name);
await field.load();
- return field.staticValue;
+ return field.staticValue as Instance;
}
var r1Ref = await valueOfField('r1');
diff --git a/runtime/observatory/tests/service/typed_data_test.dart b/runtime/observatory/tests/service/typed_data_test.dart
index 7c34f32..13dd5ee 100644
--- a/runtime/observatory/tests/service/typed_data_test.dart
+++ b/runtime/observatory/tests/service/typed_data_test.dart
@@ -90,7 +90,7 @@
expectTypedData(name, expectedValue) {
var variable = lib.variables.singleWhere((v) => v.name == name);
- var actualValue = variable.staticValue.typedElements;
+ var actualValue = (variable.staticValue as Instance).typedElements;
if (expectedValue is Int32x4List) {
expect(actualValue.length, equals(expectedValue.length));
for (var i = 0; i < actualValue.length; i++) {