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

Side by Side Diff: runtime/observatory/lib/src/app/page.dart

Issue 1007863003: Allow Observatory debugger to switch isolates. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 element = new Element.tag(elementTagName); 51 element = new Element.tag(elementTagName);
52 } 52 }
53 } 53 }
54 54
55 void _visit(Uri uri) { 55 void _visit(Uri uri) {
56 assert(uri != null); 56 assert(uri != null);
57 assert(canVisit(uri)); 57 assert(canVisit(uri));
58 } 58 }
59 59
60 Future<Isolate> getIsolate(Uri uri) { 60 Future<Isolate> getIsolate(Uri uri) {
61 return app.vm.getIsolate(uri.queryParameters['isolateId']).catchError((e) { 61 return app.vm.getIsolate(uri.queryParameters['isolateId'])
62 Logger.root.severe('$path visit error: $e'); 62 .catchError((e, stack) {
63 return e; 63 Logger.root.severe('$path visit error: $e\n$stack');
64 }); 64 return e;
65 });
65 } 66 }
66 67
67 bool canVisit(Uri uri) => uri.path == path; 68 bool canVisit(Uri uri) => uri.path == path;
68 } 69 }
69 70
70 /// Error page for unrecognized paths. 71 /// Error page for unrecognized paths.
71 class ErrorPage extends Page { 72 class ErrorPage extends Page {
72 ErrorPage(app) : super(app); 73 ErrorPage(app) : super(app);
73 74
74 void onInstall() { 75 void onInstall() {
(...skipping 28 matching lines...) Expand all
103 class VMPage extends SimplePage { 104 class VMPage extends SimplePage {
104 VMPage(app) : super('vm', 'service-view', app); 105 VMPage(app) : super('vm', 'service-view', app);
105 106
106 void _visit(Uri uri) { 107 void _visit(Uri uri) {
107 super._visit(uri); 108 super._visit(uri);
108 app.vm.reload().then((vm) { 109 app.vm.reload().then((vm) {
109 if (element != null) { 110 if (element != null) {
110 ServiceObjectViewElement serviceElement = element; 111 ServiceObjectViewElement serviceElement = element;
111 serviceElement.object = vm; 112 serviceElement.object = vm;
112 } 113 }
113 }).catchError((e) { 114 }).catchError((e, stack) {
114 Logger.root.severe('VMPage visit error: $e'); 115 Logger.root.severe('VMPage visit error: $e\n$stack');
115 }); 116 });
116 } 117 }
117 } 118 }
118 119
119 class FlagsPage extends SimplePage { 120 class FlagsPage extends SimplePage {
120 FlagsPage(app) : super('flags', 'flag-list', app); 121 FlagsPage(app) : super('flags', 'flag-list', app);
121 122
122 void _visit(Uri uri) { 123 void _visit(Uri uri) {
123 super._visit(uri); 124 super._visit(uri);
124 app.vm.getFlagList().then((flags) { 125 app.vm.getFlagList().then((flags) {
125 if (element != null) { 126 if (element != null) {
126 FlagListElement serviceElement = element; 127 FlagListElement serviceElement = element;
127 serviceElement.flagList = flags; 128 serviceElement.flagList = flags;
128 } 129 }
129 }).catchError((e) { 130 }).catchError((e, stack) {
130 Logger.root.severe('FlagsPage visit error: $e'); 131 Logger.root.severe('FlagsPage visit error: $e\n$stack');
131 }); 132 });
132 } 133 }
133 } 134 }
134 135
135 class InspectPage extends SimplePage { 136 class InspectPage extends SimplePage {
136 InspectPage(app) : super('inspect', 'service-view', app); 137 InspectPage(app) : super('inspect', 'service-view', app);
137 138
138 void _visit(Uri uri) { 139 void _visit(Uri uri) {
139 super._visit(uri); 140 super._visit(uri);
140 getIsolate(uri).then((isolate) { 141 getIsolate(uri).then((isolate) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 175
175 class DebuggerPage extends SimplePage { 176 class DebuggerPage extends SimplePage {
176 DebuggerPage(app) : super('debugger', 'debugger-page', app); 177 DebuggerPage(app) : super('debugger', 'debugger-page', app);
177 178
178 void _visit(Uri uri) { 179 void _visit(Uri uri) {
179 super._visit(uri); 180 super._visit(uri);
180 getIsolate(uri).then((isolate) { 181 getIsolate(uri).then((isolate) {
181 if (element != null) { 182 if (element != null) {
182 /// Update the page. 183 /// Update the page.
183 DebuggerPageElement page = element; 184 DebuggerPageElement page = element;
185 page.app = app;
184 page.isolate = isolate; 186 page.isolate = isolate;
185 } 187 }
186 }); 188 });
187 } 189 }
188 } 190 }
189 191
190 class CpuProfilerPage extends SimplePage { 192 class CpuProfilerPage extends SimplePage {
191 CpuProfilerPage(app) : super('profiler', 'cpu-profile', app); 193 CpuProfilerPage(app) : super('profiler', 'cpu-profile', app);
192 194
193 void _visit(Uri uri) { 195 void _visit(Uri uri) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 void _visit(Uri uri) { 325 void _visit(Uri uri) {
324 assert(element != null); 326 assert(element != null);
325 assert(canVisit(uri)); 327 assert(canVisit(uri));
326 app.vm.getIsolate(uri.queryParameters['isolateId']).then((i) { 328 app.vm.getIsolate(uri.queryParameters['isolateId']).then((i) {
327 (element as MetricsPageElement).isolate = i; 329 (element as MetricsPageElement).isolate = i;
328 }); 330 });
329 } 331 }
330 332
331 bool canVisit(Uri uri) => uri.path == 'metrics'; 333 bool canVisit(Uri uri) => uri.path == 'metrics';
332 } 334 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/app/application.dart ('k') | runtime/observatory/lib/src/cli/command.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698