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 cpu_profile_element; | 5 library cpu_profile_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/cpu_profile/virtual_tree.dart'; | 10 import 'package:observatory/src/elements/cpu_profile/virtual_tree.dart'; |
| 11 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 12 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
12 import 'package:observatory/src/elements/helpers/tag.dart'; | 14 import 'package:observatory/src/elements/helpers/tag.dart'; |
13 import 'package:observatory/src/elements/helpers/uris.dart'; | 15 import 'package:observatory/src/elements/helpers/uris.dart'; |
14 import 'package:observatory/src/elements/nav/bar.dart'; | |
15 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 16 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
16 import 'package:observatory/src/elements/nav/menu.dart'; | |
17 import 'package:observatory/src/elements/nav/notify.dart'; | 17 import 'package:observatory/src/elements/nav/notify.dart'; |
18 import 'package:observatory/src/elements/nav/refresh.dart'; | 18 import 'package:observatory/src/elements/nav/refresh.dart'; |
19 import 'package:observatory/src/elements/nav/top_menu.dart'; | 19 import 'package:observatory/src/elements/nav/top_menu.dart'; |
20 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 20 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
21 import 'package:observatory/src/elements/sample_buffer_control.dart'; | 21 import 'package:observatory/src/elements/sample_buffer_control.dart'; |
22 import 'package:observatory/src/elements/stack_trace_tree_config.dart'; | 22 import 'package:observatory/src/elements/stack_trace_tree_config.dart'; |
23 | 23 |
24 class CpuProfileElement extends HtmlElement implements Renderable { | 24 class CpuProfileElement extends HtmlElement implements Renderable { |
25 static const tag = const Tag<CpuProfileElement>('cpu-profile', | 25 static const tag = const Tag<CpuProfileElement>('cpu-profile', |
26 dependencies: const [ | 26 dependencies: const [ |
27 NavBarElement.tag, | |
28 NavTopMenuElement.tag, | 27 NavTopMenuElement.tag, |
29 NavVMMenuElement.tag, | 28 NavVMMenuElement.tag, |
30 NavIsolateMenuElement.tag, | 29 NavIsolateMenuElement.tag, |
31 NavMenuElement.tag, | |
32 NavRefreshElement.tag, | 30 NavRefreshElement.tag, |
33 NavNotifyElement.tag, | 31 NavNotifyElement.tag, |
34 SampleBufferControlElement.tag, | 32 SampleBufferControlElement.tag, |
35 StackTraceTreeConfigElement.tag, | 33 StackTraceTreeConfigElement.tag, |
36 CpuProfileVirtualTreeElement.tag, | 34 CpuProfileVirtualTreeElement.tag, |
37 ]); | 35 ]); |
38 | 36 |
39 RenderingScheduler<CpuProfileElement> _r; | 37 RenderingScheduler<CpuProfileElement> _r; |
40 | 38 |
41 Stream<RenderedEvent<CpuProfileElement>> get onRendered => _r.onRendered; | 39 Stream<RenderedEvent<CpuProfileElement>> get onRendered => _r.onRendered; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 87 |
90 @override | 88 @override |
91 detached() { | 89 detached() { |
92 super.detached(); | 90 super.detached(); |
93 _r.disable(notify: true); | 91 _r.disable(notify: true); |
94 children = []; | 92 children = []; |
95 } | 93 } |
96 | 94 |
97 void render() { | 95 void render() { |
98 var content = [ | 96 var content = [ |
99 new NavBarElement(queue: _r.queue) | 97 navBar([ |
100 ..children = [ | 98 new NavTopMenuElement(queue: _r.queue), |
101 new NavTopMenuElement(queue: _r.queue), | 99 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
102 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 100 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
103 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 101 navMenu('cpu profile', link: Uris.cpuProfiler(_isolate)), |
104 new NavMenuElement('cpu profile', link: Uris.cpuProfiler(_isolate), | 102 new NavRefreshElement(queue: _r.queue) |
105 last: true, queue: _r.queue), | 103 ..onRefresh.listen(_refresh), |
106 new NavRefreshElement(queue: _r.queue) | 104 new NavRefreshElement(label: 'Clear', queue: _r.queue) |
107 ..onRefresh.listen(_refresh), | 105 ..onRefresh.listen(_clearCpuProfile), |
108 new NavRefreshElement(label: 'Clear', queue: _r.queue) | 106 new NavNotifyElement(_notifications, queue: _r.queue) |
109 ..onRefresh.listen(_clearCpuProfile), | 107 ]), |
110 new NavNotifyElement(_notifications, queue: _r.queue) | |
111 ], | |
112 ]; | 108 ]; |
113 if (_progress == null) { | 109 if (_progress == null) { |
114 children = content; | 110 children = content; |
115 return; | 111 return; |
116 } | 112 } |
117 content.add(new SampleBufferControlElement(_progress, _progressStream, | 113 content.add(new SampleBufferControlElement(_progress, _progressStream, |
118 selectedTag: _tag, queue: _r.queue) | 114 selectedTag: _tag, queue: _r.queue) |
119 ..onTagChange.listen((e) { | 115 ..onTagChange.listen((e) { |
120 _tag = e.element.selectedTag; | 116 _tag = e.element.selectedTag; |
121 _request(); | 117 _request(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 await _request(clear: true); | 160 await _request(clear: true); |
165 e.element.disabled = false; | 161 e.element.disabled = false; |
166 } | 162 } |
167 | 163 |
168 Future _refresh(e) async { | 164 Future _refresh(e) async { |
169 e.element.disabled = true; | 165 e.element.disabled = true; |
170 await _request(forceFetch: true); | 166 await _request(forceFetch: true); |
171 e.element.disabled = false; | 167 e.element.disabled = false; |
172 } | 168 } |
173 } | 169 } |
OLD | NEW |