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 library persitent_handles_page; | 5 library persitent_handles_page; |
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/containers/virtual_collection.dart'; | 10 import 'package:observatory/src/elements/containers/virtual_collection.dart'; |
11 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 11 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 12 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 13 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 14 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
13 import 'package:observatory/src/elements/helpers/tag.dart'; | 15 import 'package:observatory/src/elements/helpers/tag.dart'; |
14 import 'package:observatory/src/elements/helpers/uris.dart'; | 16 import 'package:observatory/src/elements/helpers/uris.dart'; |
15 import 'package:observatory/src/elements/instance_ref.dart'; | 17 import 'package:observatory/src/elements/instance_ref.dart'; |
16 import 'package:observatory/src/elements/nav/bar.dart'; | |
17 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 18 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
18 import 'package:observatory/src/elements/nav/menu.dart'; | |
19 import 'package:observatory/src/elements/nav/notify.dart'; | 19 import 'package:observatory/src/elements/nav/notify.dart'; |
20 import 'package:observatory/src/elements/nav/refresh.dart'; | 20 import 'package:observatory/src/elements/nav/refresh.dart'; |
21 import 'package:observatory/src/elements/nav/top_menu.dart'; | 21 import 'package:observatory/src/elements/nav/top_menu.dart'; |
22 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 22 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
23 import 'package:observatory/utils.dart'; | 23 import 'package:observatory/utils.dart'; |
24 | 24 |
25 enum _SortingField { | 25 enum _SortingField { |
26 externalSize, | 26 externalSize, |
27 peer, | 27 peer, |
28 finalizerCallback | 28 finalizerCallback |
29 } | 29 } |
30 | 30 |
31 enum _SortingDirection { | 31 enum _SortingDirection { |
32 ascending, | 32 ascending, |
33 descending | 33 descending |
34 } | 34 } |
35 | 35 |
36 class PersistentHandlesPageElement extends HtmlElement implements Renderable { | 36 class PersistentHandlesPageElement extends HtmlElement implements Renderable { |
37 static const tag = | 37 static const tag = |
38 const Tag<PersistentHandlesPageElement>('persistent-handles-page', | 38 const Tag<PersistentHandlesPageElement>('persistent-handles-page', |
39 dependencies: const [ | 39 dependencies: const [ |
40 InstanceRefElement.tag, | 40 InstanceRefElement.tag, |
41 NavBarElement.tag, | |
42 NavTopMenuElement.tag, | 41 NavTopMenuElement.tag, |
43 NavVMMenuElement.tag, | 42 NavVMMenuElement.tag, |
44 NavIsolateMenuElement.tag, | 43 NavIsolateMenuElement.tag, |
45 NavMenuElement.tag, | |
46 NavRefreshElement.tag, | 44 NavRefreshElement.tag, |
47 NavNotifyElement.tag, | 45 NavNotifyElement.tag, |
48 VirtualCollectionElement.tag | 46 VirtualCollectionElement.tag |
49 ]); | 47 ]); |
50 | 48 |
51 RenderingScheduler<PersistentHandlesPageElement> _r; | 49 RenderingScheduler<PersistentHandlesPageElement> _r; |
52 | 50 |
53 Stream<RenderedEvent<PersistentHandlesPageElement>> get onRendered => | 51 Stream<RenderedEvent<PersistentHandlesPageElement>> get onRendered => |
54 _r.onRendered; | 52 _r.onRendered; |
55 | 53 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 101 |
104 @override | 102 @override |
105 detached() { | 103 detached() { |
106 super.detached(); | 104 super.detached(); |
107 _r.disable(notify: true); | 105 _r.disable(notify: true); |
108 children = []; | 106 children = []; |
109 } | 107 } |
110 | 108 |
111 void render() { | 109 void render() { |
112 children = [ | 110 children = [ |
113 new NavBarElement(queue: _r.queue) | 111 navBar([ |
114 ..children = [ | 112 new NavTopMenuElement(queue: _r.queue), |
115 new NavTopMenuElement(queue: _r.queue), | 113 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
116 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 114 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
117 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 115 navMenu('persistent handles'), |
118 new NavMenuElement('persistent handles', last: true, | 116 new NavRefreshElement(queue: _r.queue) |
119 link: Uris.persistentHandles(_isolate), queue: _r.queue), | 117 ..onRefresh.listen((_) => _refresh()), |
120 new NavRefreshElement(queue: _r.queue) | 118 new NavNotifyElement(_notifications, queue: _r.queue) |
121 ..onRefresh.listen((_) => _refresh()), | 119 ]) |
122 new NavNotifyElement(_notifications, queue: _r.queue) | |
123 ] | |
124 ]..addAll(_createHandlers('Persistent Handles', | 120 ]..addAll(_createHandlers('Persistent Handles', |
125 _handles?.elements?.toList(), | 121 _handles?.elements?.toList(), |
126 _createLine, | 122 _createLine, |
127 _updateLine)) | 123 _updateLine)) |
128 ..add(new BRElement()) | 124 ..add(new BRElement()) |
129 ..addAll(_createHandlers('Weak Persistent Handles', | 125 ..addAll(_createHandlers('Weak Persistent Handles', |
130 _handles == null | 126 _handles == null |
131 ? null | 127 ? null |
132 : (_handles.weakElements.toList() | 128 : (_handles.weakElements.toList() |
133 ..sort(_createSorter())), | 129 ..sort(_createSorter())), |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 _r.dirty(); | 261 _r.dirty(); |
266 _handles = await _repository.get(_isolate); | 262 _handles = await _repository.get(_isolate); |
267 _r.dirty(); | 263 _r.dirty(); |
268 } | 264 } |
269 | 265 |
270 static int _getExternalSize(M.WeakPersistentHandle h) => h.externalSize; | 266 static int _getExternalSize(M.WeakPersistentHandle h) => h.externalSize; |
271 static String _getPeer(M.WeakPersistentHandle h) => h.peer; | 267 static String _getPeer(M.WeakPersistentHandle h) => h.peer; |
272 static String _getFinalizerCallback(M.WeakPersistentHandle h) => | 268 static String _getFinalizerCallback(M.WeakPersistentHandle h) => |
273 '${h.callbackSymbolName} (${h.callbackAddress})'; | 269 '${h.callbackSymbolName} (${h.callbackAddress})'; |
274 } | 270 } |
OLD | NEW |