| 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 library vm_view_element; | 5 library vm_view_element; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
| 10 import 'package:observatory/src/elements/helpers/nav_bar.dart'; | 10 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 NavRefreshElement.tag, | 27 NavRefreshElement.tag, |
| 28 NavNotifyElement.tag, | 28 NavNotifyElement.tag, |
| 29 ViewFooterElement.tag | 29 ViewFooterElement.tag |
| 30 ]); | 30 ]); |
| 31 | 31 |
| 32 RenderingScheduler<VMViewElement> _r; | 32 RenderingScheduler<VMViewElement> _r; |
| 33 | 33 |
| 34 Stream<RenderedEvent<VMViewElement>> get onRendered => _r.onRendered; | 34 Stream<RenderedEvent<VMViewElement>> get onRendered => _r.onRendered; |
| 35 | 35 |
| 36 M.VM _vm; | 36 M.VM _vm; |
| 37 M.VMRepository _vms; | |
| 38 M.EventRepository _events; | 37 M.EventRepository _events; |
| 39 M.NotificationRepository _notifications; | 38 M.NotificationRepository _notifications; |
| 40 M.IsolateRepository _isolates; | 39 M.IsolateRepository _isolates; |
| 41 M.ScriptRepository _scripts; | 40 M.ScriptRepository _scripts; |
| 42 StreamSubscription _vmSubscription; | 41 StreamSubscription _vmSubscription; |
| 43 StreamSubscription _startSubscription; | 42 StreamSubscription _startSubscription; |
| 44 StreamSubscription _exitSubscription; | 43 StreamSubscription _exitSubscription; |
| 45 | 44 |
| 46 M.VMRef get vm => _vm; | 45 M.VMRef get vm => _vm; |
| 47 M.NotificationRepository get notifications => _notifications; | 46 M.NotificationRepository get notifications => _notifications; |
| 48 | 47 |
| 49 factory VMViewElement( | 48 factory VMViewElement( |
| 50 M.VM vm, | 49 M.VM vm, |
| 51 M.VMRepository vms, | |
| 52 M.EventRepository events, | 50 M.EventRepository events, |
| 53 M.NotificationRepository notifications, | 51 M.NotificationRepository notifications, |
| 54 M.IsolateRepository isolates, | 52 M.IsolateRepository isolates, |
| 55 M.ScriptRepository scripts, | 53 M.ScriptRepository scripts, |
| 56 {RenderingQueue queue}) { | 54 {RenderingQueue queue}) { |
| 57 assert(vm != null); | 55 assert(vm != null); |
| 58 assert(vms != null); | |
| 59 assert(events != null); | 56 assert(events != null); |
| 60 assert(notifications != null); | 57 assert(notifications != null); |
| 61 assert(isolates != null); | |
| 62 assert(scripts != null); | |
| 63 VMViewElement e = document.createElement(tag.name); | 58 VMViewElement e = document.createElement(tag.name); |
| 64 e._r = new RenderingScheduler(e, queue: queue); | 59 e._r = new RenderingScheduler(e, queue: queue); |
| 65 e._vm = vm; | 60 e._vm = vm; |
| 66 e._vms = vms; | |
| 67 e._events = events; | 61 e._events = events; |
| 68 e._notifications = notifications; | 62 e._notifications = notifications; |
| 69 e._isolates = isolates; | 63 e._isolates = isolates; |
| 70 e._scripts = scripts; | 64 e._scripts = scripts; |
| 71 return e; | 65 return e; |
| 72 } | 66 } |
| 73 | 67 |
| 74 VMViewElement.created() : super.created(); | 68 VMViewElement.created() : super.created(); |
| 75 | 69 |
| 76 @override | 70 @override |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 void render() { | 92 void render() { |
| 99 final uptime = new DateTime.now().difference(_vm.startTime); | 93 final uptime = new DateTime.now().difference(_vm.startTime); |
| 100 final isolates = _vm.isolates.toList(); | 94 final isolates = _vm.isolates.toList(); |
| 101 children = [ | 95 children = [ |
| 102 navBar([ | 96 navBar([ |
| 103 new NavTopMenuElement(queue: _r.queue), | 97 new NavTopMenuElement(queue: _r.queue), |
| 104 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 98 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
| 105 new NavRefreshElement(queue: _r.queue) | 99 new NavRefreshElement(queue: _r.queue) |
| 106 ..onRefresh.listen((e) async { | 100 ..onRefresh.listen((e) async { |
| 107 e.element.disabled = true; | 101 e.element.disabled = true; |
| 108 _vm = await _vms.get(_vm); | |
| 109 _r.dirty(); | 102 _r.dirty(); |
| 110 }), | 103 }), |
| 111 new NavNotifyElement(_notifications, queue: _r.queue) | 104 new NavNotifyElement(_notifications, queue: _r.queue) |
| 112 ]), | 105 ]), |
| 113 new DivElement() | 106 new DivElement() |
| 114 ..classes = ['content-centered-big'] | 107 ..classes = ['content-centered-big'] |
| 115 ..children = <HtmlElement>[ | 108 ..children = [ |
| 116 new HeadingElement.h1()..text = 'VM', | 109 new HeadingElement.h1()..text = 'VM', |
| 117 new HRElement(), | 110 new HRElement(), |
| 118 new DivElement() | 111 new DivElement() |
| 119 ..classes = ['memberList'] | 112 ..classes = ['memberList'] |
| 120 ..children = [ | 113 ..children = [ |
| 121 new DivElement() | 114 new DivElement() |
| 122 ..classes = ['memberItem'] | 115 ..classes = ['memberItem'] |
| 123 ..children = [ | 116 ..children = [ |
| 124 new DivElement() | 117 new DivElement() |
| 125 ..classes = ['memberName'] | 118 ..classes = ['memberName'] |
| 126 ..text = 'name', | 119 ..text = 'name', |
| 127 new DivElement() | 120 new DivElement() |
| 128 ..classes = ['memberValue'] | 121 ..classes = ['memberValue'] |
| 129 ..text = _vm.displayName | 122 ..text = _vm.displayName |
| 130 ], | 123 ], |
| 131 new DivElement() | 124 new DivElement() |
| 132 ..classes = ['memberItem'] | 125 ..classes = ['memberItem'] |
| 133 ..children = [ | 126 ..children = [ |
| 134 new DivElement() | 127 new DivElement() |
| 135 ..classes = ['memberName'] | 128 ..classes = ['memberName'] |
| 136 ..text = 'version', | 129 ..text = 'version', |
| 137 new DivElement() | 130 new DivElement() |
| 138 ..classes = ['memberValue'] | 131 ..classes = ['memberValue'] |
| 139 ..text = _vm.version | 132 ..text = _vm.version |
| 140 ], | 133 ], |
| 141 new DivElement() | 134 new DivElement() |
| 142 ..classes = ['memberItem'] | 135 ..classes = ['memberItem'] |
| 143 ..children = [ | 136 ..children = [ |
| 144 new DivElement() | |
| 145 ..classes = ['memberName'] | |
| 146 ..text = 'embedder', | |
| 147 new DivElement() | |
| 148 ..classes = ['memberValue'] | |
| 149 ..text = _vm.embedder ?? "UNKNOWN" | |
| 150 ], | |
| 151 new DivElement() | |
| 152 ..classes = ['memberItem'] | |
| 153 ..children = [ | |
| 154 new DivElement() | 137 new DivElement() |
| 155 ..classes = ['memberName'] | 138 ..classes = ['memberName'] |
| 156 ..text = 'started at', | 139 ..text = 'started at', |
| 157 new DivElement() | 140 new DivElement() |
| 158 ..classes = ['memberValue'] | 141 ..classes = ['memberValue'] |
| 159 ..text = '${_vm.startTime}' | 142 ..text = '${_vm.startTime}' |
| 160 ], | 143 ], |
| 161 new DivElement() | 144 new DivElement() |
| 162 ..classes = ['memberItem'] | 145 ..classes = ['memberItem'] |
| 163 ..children = [ | 146 ..children = [ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 189 ..text = '${_vm.pid}' | 172 ..text = '${_vm.pid}' |
| 190 ], | 173 ], |
| 191 new DivElement() | 174 new DivElement() |
| 192 ..classes = ['memberItem'] | 175 ..classes = ['memberItem'] |
| 193 ..children = [ | 176 ..children = [ |
| 194 new DivElement() | 177 new DivElement() |
| 195 ..classes = ['memberName'] | 178 ..classes = ['memberName'] |
| 196 ..text = 'peak memory', | 179 ..text = 'peak memory', |
| 197 new DivElement() | 180 new DivElement() |
| 198 ..classes = ['memberValue'] | 181 ..classes = ['memberValue'] |
| 199 ..text = _vm.maxRSS != null | 182 ..text = Utils.formatSize(_vm.maxRSS) |
| 200 ? Utils.formatSize(_vm.maxRSS) | |
| 201 : "unavailable" | |
| 202 ], | 183 ], |
| 203 new DivElement() | 184 new DivElement() |
| 204 ..classes = ['memberItem'] | 185 ..classes = ['memberItem'] |
| 205 ..children = [ | |
| 206 new DivElement() | |
| 207 ..classes = ['memberName'] | |
| 208 ..text = 'current memory', | |
| 209 new DivElement() | |
| 210 ..classes = ['memberValue'] | |
| 211 ..text = _vm.currentRSS != null | |
| 212 ? Utils.formatSize(_vm.currentRSS) | |
| 213 : "unavailable" | |
| 214 ], | |
| 215 new DivElement() | |
| 216 ..classes = ['memberItem'] | |
| 217 ..children = [ | 186 ..children = [ |
| 218 new DivElement() | 187 new DivElement() |
| 219 ..classes = ['memberName'] | 188 ..classes = ['memberName'] |
| 220 ..text = 'native zone memory', | 189 ..text = 'native zone memory', |
| 221 new DivElement() | 190 new DivElement() |
| 222 ..classes = ['memberValue'] | 191 ..classes = ['memberValue'] |
| 223 ..text = Utils.formatSize(_vm.nativeZoneMemoryUsage) | 192 ..text = Utils.formatSize(_vm.nativeZoneMemoryUsage) |
| 224 ..title = '${_vm.nativeZoneMemoryUsage} bytes' | 193 ..title = '${_vm.nativeZoneMemoryUsage} bytes' |
| 225 ], | 194 ], |
| 226 new DivElement() | 195 new DivElement() |
| 227 ..classes = ['memberItem'] | 196 ..classes = ['memberItem'] |
| 228 ..children = [ | 197 ..children = [ |
| 229 new DivElement() | 198 new DivElement() |
| 230 ..classes = ['memberName'] | 199 ..classes = ['memberName'] |
| 231 ..text = 'native heap memory', | 200 ..text = 'native heap memory', |
| 232 new DivElement() | 201 new DivElement() |
| 233 ..classes = ['memberValue'] | 202 ..classes = ['memberValue'] |
| 234 ..text = _vm.heapAllocatedMemoryUsage != null | 203 ..text = Utils.formatSize(_vm.heapAllocatedMemoryUsage) |
| 235 ? Utils.formatSize(_vm.heapAllocatedMemoryUsage) | 204 ..title = '${_vm.heapAllocatedMemoryUsage} bytes' |
| 236 : 'unavailable' | |
| 237 ..title = _vm.heapAllocatedMemoryUsage != null | |
| 238 ? '${_vm.heapAllocatedMemoryUsage} bytes' | |
| 239 : null | |
| 240 ], | 205 ], |
| 241 new DivElement() | 206 new DivElement() |
| 242 ..classes = ['memberItem'] | 207 ..classes = ['memberItem'] |
| 243 ..children = [ | 208 ..children = [ |
| 244 new DivElement() | 209 new DivElement() |
| 245 ..classes = ['memberName'] | 210 ..classes = ['memberName'] |
| 246 ..text = 'native heap allocation count', | 211 ..text = 'native heap allocation count', |
| 247 new DivElement() | 212 new DivElement() |
| 248 ..classes = ['memberValue'] | 213 ..classes = ['memberValue'] |
| 249 ..text = _vm.heapAllocationCount != null | 214 ..text = '${_vm.heapAllocationCount}' |
| 250 ? '${_vm.heapAllocationCount}' | |
| 251 : 'unavailable' | |
| 252 ], | 215 ], |
| 253 new BRElement(), | 216 new BRElement(), |
| 254 new DivElement() | 217 new DivElement() |
| 255 ..classes = ['memberItem'] | 218 ..classes = ['memberItem'] |
| 256 ..children = [ | 219 ..children = [ |
| 257 new DivElement() | 220 new DivElement() |
| 258 ..classes = ['memberName'] | 221 ..classes = ['memberName'] |
| 259 ..children = [ | 222 ..children = [ |
| 260 new SpanElement()..text = 'see ', | 223 new SpanElement()..text = 'see ', |
| 261 new AnchorElement(href: Uris.flags())..text = 'flags' | 224 new AnchorElement(href: Uris.flags())..text = 'flags' |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 queue: _r.queue) | 258 queue: _r.queue) |
| 296 ], | 259 ], |
| 297 new HRElement() | 260 new HRElement() |
| 298 ]) | 261 ]) |
| 299 .toList(), | 262 .toList(), |
| 300 new ViewFooterElement(queue: _r.queue) | 263 new ViewFooterElement(queue: _r.queue) |
| 301 ] | 264 ] |
| 302 ]; | 265 ]; |
| 303 } | 266 } |
| 304 } | 267 } |
| OLD | NEW |