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

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

Issue 2213613002: Converted observatory flag-list element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Added tests Created 4 years, 4 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
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 class IsolateNotFound implements Exception { 7 class IsolateNotFound implements Exception {
8 String isolateId; 8 String isolateId;
9 IsolateNotFound(this.isolateId); 9 IsolateNotFound(this.isolateId);
10 String toString() => "IsolateNotFound: $isolateId"; 10 String toString() => "IsolateNotFound: $isolateId";
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 (element as GeneralErrorElement).message = "Path '${uri.path}' not found"; 95 (element as GeneralErrorElement).message = "Path '${uri.path}' not found";
96 } 96 }
97 97
98 /// Catch all. 98 /// Catch all.
99 bool canVisit(Uri uri) => true; 99 bool canVisit(Uri uri) => true;
100 } 100 }
101 101
102 /// Top-level vm info page. 102 /// Top-level vm info page.
103 class VMPage extends SimplePage { 103 class VMPage extends SimplePage {
104 VMPage(app) : super('vm', 'service-view', app); 104 VMPage(app) : super('vm', 'vm-view', app);
105 105
106 void _visit(Uri uri) { 106 void _visit(Uri uri) {
107 super._visit(uri); 107 super._visit(uri);
108 app.vm.reload().then((vm) { 108 app.vm.reload().then((vm) {
109 if (element != null) { 109 if (element != null) {
110 ServiceObjectViewElement serviceElement = element; 110 VMViewElement serviceElement = element;
111 serviceElement.object = vm; 111 serviceElement.vm = vm;
112 } 112 }
113 }).catchError((e, stack) { 113 }).catchError((e, stack) {
114 Logger.root.severe('VMPage visit error: $e'); 114 Logger.root.severe('VMPage visit error: $e');
115 // Reroute to vm-connect. 115 // Reroute to vm-connect.
116 app.locationManager.go(app.locationManager.makeLink('/vm-connect')); 116 app.locationManager.go(app.locationManager.makeLink('/vm-connect'));
117 }); 117 });
118 } 118 }
119 } 119 }
120 120
121 class FlagsPage extends SimplePage { 121 class FlagsPage extends SimplePage {
122 FlagsPage(app) : super('flags', 'flag-list', app); 122 FlagsPage(app) : super('flags', 'flag-list', app);
123 123
124 @override
125 onInstall() {
126 element = new FlagListElement(app.vm,
127 app.vm.changes.map((_) => new VMUpdateEventMock(vm: app.vm)),
128 new FlagsRepository(),
129 app.notifications);
130 }
131
124 void _visit(Uri uri) { 132 void _visit(Uri uri) {
125 super._visit(uri); 133 super._visit(uri);
126 app.vm.getFlagList().then((flags) {
127 if (element != null) {
128 FlagListElement serviceElement = element;
129 serviceElement.flagList = flags;
130 }
131 }).catchError((e, stack) {
132 Logger.root.severe('FlagsPage visit error: $e\n$stack');
133 });
134 } 134 }
135 } 135 }
136 136
137 class InspectPage extends SimplePage { 137 class InspectPage extends SimplePage {
138 InspectPage(app) : super('inspect', 'service-view', app); 138 InspectPage(app) : super('inspect', 'service-view', app);
139 139
140 void _visit(Uri uri) { 140 void _visit(Uri uri) {
141 super._visit(uri); 141 super._visit(uri);
142 getIsolate(uri).then((isolate) { 142 getIsolate(uri).then((isolate) {
143 var objectId = uri.queryParameters['objectId']; 143 var objectId = uri.queryParameters['objectId'];
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 assert(element != null); 466 assert(element != null);
467 } 467 }
468 468
469 void _visit(Uri uri) { 469 void _visit(Uri uri) {
470 assert(element != null); 470 assert(element != null);
471 assert(canVisit(uri)); 471 assert(canVisit(uri));
472 } 472 }
473 473
474 bool canVisit(Uri uri) => uri.path == 'timeline'; 474 bool canVisit(Uri uri) => uri.path == 'timeline';
475 } 475 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/repositories.dart ('k') | runtime/observatory/lib/src/elements/css/shared.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698