OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 objectpool_view; | 5 library objectpool_view; |
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/context_ref.dart'; | 10 import 'package:observatory/src/elements/context_ref.dart'; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 122 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
123 new NavMenuElement('instance', last: true, queue: _r.queue), | 123 new NavMenuElement('instance', last: true, queue: _r.queue), |
124 new NavRefreshElement(queue: _r.queue) | 124 new NavRefreshElement(queue: _r.queue) |
125 ..onRefresh.listen((e) async { | 125 ..onRefresh.listen((e) async { |
126 e.element.disabled = true; | 126 e.element.disabled = true; |
127 _pool = await _pools.get(_isolate, _pool.id); | 127 _pool = await _pools.get(_isolate, _pool.id); |
128 _r.dirty(); | 128 _r.dirty(); |
129 }), | 129 }), |
130 new NavNotifyElement(_notifications, queue: _r.queue) | 130 new NavNotifyElement(_notifications, queue: _r.queue) |
131 ], | 131 ], |
132 new DivElement()..classes = const ['content-centered-big'] | 132 new DivElement()..classes = ['content-centered-big'] |
133 ..children = [ | 133 ..children = [ |
134 new HeadingElement.h2()..text = 'Object Pool', | 134 new HeadingElement.h2()..text = 'Object Pool', |
135 new HRElement(), | 135 new HRElement(), |
136 new ObjectCommonElement(_isolate, _pool, _retainedSizes, | 136 new ObjectCommonElement(_isolate, _pool, _retainedSizes, |
137 _reachableSizes, _references, _retainingPaths, | 137 _reachableSizes, _references, _retainingPaths, |
138 _instances, queue: _r.queue), | 138 _instances, queue: _r.queue), |
139 new HRElement(), | 139 new HRElement(), |
140 new HeadingElement.h3()..text = 'entries (${_pool.entries.length})', | 140 new HeadingElement.h3()..text = 'entries (${_pool.entries.length})', |
141 new DivElement()..classes = const ['memberList'] | 141 new DivElement()..classes = ['memberList'] |
142 ..children = _pool.entries.map((entry) | 142 ..children = _pool.entries.map((entry) |
143 => new DivElement()..classes = const ['memberItem'] | 143 => new DivElement()..classes = ['memberItem'] |
144 ..children = [ | 144 ..children = [ |
145 new DivElement()..classes = const ['memberName', | 145 new DivElement()..classes = ['memberName', |
146 'hexadecimal'] | 146 'hexadecimal'] |
147 ..text = '[PP+0x${entry.offset.toRadixString(16)}]', | 147 ..text = '[PP+0x${entry.offset.toRadixString(16)}]', |
148 new DivElement()..classes = const ['memberName'] | 148 new DivElement()..classes = ['memberName'] |
149 ..children = _createEntry(entry) | 149 ..children = _createEntry(entry) |
150 ]).toList(), | 150 ]).toList(), |
151 new HRElement(), | 151 new HRElement(), |
152 new ViewFooterElement(queue: _r.queue) | 152 new ViewFooterElement(queue: _r.queue) |
153 ] | 153 ] |
154 ]; | 154 ]; |
155 } | 155 } |
156 | 156 |
157 List<Element> _createEntry(M.ObjectPoolEntry entry) { | 157 List<Element> _createEntry(M.ObjectPoolEntry entry) { |
158 switch (entry.kind) { | 158 switch (entry.kind) { |
159 case M.ObjectPoolEntryKind.object: | 159 case M.ObjectPoolEntryKind.object: |
160 return [ | 160 return [ |
161 anyRef(_isolate, entry.asObject, _instances, queue: _r.queue) | 161 anyRef(_isolate, entry.asObject, _instances, queue: _r.queue) |
162 ]; | 162 ]; |
163 case M.ObjectPoolEntryKind.immediate: | 163 case M.ObjectPoolEntryKind.immediate: |
164 return [ | 164 return [ |
165 new SpanElement() | 165 new SpanElement() |
166 ..text = 'Immediate 0x${entry.asInteger.toRadixString(16)}' | 166 ..text = 'Immediate 0x${entry.asInteger.toRadixString(16)}' |
167 ]; | 167 ]; |
168 case M.ObjectPoolEntryKind.nativeEntry: | 168 case M.ObjectPoolEntryKind.nativeEntry: |
169 return [ | 169 return [ |
170 new SpanElement() | 170 new SpanElement() |
171 ..text = 'NativeEntry 0x${entry.asInteger.toRadixString(16)}' | 171 ..text = 'NativeEntry 0x${entry.asInteger.toRadixString(16)}' |
172 ]; | 172 ]; |
173 } | 173 } |
174 throw new Exception('Unkown ObjectPoolEntryKind (${entry.kind})'); | 174 throw new Exception('Unkown ObjectPoolEntryKind (${entry.kind})'); |
175 } | 175 } |
176 } | 176 } |
OLD | NEW |