Index: runtime/observatory/lib/src/app/page.dart |
diff --git a/runtime/observatory/lib/src/app/page.dart b/runtime/observatory/lib/src/app/page.dart |
index a8cbe2e84a60e862350daf1a51f4bbb3b0c80970..8500d32e877bb828863aa2865cbaad3bead4aab1 100644 |
--- a/runtime/observatory/lib/src/app/page.dart |
+++ b/runtime/observatory/lib/src/app/page.dart |
@@ -105,10 +105,8 @@ abstract class MatchingPage extends Page { |
} |
EditorRepository getEditor(Uri uri) { |
- var editor = uri.queryParameters['editor']; |
- if (editor != null) { |
- return new EditorRepository(editor); |
- } |
+ final editor = uri.queryParameters['editor']; |
+ return new EditorRepository(app.vm, editor: editor); |
return null; |
} |
@@ -699,12 +697,25 @@ class MemoryDashboardPage extends MatchingPage { |
void _visit(Uri uri) { |
super._visit(uri); |
- getIsolate(uri).then((isolate) { |
+ if (app.vm == null) { |
+ Logger.root.severe('MemoryDashboard has no VM'); |
+ // Reroute to vm-connect. |
+ app.locationManager.go(Uris.vmConnect()); |
+ return; |
+ } |
+ final editor = getEditor(uri); |
+ app.vm.reload().then((VM vm) async { |
+ // Preload all isolates to avoid sorting problems. |
+ await Future.wait(vm.isolates.map((i) => i.load())); |
container.children = [ |
- new MemoryDashboardElement(isolate.vm, isolate, app.events, |
- app.notifications, _allocationProfileRepository, getEditor(uri), |
+ new MemoryDashboardElement(vm, new IsolateRepository(vm), editor, |
+ _allocationProfileRepository, app.events, app.notifications, |
queue: app.queue) |
]; |
+ }).catchError((e, stack) { |
+ Logger.root.severe('MemoryDashboard visit error: $e'); |
+ // Reroute to vm-connect. |
+ app.locationManager.go(Uris.vmConnect()); |
}); |
} |