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 code_view_element; | 5 library code_view_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:observatory/cpu_profile.dart'; | 9 import 'package:observatory/cpu_profile.dart'; |
10 import 'package:observatory/service.dart' as S; | 10 import 'package:observatory/service.dart' as S; |
11 import 'package:observatory/models.dart' as M; | 11 import 'package:observatory/models.dart' as M; |
12 import 'package:observatory/app.dart' | 12 import 'package:observatory/app.dart' |
13 show SortedTable, SortedTableColumn, SortedTableRow; | 13 show SortedTable, SortedTableColumn, SortedTableRow; |
14 import 'package:observatory/src/elements/curly_block.dart'; | 14 import 'package:observatory/src/elements/curly_block.dart'; |
15 import 'package:observatory/src/elements/function_ref.dart'; | 15 import 'package:observatory/src/elements/function_ref.dart'; |
16 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 16 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 17 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 18 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
17 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 19 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
18 import 'package:observatory/src/elements/helpers/tag.dart'; | 20 import 'package:observatory/src/elements/helpers/tag.dart'; |
19 import 'package:observatory/src/elements/nav/bar.dart'; | |
20 import 'package:observatory/src/elements/nav/class_menu.dart'; | 21 import 'package:observatory/src/elements/nav/class_menu.dart'; |
21 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 22 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
22 import 'package:observatory/src/elements/nav/menu.dart'; | |
23 import 'package:observatory/src/elements/nav/notify.dart'; | 23 import 'package:observatory/src/elements/nav/notify.dart'; |
24 import 'package:observatory/src/elements/nav/refresh.dart'; | 24 import 'package:observatory/src/elements/nav/refresh.dart'; |
25 import 'package:observatory/src/elements/nav/top_menu.dart'; | 25 import 'package:observatory/src/elements/nav/top_menu.dart'; |
26 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 26 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
27 import 'package:observatory/src/elements/object_common.dart'; | 27 import 'package:observatory/src/elements/object_common.dart'; |
28 import 'package:observatory/src/elements/objectpool_ref.dart'; | 28 import 'package:observatory/src/elements/objectpool_ref.dart'; |
29 import 'package:observatory/utils.dart'; | 29 import 'package:observatory/utils.dart'; |
30 | 30 |
31 class DisassemblyTable extends SortedTable { | 31 class DisassemblyTable extends SortedTable { |
32 DisassemblyTable(columns) : super(columns); | 32 DisassemblyTable(columns) : super(columns); |
33 } | 33 } |
34 | 34 |
35 class InlineTable extends SortedTable { | 35 class InlineTable extends SortedTable { |
36 InlineTable(columns) : super(columns); | 36 InlineTable(columns) : super(columns); |
37 } | 37 } |
38 | 38 |
39 class CodeViewElement extends HtmlElement implements Renderable { | 39 class CodeViewElement extends HtmlElement implements Renderable { |
40 static const tag = const Tag<CodeViewElement>('code-view', | 40 static const tag = const Tag<CodeViewElement>('code-view', |
41 dependencies: const [ | 41 dependencies: const [ |
42 CurlyBlockElement.tag, | 42 CurlyBlockElement.tag, |
43 FunctionRefElement.tag, | 43 FunctionRefElement.tag, |
44 NavBarElement.tag, | |
45 NavClassMenuElement.tag, | 44 NavClassMenuElement.tag, |
46 NavTopMenuElement.tag, | 45 NavTopMenuElement.tag, |
47 NavVMMenuElement.tag, | 46 NavVMMenuElement.tag, |
48 NavIsolateMenuElement.tag, | 47 NavIsolateMenuElement.tag, |
49 NavMenuElement.tag, | |
50 NavRefreshElement.tag, | 48 NavRefreshElement.tag, |
51 NavNotifyElement.tag, | 49 NavNotifyElement.tag, |
52 ObjectCommonElement.tag, | 50 ObjectCommonElement.tag, |
53 ObjectPoolRefElement.tag, | 51 ObjectPoolRefElement.tag, |
54 ]); | 52 ]); |
55 | 53 |
56 RenderingScheduler<CodeViewElement> _r; | 54 RenderingScheduler<CodeViewElement> _r; |
57 | 55 |
58 Stream<RenderedEvent<CodeViewElement>> get onRendered => _r.onRendered; | 56 Stream<RenderedEvent<CodeViewElement>> get onRendered => _r.onRendered; |
59 | 57 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 document.createElement('th')..classes = ['object'] | 185 document.createElement('th')..classes = ['object'] |
188 ..text = 'Object', | 186 ..text = 'Object', |
189 ] | 187 ] |
190 ]; | 188 ]; |
191 _disassemblyTableBody = _disassemblyTable.createTBody(); | 189 _disassemblyTableBody = _disassemblyTable.createTBody(); |
192 _disassemblyTableBody.classes = ['monospace']; | 190 _disassemblyTableBody.classes = ['monospace']; |
193 } | 191 } |
194 final inlinedFunctions = _code.inlinedFunctions.toList(); | 192 final inlinedFunctions = _code.inlinedFunctions.toList(); |
195 final S.Code code = _code as S.Code; | 193 final S.Code code = _code as S.Code; |
196 children = [ | 194 children = [ |
197 new NavBarElement(queue: _r.queue) | 195 navBar([ |
198 ..children = [ | 196 new NavTopMenuElement(queue: _r.queue), |
199 new NavTopMenuElement(queue: _r.queue), | 197 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
200 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 198 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
201 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 199 navMenu(_code.name), |
202 new NavMenuElement(_code.name, last: true, queue: _r.queue), | 200 new NavRefreshElement(queue: _r.queue) |
203 new NavRefreshElement(queue: _r.queue) | 201 ..onRefresh.listen((e) async { |
204 ..onRefresh.listen((e) async { | 202 e.element.disabled = true; |
205 e.element.disabled = true; | 203 _refresh(); |
206 _refresh(); | 204 }), |
207 }), | 205 new NavRefreshElement(label: 'refresh ticks', queue: _r.queue) |
208 new NavRefreshElement(label: 'refresh ticks', queue: _r.queue) | 206 ..onRefresh.listen((e) async { |
209 ..onRefresh.listen((e) async { | 207 e.element.disabled = true; |
210 e.element.disabled = true; | 208 _refreshTicks(); |
211 _refreshTicks(); | 209 }), |
212 }), | 210 new NavNotifyElement(_notifications, queue: _r.queue) |
213 new NavNotifyElement(_notifications, queue: _r.queue) | 211 ]), |
214 ], | |
215 new DivElement()..classes = ['content-centered-big'] | 212 new DivElement()..classes = ['content-centered-big'] |
216 ..children = [ | 213 ..children = [ |
217 new HeadingElement.h1() | 214 new HeadingElement.h1() |
218 ..text = (M.isDartCode(_code.kind) && _code.isOptimized) | 215 ..text = (M.isDartCode(_code.kind) && _code.isOptimized) |
219 ? 'Optimized code for ${_code.name}' | 216 ? 'Optimized code for ${_code.name}' |
220 : 'Code for ${_code.name}', | 217 : 'Code for ${_code.name}', |
221 new HRElement(), | 218 new HRElement(), |
222 new ObjectCommonElement(_isolate, _code, _retainedSizes, | 219 new ObjectCommonElement(_isolate, _code, _retainedSizes, |
223 _reachableSizes, _references, _retainingPaths, | 220 _reachableSizes, _references, _retainingPaths, |
224 _instances, queue: _r.queue), | 221 _instances, queue: _r.queue), |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 ..children = inlinedFunctions.isNotEmpty | 280 ..children = inlinedFunctions.isNotEmpty |
284 ? const [] | 281 ? const [] |
285 : [ | 282 : [ |
286 new DivElement()..classes = ['memberName'] | 283 new DivElement()..classes = ['memberName'] |
287 ..text = 'inlined functions (${inlinedFunctions.length})', | 284 ..text = 'inlined functions (${inlinedFunctions.length})', |
288 new DivElement()..classes = ['memberValue'] | 285 new DivElement()..classes = ['memberValue'] |
289 ..children = [ | 286 ..children = [ |
290 new CurlyBlockElement( | 287 new CurlyBlockElement( |
291 expanded: inlinedFunctions.length < 8, | 288 expanded: inlinedFunctions.length < 8, |
292 queue: _r.queue) | 289 queue: _r.queue) |
293 ..children = inlinedFunctions.map((f) => | 290 ..content = inlinedFunctions.map((f) => |
294 new FunctionRefElement(_isolate, f, queue: _r.queue) | 291 new FunctionRefElement(_isolate, f, queue: _r.queue) |
295 ).toList() | 292 ).toList() |
296 ] | 293 ] |
297 ] | 294 ] |
298 ], | 295 ], |
299 new HRElement(), | 296 new HRElement(), |
300 _inlineRangeTable, | 297 _inlineRangeTable, |
301 new HRElement(), | 298 new HRElement(), |
302 _disassemblyTable | 299 _disassemblyTable |
303 ], | 300 ], |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 switch (kind) { | 601 switch (kind) { |
605 case M.CodeKind.dart: return 'dart'; | 602 case M.CodeKind.dart: return 'dart'; |
606 case M.CodeKind.native: return 'native'; | 603 case M.CodeKind.native: return 'native'; |
607 case M.CodeKind.stub: return 'stub'; | 604 case M.CodeKind.stub: return 'stub'; |
608 case M.CodeKind.tag: return 'tag'; | 605 case M.CodeKind.tag: return 'tag'; |
609 case M.CodeKind.collected: return 'collected'; | 606 case M.CodeKind.collected: return 'collected'; |
610 } | 607 } |
611 throw new Exception('Unkown CodeKind ($kind)'); | 608 throw new Exception('Unkown CodeKind ($kind)'); |
612 } | 609 } |
613 } | 610 } |
OLD | NEW |