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 { |