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

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

Issue 584293002: Begin implementing a debugger page in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 2 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 } 84 }
85 85
86 void _visit(String url) { 86 void _visit(String url) {
87 assert(element != null); 87 assert(element != null);
88 assert(canVisit(url)); 88 assert(canVisit(url));
89 // ClassTree urls are 'class-tree/isolate-id', chop off prefix, leaving 89 // ClassTree urls are 'class-tree/isolate-id', chop off prefix, leaving
90 // isolate url. 90 // isolate url.
91 url = url.substring(_urlPrefix.length); 91 url = url.substring(_urlPrefix.length);
92 /// Request the isolate url. 92 /// Request the isolate url.
93 app.vm.get(url).then((i) { 93 app.vm.get(url).then((isolate) {
94 if (element != null) { 94 if (element != null) {
95 /// Update the page. 95 /// Update the page.
96 ClassTreeElement page = element; 96 ClassTreeElement page = element;
97 page.isolate = i; 97 page.isolate = isolate;
98 } 98 }
99 }).catchError((e) { 99 }).catchError((e) {
100 Logger.root.severe('ClassTreePage visit error: $e'); 100 Logger.root.severe('ClassTreePage visit error: $e');
101 }); 101 });
102 } 102 }
103 103
104 /// Catch all. 104 /// Catch all.
105 bool canVisit(String url) => url.startsWith(_urlPrefix); 105 bool canVisit(String url) => url.startsWith(_urlPrefix);
106 } 106 }
107 107
108 class DebuggerPage extends Page {
109 static const _urlPrefix = 'debugger/';
110
111 DebuggerPage(app) : super(app);
112
113 void onInstall() {
114 if (element == null) {
115 element = new Element.tag('debugger-page');
116 }
117 }
118
119 void _visit(String url) {
120 assert(element != null);
121 assert(canVisit(url));
122 // Debugger urls are 'debugger/isolate-id', chop off prefix, leaving
123 // isolate url.
124 url = url.substring(_urlPrefix.length);
125 /// Request the isolate url.
126 app.vm.get(url).then((isolate) {
127 if (element != null) {
128 /// Update the page.
129 DebuggerPageElement page = element;
130 page.isolate = isolate;
131 }
132 }).catchError((e) {
133 Logger.root.severe('Unexpected debugger error: $e');
134 });
135 }
136
137 /// Catch all.
138 bool canVisit(String url) => url.startsWith(_urlPrefix);
139 }
140
108 class ErrorViewPage extends Page { 141 class ErrorViewPage extends Page {
109 ErrorViewPage(app) : super(app); 142 ErrorViewPage(app) : super(app);
110 143
111 void onInstall() { 144 void onInstall() {
112 if (element == null) { 145 if (element == null) {
113 /// Lazily create page. 146 /// Lazily create page.
114 element = new Element.tag('service-view'); 147 element = new Element.tag('service-view');
115 } 148 }
116 } 149 }
117 150
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void _visit(String url) { 236 void _visit(String url) {
204 assert(element != null); 237 assert(element != null);
205 assert(canVisit(url)); 238 assert(canVisit(url));
206 app.vm.get(_isolateId(url)).then((i) { 239 app.vm.get(_isolateId(url)).then((i) {
207 (element as MetricsPageElement).isolate = i; 240 (element as MetricsPageElement).isolate = i;
208 }); 241 });
209 } 242 }
210 243
211 bool canVisit(String url) => _matcher.hasMatch(url); 244 bool canVisit(String url) => _matcher.hasMatch(url);
212 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698