OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// This page is not directly reachable from the main Observatory ui. | 5 /// This page is not directly reachable from the main Observatory ui. |
6 /// It is mainly mented to be used from editors as an integrated tool. | 6 /// It is mainly mented to be used from editors as an integrated tool. |
7 /// | 7 /// |
8 /// This page mainly targeting developers and not VM experts, so concepts like | 8 /// This page mainly targeting developers and not VM experts, so concepts like |
9 /// old and new heap are abstracted away. | 9 /// old and new heap are abstracted away. |
10 /// | 10 /// |
(...skipping 23 matching lines...) Expand all Loading... |
34 NavNotifyElement.tag, | 34 NavNotifyElement.tag, |
35 MemoryGraphElement.tag, | 35 MemoryGraphElement.tag, |
36 MemoryProfileElement.tag | 36 MemoryProfileElement.tag |
37 ]); | 37 ]); |
38 | 38 |
39 RenderingScheduler<MemoryDashboardElement> _r; | 39 RenderingScheduler<MemoryDashboardElement> _r; |
40 | 40 |
41 Stream<RenderedEvent<MemoryDashboardElement>> get onRendered => _r.onRendered; | 41 Stream<RenderedEvent<MemoryDashboardElement>> get onRendered => _r.onRendered; |
42 | 42 |
43 M.VMRef _vm; | 43 M.VMRef _vm; |
44 M.VMRepository _vms; | |
45 M.IsolateRepository _isolates; | 44 M.IsolateRepository _isolates; |
46 M.EditorRepository _editor; | 45 M.EditorRepository _editor; |
47 M.AllocationProfileRepository _allocations; | 46 M.AllocationProfileRepository _allocations; |
48 M.EventRepository _events; | 47 M.EventRepository _events; |
49 M.NotificationRepository _notifications; | 48 M.NotificationRepository _notifications; |
50 | 49 |
51 M.VMRef get vm => _vm; | 50 M.VM get vm => _vm; |
52 M.NotificationRepository get notifications => _notifications; | 51 M.NotificationRepository get notifications => _notifications; |
53 | 52 |
54 factory MemoryDashboardElement( | 53 factory MemoryDashboardElement( |
55 M.VMRef vm, | 54 M.VM vm, |
56 M.VMRepository vms, | |
57 M.IsolateRepository isolates, | 55 M.IsolateRepository isolates, |
58 M.EditorRepository editor, | 56 M.EditorRepository editor, |
59 M.AllocationProfileRepository allocations, | 57 M.AllocationProfileRepository allocations, |
60 M.EventRepository events, | 58 M.EventRepository events, |
61 M.NotificationRepository notifications, | 59 M.NotificationRepository notifications, |
62 {RenderingQueue queue}) { | 60 {RenderingQueue queue}) { |
63 assert(vm != null); | 61 assert(vm != null); |
64 assert(vms != null); | |
65 assert(isolates != null); | 62 assert(isolates != null); |
66 assert(editor != null); | 63 assert(editor != null); |
67 assert(allocations != null); | 64 assert(allocations != null); |
68 assert(events != null); | 65 assert(events != null); |
69 assert(notifications != null); | 66 assert(notifications != null); |
70 MemoryDashboardElement e = document.createElement(tag.name); | 67 MemoryDashboardElement e = document.createElement(tag.name); |
71 e._r = new RenderingScheduler(e, queue: queue); | 68 e._r = new RenderingScheduler(e, queue: queue); |
72 e._vm = vm; | 69 e._vm = vm; |
73 e._vms = vms; | |
74 e._isolates = isolates; | 70 e._isolates = isolates; |
75 e._editor = editor; | 71 e._editor = editor; |
76 e._allocations = allocations; | 72 e._allocations = allocations; |
77 e._events = events; | 73 e._events = events; |
78 e._notifications = notifications; | 74 e._notifications = notifications; |
79 return e; | 75 return e; |
80 } | 76 } |
81 | 77 |
82 MemoryDashboardElement.created() : super.created(); | 78 MemoryDashboardElement.created() : super.created(); |
83 | 79 |
84 @override | 80 @override |
85 attached() { | 81 attached() { |
86 super.attached(); | 82 super.attached(); |
87 _r.enable(); | 83 _r.enable(); |
88 } | 84 } |
89 | 85 |
90 @override | 86 @override |
91 detached() { | 87 detached() { |
92 super.detached(); | 88 super.detached(); |
93 _r.disable(notify: true); | 89 _r.disable(notify: true); |
94 children = []; | 90 children = []; |
95 } | 91 } |
96 | 92 |
97 M.IsolateRef _isolate; | 93 M.IsolateRef _isolate; |
98 | 94 |
99 MemoryGraphElement _graph; | 95 MemoryGraphElement _graph; |
100 | 96 |
101 void render() { | 97 void render() { |
102 if (_graph == null) { | 98 if (_graph == null) { |
103 _graph = | 99 _graph = new MemoryGraphElement(vm, _isolates, _events, queue: _r.queue) |
104 new MemoryGraphElement(vm, _vms, _isolates, _events, queue: _r.queue) | 100 ..onIsolateSelected.listen(_onIsolateSelected); |
105 ..onIsolateSelected.listen(_onIsolateSelected); | |
106 } | 101 } |
107 children = [ | 102 children = [ |
108 navBar([new NavNotifyElement(_notifications, queue: _r.queue)]), | 103 navBar([new NavNotifyElement(_notifications, queue: _r.queue)]), |
109 new DivElement() | 104 new DivElement() |
110 ..classes = ['content-centered-big'] | 105 ..classes = ['content-centered-big'] |
111 ..children = [ | 106 ..children = [ |
112 new HeadingElement.h2()..text = 'Memory Dashboard', | 107 new HeadingElement.h2()..text = 'Memory Dashboard', |
113 new HRElement(), | 108 new HRElement(), |
114 _graph, | 109 _graph, |
115 new HRElement(), | 110 new HRElement(), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 profile | 153 profile |
159 ]); | 154 ]); |
160 } | 155 } |
161 } | 156 } |
162 | 157 |
163 void _onIsolateSelected(IsolateSelectedEvent e) { | 158 void _onIsolateSelected(IsolateSelectedEvent e) { |
164 _r.checkAndReact(_isolate, e.isolate); | 159 _r.checkAndReact(_isolate, e.isolate); |
165 _isolate = e.isolate; | 160 _isolate = e.isolate; |
166 } | 161 } |
167 } | 162 } |
OLD | NEW |