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

Unified Diff: runtime/observatory/lib/src/app/page.dart

Issue 1072423003: When attempting to navigate to a page for an isolate that doesn't exist, offer to (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/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 7457b1d3828278ed168587fedbb028e3bea9cc55..b16cc3036e17f61f6885ad0ca2515abc69190f5e 100644
--- a/runtime/observatory/lib/src/app/page.dart
+++ b/runtime/observatory/lib/src/app/page.dart
@@ -4,6 +4,12 @@
part of app;
+class IsolateNotFound implements Exception {
+ String isolateId;
+ IsolateNotFound(this.isolateId);
+ String toString() => "IsolateNotFound: $isolateId";
+}
+
/// A [Page] controls the user interface of Observatory. At any given time
/// one page will be the current page. Pages are registered at startup.
/// When the user navigates within the application, each page is asked if it
@@ -59,11 +65,13 @@ class SimplePage extends Page {
}
Future<Isolate> getIsolate(Uri uri) {
- return app.vm.getIsolate(uri.queryParameters['isolateId'])
- .catchError((e, stack) {
- Logger.root.severe('$path visit error: $e\n$stack');
- return e;
- });
+ var isolateId = uri.queryParameters['isolateId'];
+ return app.vm.getIsolate(isolateId).then((isolate) {
rmacnak 2015/04/23 18:32:19 Probably push this into the service library.
turnidge 2015/05/01 17:23:55 I'm working on this currently in another CL.
+ if (isolate == null) {
+ throw new IsolateNotFound(isolateId);
+ }
+ return isolate;
+ });
}
bool canVisit(Uri uri) => uri.path == path;
@@ -292,8 +300,26 @@ class VMConnectPage extends Page {
assert(canVisit(uri));
}
- // TODO(turnidge): Update this to not have the trailing slash.
- bool canVisit(Uri uri) => uri.path.startsWith('vm-connect/');
+ bool canVisit(Uri uri) => uri.path.startsWith('vm-connect');
+}
+
+class IsolateReconnectPage extends Page {
+ IsolateReconnectPage(app) : super(app);
+
+ void onInstall() {
+ if (element == null) {
+ element = new Element.tag('isolate-reconnect');
+ }
+ assert(element != null);
+ }
+
+ void _visit(Uri uri) {
+ app.vm.reload();
+ assert(element != null);
+ assert(canVisit(uri));
+ }
+
+ bool canVisit(Uri uri) => uri.path.startsWith('isolate-reconnect');
}
class MetricsPage extends Page {

Powered by Google App Engine
This is Rietveld 408576698