| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 break; | 96 break; |
| 97 | 97 |
| 98 default: | 98 default: |
| 99 // Ignore unrecognized events. | 99 // Ignore unrecognized events. |
| 100 Logger.root.severe('Unrecognized event: $event'); | 100 Logger.root.severe('Unrecognized event: $event'); |
| 101 break; | 101 break; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 void _registerPages() { | 105 void _registerPages() { |
| 106 _pageRegistry.add(new VMPage(this)); |
| 107 _pageRegistry.add(new FlagsPage(this)); |
| 108 _pageRegistry.add(new InspectPage(this)); |
| 106 _pageRegistry.add(new ClassTreePage(this)); | 109 _pageRegistry.add(new ClassTreePage(this)); |
| 107 _pageRegistry.add(new DebuggerPage(this)); | 110 _pageRegistry.add(new DebuggerPage(this)); |
| 108 _pageRegistry.add(new CpuProfilerPage(this)); | 111 _pageRegistry.add(new CpuProfilerPage(this)); |
| 109 _pageRegistry.add(new AllocationProfilerPage(this)); | 112 _pageRegistry.add(new AllocationProfilerPage(this)); |
| 110 _pageRegistry.add(new HeapMapPage(this)); | 113 _pageRegistry.add(new HeapMapPage(this)); |
| 111 _pageRegistry.add(new VMConnectPage(this)); | 114 _pageRegistry.add(new VMConnectPage(this)); |
| 112 _pageRegistry.add(new ErrorViewPage(this)); | 115 _pageRegistry.add(new ErrorViewPage(this)); |
| 113 _pageRegistry.add(new MetricsPage(this)); | 116 _pageRegistry.add(new MetricsPage(this)); |
| 114 // Note that ServiceObjectPage must be the last entry in the list as it is | 117 // Note that ErrorPage must be the last entry in the list as it is |
| 115 // the catch all. | 118 // the catch all. |
| 116 _pageRegistry.add(new ServiceObjectPage(this)); | 119 _pageRegistry.add(new ErrorPage(this)); |
| 117 } | 120 } |
| 118 | 121 |
| 119 void _onError(ServiceError error) { | 122 void _onError(ServiceError error) { |
| 120 lastErrorOrException = error; | 123 lastErrorOrException = error; |
| 121 _visit('error/', null); | 124 _visit('error/', null); |
| 122 } | 125 } |
| 123 | 126 |
| 124 void _onException(ServiceException exception) { | 127 void _onException(ServiceException exception) { |
| 125 lastErrorOrException = exception; | 128 lastErrorOrException = exception; |
| 126 if (exception.kind == 'NetworkException') { | 129 if (exception.kind == 'NetworkException') { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 146 } else if (traceArg == 'off') { | 149 } else if (traceArg == 'off') { |
| 147 Tracer.stop(); | 150 Tracer.stop(); |
| 148 } | 151 } |
| 149 } | 152 } |
| 150 if (Tracer.current != null) { | 153 if (Tracer.current != null) { |
| 151 Tracer.current.reset(); | 154 Tracer.current.reset(); |
| 152 } | 155 } |
| 153 if (_traceView != null) { | 156 if (_traceView != null) { |
| 154 _traceView.tracer = Tracer.current; | 157 _traceView.tracer = Tracer.current; |
| 155 } | 158 } |
| 159 Uri uri = Uri.parse(url); |
| 156 for (var i = 0; i < _pageRegistry.length; i++) { | 160 for (var i = 0; i < _pageRegistry.length; i++) { |
| 157 var page = _pageRegistry[i]; | 161 var page = _pageRegistry[i]; |
| 158 if (page.canVisit(url)) { | 162 if (page.canVisit(uri)) { |
| 159 _installPage(page); | 163 _installPage(page); |
| 160 page.visit(url, argsMap); | 164 page.visit(uri, argsMap); |
| 161 return; | 165 return; |
| 162 } | 166 } |
| 163 } | 167 } |
| 164 throw new FallThroughError(); | 168 throw new FallThroughError(); |
| 165 } | 169 } |
| 166 | 170 |
| 167 /// Set the Observatory application page. | 171 /// Set the Observatory application page. |
| 168 void _installPage(Page page) { | 172 void _installPage(Page page) { |
| 169 assert(page != null); | 173 assert(page != null); |
| 170 if (currentPage == page) { | 174 if (currentPage == page) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 221 |
| 218 _vmDisconnected(VM vm) { | 222 _vmDisconnected(VM vm) { |
| 219 if (this.vm != vm) { | 223 if (this.vm != vm) { |
| 220 // This disconnect event occured *after* a new VM was installed. | 224 // This disconnect event occured *after* a new VM was installed. |
| 221 return; | 225 return; |
| 222 } | 226 } |
| 223 this.vm = null; | 227 this.vm = null; |
| 224 notifications.add(new ServiceEvent.vmDisconencted()); | 228 notifications.add(new ServiceEvent.vmDisconencted()); |
| 225 } | 229 } |
| 226 } | 230 } |
| OLD | NEW |