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 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 5 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
6 // for details. All rights reserved. Use of this source code is governed by a | 6 // for details. All rights reserved. Use of this source code is governed by a |
7 // BSD-style license that can be found in the LICENSE file. | 7 // BSD-style license that can be found in the LICENSE file. |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'dart:html'; | 10 import 'dart:html'; |
11 import 'dart:math' as Math; | 11 import 'dart:math' as Math; |
12 import 'package:observatory/models.dart' as M; | 12 import 'package:observatory/models.dart' as M; |
13 import 'package:observatory/src/elements/class_ref.dart'; | 13 import 'package:observatory/src/elements/class_ref.dart'; |
14 import 'package:observatory/src/elements/containers/virtual_tree.dart'; | 14 import 'package:observatory/src/elements/containers/virtual_tree.dart'; |
15 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 15 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 16 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 17 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
16 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 18 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
17 import 'package:observatory/src/elements/helpers/tag.dart'; | 19 import 'package:observatory/src/elements/helpers/tag.dart'; |
18 import 'package:observatory/src/elements/helpers/uris.dart'; | 20 import 'package:observatory/src/elements/helpers/uris.dart'; |
19 import 'package:observatory/src/elements/nav/bar.dart'; | |
20 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 21 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
21 import 'package:observatory/src/elements/nav/menu.dart'; | |
22 import 'package:observatory/src/elements/nav/notify.dart'; | 22 import 'package:observatory/src/elements/nav/notify.dart'; |
23 import 'package:observatory/src/elements/nav/refresh.dart'; | 23 import 'package:observatory/src/elements/nav/refresh.dart'; |
24 import 'package:observatory/src/elements/nav/top_menu.dart'; | 24 import 'package:observatory/src/elements/nav/top_menu.dart'; |
25 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 25 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
26 import 'package:observatory/utils.dart'; | 26 import 'package:observatory/utils.dart'; |
27 | 27 |
28 enum HeapSnapshotTreeMode { | 28 enum HeapSnapshotTreeMode { |
29 dominatorTree, | 29 dominatorTree, |
30 groupByClass | 30 groupByClass |
31 } | 31 } |
32 | 32 |
33 class HeapSnapshotElement extends HtmlElement implements Renderable { | 33 class HeapSnapshotElement extends HtmlElement implements Renderable { |
34 static const tag = const Tag<HeapSnapshotElement>('heap-snapshot', | 34 static const tag = const Tag<HeapSnapshotElement>('heap-snapshot', |
35 dependencies: const [ | 35 dependencies: const [ |
36 ClassRefElement.tag, | 36 ClassRefElement.tag, |
37 NavBarElement.tag, | |
38 NavTopMenuElement.tag, | 37 NavTopMenuElement.tag, |
39 NavVMMenuElement.tag, | 38 NavVMMenuElement.tag, |
40 NavIsolateMenuElement.tag, | 39 NavIsolateMenuElement.tag, |
41 NavMenuElement.tag, | |
42 NavRefreshElement.tag, | 40 NavRefreshElement.tag, |
43 NavNotifyElement.tag, | 41 NavNotifyElement.tag, |
44 VirtualTreeElement.tag, | 42 VirtualTreeElement.tag, |
45 ]); | 43 ]); |
46 | 44 |
47 RenderingScheduler<HeapSnapshotElement> _r; | 45 RenderingScheduler<HeapSnapshotElement> _r; |
48 | 46 |
49 Stream<RenderedEvent<HeapSnapshotElement>> get onRendered => _r.onRendered; | 47 Stream<RenderedEvent<HeapSnapshotElement>> get onRendered => _r.onRendered; |
50 | 48 |
51 M.VM _vm; | 49 M.VM _vm; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 97 |
100 @override | 98 @override |
101 detached() { | 99 detached() { |
102 super.detached(); | 100 super.detached(); |
103 _r.disable(notify: true); | 101 _r.disable(notify: true); |
104 children = []; | 102 children = []; |
105 } | 103 } |
106 | 104 |
107 void render() { | 105 void render() { |
108 final content = [ | 106 final content = [ |
109 new NavBarElement(queue: _r.queue) | 107 navBar([ |
110 ..children = [ | 108 new NavTopMenuElement(queue: _r.queue), |
111 new NavTopMenuElement(queue: _r.queue), | 109 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
112 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 110 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
113 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 111 navMenu('heap snapshot'), |
114 new NavMenuElement('heap snapshot', link: Uris.heapSnapshot(_isolate), | 112 new NavRefreshElement(queue: _r.queue) |
115 last: true, queue: _r.queue), | 113 ..disabled = M.isHeapSnapshotProgressRunning(_progress?.status) |
116 new NavRefreshElement(queue: _r.queue) | 114 ..onRefresh.listen((e) { |
117 ..disabled = M.isHeapSnapshotProgressRunning(_progress?.status) | 115 _refresh(); |
118 ..onRefresh.listen((e) { | 116 }), |
119 _refresh(); | 117 new NavNotifyElement(_notifications, queue: _r.queue) |
120 }), | 118 ]), |
121 new NavNotifyElement(_notifications, queue: _r.queue) | |
122 ], | |
123 ]; | 119 ]; |
124 if (_progress == null) { | 120 if (_progress == null) { |
125 children = content; | 121 children = content; |
126 return; | 122 return; |
127 } | 123 } |
128 switch (_progress.status) { | 124 switch (_progress.status) { |
129 case M.HeapSnapshotLoadingStatus.fetching : | 125 case M.HeapSnapshotLoadingStatus.fetching : |
130 content.addAll(_createStatusMessage('Fetching snapshot from VM...', | 126 content.addAll(_createStatusMessage('Fetching snapshot from VM...', |
131 description: _progress.stepDescription, | 127 description: _progress.stepDescription, |
132 progress: _progress.progress)); | 128 progress: _progress.progress)); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 selected: _mode == mode) | 404 selected: _mode == mode) |
409 ..text = modeToString(mode); | 405 ..text = modeToString(mode); |
410 }).toList(growable: false) | 406 }).toList(growable: false) |
411 ..onChange.listen((_) { | 407 ..onChange.listen((_) { |
412 _mode = HeapSnapshotTreeMode.values[s.selectedIndex]; | 408 _mode = HeapSnapshotTreeMode.values[s.selectedIndex]; |
413 _r.dirty(); | 409 _r.dirty(); |
414 }) | 410 }) |
415 ]; | 411 ]; |
416 } | 412 } |
417 } | 413 } |
OLD | NEW |