| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of app; | 5 part of app; |
| 6 | 6 |
| 7 /// A [Page] controls the user interface of Observatory. At any given time | 7 /// A [Page] controls the user interface of Observatory. At any given time |
| 8 /// one page will be the current page. Pages are registered at startup. | 8 /// one page will be the current page. Pages are registered at startup. |
| 9 /// When the user navigates within the application, each page is asked if it | 9 /// When the user navigates within the application, each page is asked if it |
| 10 /// can handle the current location, the first page to say yes, wins. | 10 /// can handle the current location, the first page to say yes, wins. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 void _visit(String url) { | 54 void _visit(String url) { |
| 55 assert(element != null); | 55 assert(element != null); |
| 56 assert(canVisit(url)); | 56 assert(canVisit(url)); |
| 57 if (url == '') { | 57 if (url == '') { |
| 58 // Nothing requested. | 58 // Nothing requested. |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 /// Request url from VM and display it. | 61 /// Request url from VM and display it. |
| 62 app.vm.get(url).then((obj) { | 62 app.vm.getDeprecated(url).then((obj) { |
| 63 ServiceObjectViewElement serviceElement = element; | 63 ServiceObjectViewElement serviceElement = element; |
| 64 serviceElement.object = obj; | 64 serviceElement.object = obj; |
| 65 }).catchError((e) { | 65 }).catchError((e) { |
| 66 Logger.root.severe('ServiceObjectPage visit error: $e'); | 66 Logger.root.severe('ServiceObjectPage visit error: $e'); |
| 67 }); | 67 }); |
| 68 } | 68 } |
| 69 | 69 |
| 70 /// Catch all. | 70 /// Catch all. |
| 71 bool canVisit(String url) => true; | 71 bool canVisit(String url) => true; |
| 72 } | 72 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 void _visit(String url) { | 87 void _visit(String url) { |
| 88 assert(url != null); | 88 assert(url != null); |
| 89 assert(canVisit(url)); | 89 assert(canVisit(url)); |
| 90 _isolateId = url.substring(pagePrefix.length); | 90 _isolateId = url.substring(pagePrefix.length); |
| 91 } | 91 } |
| 92 | 92 |
| 93 Future<Isolate> getIsolate() { | 93 Future<Isolate> getIsolate() { |
| 94 return app.vm.get(isolateId).catchError((e) { | 94 return app.vm.getIsolate(isolateId).catchError((e) { |
| 95 Logger.root.severe('$pagePrefix visit error: $e'); | 95 Logger.root.severe('$pagePrefix visit error: $e'); |
| 96 return e; | 96 return e; |
| 97 }); | 97 }); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool canVisit(String url) => url.startsWith(pagePrefix); | 100 bool canVisit(String url) => url.startsWith(pagePrefix); |
| 101 } | 101 } |
| 102 | 102 |
| 103 | 103 |
| 104 /// Class tree page. | 104 /// Class tree page. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 String _isolateId(String url) { | 269 String _isolateId(String url) { |
| 270 // Grab isolate prefix. | 270 // Grab isolate prefix. |
| 271 String isolateId = _isolateMatcher.stringMatch(url); | 271 String isolateId = _isolateMatcher.stringMatch(url); |
| 272 // Remove the trailing slash. | 272 // Remove the trailing slash. |
| 273 return isolateId.substring(0, isolateId.length - 1); | 273 return isolateId.substring(0, isolateId.length - 1); |
| 274 } | 274 } |
| 275 | 275 |
| 276 void _visit(String url) { | 276 void _visit(String url) { |
| 277 assert(element != null); | 277 assert(element != null); |
| 278 assert(canVisit(url)); | 278 assert(canVisit(url)); |
| 279 app.vm.get(_isolateId(url)).then((i) { | 279 app.vm.getIsolate(_isolateId(url)).then((i) { |
| 280 (element as MetricsPageElement).isolate = i; | 280 (element as MetricsPageElement).isolate = i; |
| 281 }); | 281 }); |
| 282 } | 282 } |
| 283 | 283 |
| 284 bool canVisit(String url) => _matcher.hasMatch(url); | 284 bool canVisit(String url) => _matcher.hasMatch(url); |
| 285 } | 285 } |
| OLD | NEW |