| OLD | NEW |
| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 // Add tracing support. | 189 // Add tracing support. |
| 190 _traceView = new Element.tag('trace-view'); | 190 _traceView = new Element.tag('trace-view'); |
| 191 _traceView.tracer = Tracer.current; | 191 _traceView.tracer = Tracer.current; |
| 192 rootElement.children.add(_traceView); | 192 rootElement.children.add(_traceView); |
| 193 | 193 |
| 194 // Remember page. | 194 // Remember page. |
| 195 currentPage = page; | 195 currentPage = page; |
| 196 } | 196 } |
| 197 | 197 |
| 198 ObservatoryApplication.devtools(this.rootElement) : | |
| 199 locationManager = new HashLocationManager(), | |
| 200 targets = null { | |
| 201 vm = new PostMessageVM(); | |
| 202 _initOnce(true); | |
| 203 } | |
| 204 | |
| 205 ObservatoryApplication(this.rootElement) : | 198 ObservatoryApplication(this.rootElement) : |
| 206 locationManager = new HashLocationManager(), | 199 locationManager = new HashLocationManager(), |
| 207 targets = new TargetManager() { | 200 targets = new TargetManager() { |
| 208 vm = new WebSocketVM(targets.defaultTarget); | 201 vm = new WebSocketVM(targets.defaultTarget); |
| 209 _initOnce(false); | 202 _initOnce(false); |
| 210 } | 203 } |
| 211 | 204 |
| 212 void _removeDisconnectEvents() { | 205 void _removeDisconnectEvents() { |
| 213 notifications.removeWhere((oldEvent) { | 206 notifications.removeWhere((oldEvent) { |
| 214 return (oldEvent.eventType == 'VMDisconnected'); | 207 return (oldEvent.eventType == 'VMDisconnected'); |
| 215 }); | 208 }); |
| 216 } | 209 } |
| 217 | 210 |
| 218 _vmConnected(VM vm) { | 211 _vmConnected(VM vm) { |
| 219 if (vm is WebSocketVM) { | 212 if (vm is WebSocketVM) { |
| 220 targets.add(vm.target); | 213 targets.add(vm.target); |
| 221 } | 214 } |
| 222 _removeDisconnectEvents(); | 215 _removeDisconnectEvents(); |
| 223 } | 216 } |
| 224 | 217 |
| 225 _vmDisconnected(VM vm) { | 218 _vmDisconnected(VM vm) { |
| 226 if (this.vm != vm) { | 219 if (this.vm != vm) { |
| 227 // This disconnect event occured *after* a new VM was installed. | 220 // This disconnect event occured *after* a new VM was installed. |
| 228 return; | 221 return; |
| 229 } | 222 } |
| 230 this.vm = null; | 223 this.vm = null; |
| 231 notifications.add(new ServiceEvent.vmDisconencted()); | 224 notifications.add(new ServiceEvent.vmDisconencted()); |
| 232 } | 225 } |
| 233 } | 226 } |
| OLD | NEW |