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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/app/application.dart

Issue 429293002: Add request tracing to Observatory: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// The observatory application. Instances of this are created and owned 7 /// The observatory application. Instances of this are created and owned
8 /// by the observatory_application custom element. 8 /// by the observatory_application custom element.
9 class ObservatoryApplication extends Observable { 9 class ObservatoryApplication extends Observable {
10 static ObservatoryApplication app; 10 static ObservatoryApplication app;
(...skipping 16 matching lines...) Expand all
27 Logger.root.info('Registering new VM callbacks'); 27 Logger.root.info('Registering new VM callbacks');
28 vm.onConnect.then(_vmConnected); 28 vm.onConnect.then(_vmConnected);
29 vm.onDisconnect.then(_vmDisconnected); 29 vm.onDisconnect.then(_vmDisconnected);
30 vm.errors.stream.listen(_onError); 30 vm.errors.stream.listen(_onError);
31 vm.events.stream.listen(_onEvent); 31 vm.events.stream.listen(_onEvent);
32 vm.exceptions.stream.listen(_onException); 32 vm.exceptions.stream.listen(_onException);
33 } 33 }
34 _vm = vm; 34 _vm = vm;
35 } 35 }
36 final TargetManager targets; 36 final TargetManager targets;
37 @observable Isolate isolate;
38 @reflectable final ObservatoryApplicationElement rootElement; 37 @reflectable final ObservatoryApplicationElement rootElement;
39 38
39 TraceViewElement _traceView = null;
40
40 @reflectable ServiceObject lastErrorOrException; 41 @reflectable ServiceObject lastErrorOrException;
41 @observable ObservableList<ServiceEvent> notifications = 42 @observable ObservableList<ServiceEvent> notifications =
42 new ObservableList<ServiceEvent>(); 43 new ObservableList<ServiceEvent>();
43 44
44 void _initOnce(bool chromium) { 45 void _initOnce(bool chromium) {
45 assert(app == null); 46 assert(app == null);
46 app = this; 47 app = this;
47 _registerPages(); 48 _registerPages();
48 locationManager._init(this); 49 locationManager._init(this);
49 } 50 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 119 }
119 } 120 }
120 121
121 void _visit(String url, String args) { 122 void _visit(String url, String args) {
122 var argsMap; 123 var argsMap;
123 if (args == null) { 124 if (args == null) {
124 argsMap = {}; 125 argsMap = {};
125 } else { 126 } else {
126 argsMap = Uri.splitQueryString(args); 127 argsMap = Uri.splitQueryString(args);
127 } 128 }
129 if (argsMap['trace'] != null) {
130 var traceArg = argsMap['trace'];
131 if (traceArg == 'on') {
132 Tracer.start();
133 } else if (traceArg == 'off') {
134 Tracer.stop();
135 }
136 }
137 if (Tracer.current != null) {
138 Tracer.current.reset();
139 }
140 if (_traceView != null) {
141 _traceView.tracer = Tracer.current;
142 }
128 for (var i = 0; i < _pageRegistry.length; i++) { 143 for (var i = 0; i < _pageRegistry.length; i++) {
129 var page = _pageRegistry[i]; 144 var page = _pageRegistry[i];
130 if (page.canVisit(url)) { 145 if (page.canVisit(url)) {
131 _installPage(page); 146 _installPage(page);
132 page.visit(url, argsMap); 147 page.visit(url, argsMap);
133 return; 148 return;
134 } 149 }
135 } 150 }
136 throw new FallThroughError(); 151 throw new FallThroughError();
137 } 152 }
(...skipping 12 matching lines...) Expand all
150 rootElement.children.clear(); 165 rootElement.children.clear();
151 } 166 }
152 Logger.root.info('Installing page: $page'); 167 Logger.root.info('Installing page: $page');
153 try { 168 try {
154 page.onInstall(); 169 page.onInstall();
155 } catch (e) { 170 } catch (e) {
156 Logger.root.severe('Failed to install page: $e'); 171 Logger.root.severe('Failed to install page: $e');
157 } 172 }
158 // Add new page. 173 // Add new page.
159 rootElement.children.add(page.element); 174 rootElement.children.add(page.element);
175
176 // Add tracing support.
177 print("ADDING TraceView");
Cutch 2014/07/30 18:20:46 remove (or turn into log call) before commit
turnidge 2014/07/30 19:28:15 Removed.
178 _traceView = new Element.tag('trace-view');
179 _traceView.tracer = Tracer.current;
180 rootElement.children.add(_traceView);
181
160 // Remember page. 182 // Remember page.
161 currentPage = page; 183 currentPage = page;
162 } 184 }
163 185
164 ObservatoryApplication.devtools(this.rootElement) : 186 ObservatoryApplication.devtools(this.rootElement) :
165 locationManager = new HashLocationManager(), 187 locationManager = new HashLocationManager(),
166 targets = null { 188 targets = null {
167 vm = new PostMessageVM(); 189 vm = new PostMessageVM();
168 _initOnce(true); 190 _initOnce(true);
169 } 191 }
(...skipping 13 matching lines...) Expand all
183 205
184 _vmDisconnected(VM vm) { 206 _vmDisconnected(VM vm) {
185 if (this.vm != vm) { 207 if (this.vm != vm) {
186 // This disconnect event occured *after* a new VM was installed. 208 // This disconnect event occured *after* a new VM was installed.
187 return; 209 return;
188 } 210 }
189 this.vm = null; 211 this.vm = null;
190 locationManager.go(locationManager.makeLink('/vm-connect/')); 212 locationManager.go(locationManager.makeLink('/vm-connect/'));
191 } 213 }
192 } 214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698