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; |
44 M.IsolateRepository _isolates; | 45 M.IsolateRepository _isolates; |
45 M.EditorRepository _editor; | 46 M.EditorRepository _editor; |
46 M.AllocationProfileRepository _allocations; | 47 M.AllocationProfileRepository _allocations; |
47 M.EventRepository _events; | 48 M.EventRepository _events; |
48 M.NotificationRepository _notifications; | 49 M.NotificationRepository _notifications; |
49 | 50 |
50 M.VM get vm => _vm; | 51 M.VMRef get vm => _vm; |
51 M.NotificationRepository get notifications => _notifications; | 52 M.NotificationRepository get notifications => _notifications; |
52 | 53 |
53 factory MemoryDashboardElement( | 54 factory MemoryDashboardElement( |
54 M.VM vm, | 55 M.VMRef vm, |
| 56 M.VMRepository vms, |
55 M.IsolateRepository isolates, | 57 M.IsolateRepository isolates, |
56 M.EditorRepository editor, | 58 M.EditorRepository editor, |
57 M.AllocationProfileRepository allocations, | 59 M.AllocationProfileRepository allocations, |
58 M.EventRepository events, | 60 M.EventRepository events, |
59 M.NotificationRepository notifications, | 61 M.NotificationRepository notifications, |
60 {RenderingQueue queue}) { | 62 {RenderingQueue queue}) { |
61 assert(vm != null); | 63 assert(vm != null); |
| 64 assert(vms != null); |
62 assert(isolates != null); | 65 assert(isolates != null); |
63 assert(editor != null); | 66 assert(editor != null); |
64 assert(allocations != null); | 67 assert(allocations != null); |
65 assert(events != null); | 68 assert(events != null); |
66 assert(notifications != null); | 69 assert(notifications != null); |
67 MemoryDashboardElement e = document.createElement(tag.name); | 70 MemoryDashboardElement e = document.createElement(tag.name); |
68 e._r = new RenderingScheduler(e, queue: queue); | 71 e._r = new RenderingScheduler(e, queue: queue); |
69 e._vm = vm; | 72 e._vm = vm; |
| 73 e._vms = vms; |
70 e._isolates = isolates; | 74 e._isolates = isolates; |
71 e._editor = editor; | 75 e._editor = editor; |
72 e._allocations = allocations; | 76 e._allocations = allocations; |
73 e._events = events; | 77 e._events = events; |
74 e._notifications = notifications; | 78 e._notifications = notifications; |
75 return e; | 79 return e; |
76 } | 80 } |
77 | 81 |
78 MemoryDashboardElement.created() : super.created(); | 82 MemoryDashboardElement.created() : super.created(); |
79 | 83 |
80 @override | 84 @override |
81 attached() { | 85 attached() { |
82 super.attached(); | 86 super.attached(); |
83 _r.enable(); | 87 _r.enable(); |
84 } | 88 } |
85 | 89 |
86 @override | 90 @override |
87 detached() { | 91 detached() { |
88 super.detached(); | 92 super.detached(); |
89 _r.disable(notify: true); | 93 _r.disable(notify: true); |
90 children = []; | 94 children = []; |
91 } | 95 } |
92 | 96 |
93 M.IsolateRef _isolate; | 97 M.IsolateRef _isolate; |
94 | 98 |
95 MemoryGraphElement _graph; | 99 MemoryGraphElement _graph; |
96 | 100 |
97 void render() { | 101 void render() { |
98 if (_graph == null) { | 102 if (_graph == null) { |
99 _graph = new MemoryGraphElement(vm, _isolates, _events, queue: _r.queue) | 103 _graph = |
100 ..onIsolateSelected.listen(_onIsolateSelected); | 104 new MemoryGraphElement(vm, _vms, _isolates, _events, queue: _r.queue) |
| 105 ..onIsolateSelected.listen(_onIsolateSelected); |
101 } | 106 } |
102 children = [ | 107 children = [ |
103 navBar([new NavNotifyElement(_notifications, queue: _r.queue)]), | 108 navBar([new NavNotifyElement(_notifications, queue: _r.queue)]), |
104 new DivElement() | 109 new DivElement() |
105 ..classes = ['content-centered-big'] | 110 ..classes = ['content-centered-big'] |
106 ..children = [ | 111 ..children = [ |
107 new HeadingElement.h2()..text = 'Memory Dashboard', | 112 new HeadingElement.h2()..text = 'Memory Dashboard', |
108 new HRElement(), | 113 new HRElement(), |
109 _graph, | 114 _graph, |
110 new HRElement(), | 115 new HRElement(), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 profile | 158 profile |
154 ]); | 159 ]); |
155 } | 160 } |
156 } | 161 } |
157 | 162 |
158 void _onIsolateSelected(IsolateSelectedEvent e) { | 163 void _onIsolateSelected(IsolateSelectedEvent e) { |
159 _r.checkAndReact(_isolate, e.isolate); | 164 _r.checkAndReact(_isolate, e.isolate); |
160 _isolate = e.isolate; | 165 _isolate = e.isolate; |
161 } | 166 } |
162 } | 167 } |
OLD | NEW |