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'; |
(...skipping 30 matching lines...) Expand all Loading... |
41 RenderingScheduler<PersistentHandlesPageElement> _r; | 41 RenderingScheduler<PersistentHandlesPageElement> _r; |
42 | 42 |
43 Stream<RenderedEvent<PersistentHandlesPageElement>> get onRendered => | 43 Stream<RenderedEvent<PersistentHandlesPageElement>> get onRendered => |
44 _r.onRendered; | 44 _r.onRendered; |
45 | 45 |
46 M.VM _vm; | 46 M.VM _vm; |
47 M.IsolateRef _isolate; | 47 M.IsolateRef _isolate; |
48 M.EventRepository _events; | 48 M.EventRepository _events; |
49 M.NotificationRepository _notifications; | 49 M.NotificationRepository _notifications; |
50 M.PersistentHandlesRepository _repository; | 50 M.PersistentHandlesRepository _repository; |
51 M.InstanceRepository _instances; | 51 M.ObjectRepository _objects; |
52 M.PersistentHandles _handles; | 52 M.PersistentHandles _handles; |
53 _SortingField _sortingField = _SortingField.externalSize; | 53 _SortingField _sortingField = _SortingField.externalSize; |
54 _SortingDirection _sortingDirection = _SortingDirection.descending; | 54 _SortingDirection _sortingDirection = _SortingDirection.descending; |
55 | 55 |
56 M.VMRef get vm => _vm; | 56 M.VMRef get vm => _vm; |
57 M.IsolateRef get isolate => _isolate; | 57 M.IsolateRef get isolate => _isolate; |
58 M.NotificationRepository get notifications => _notifications; | 58 M.NotificationRepository get notifications => _notifications; |
59 | 59 |
60 factory PersistentHandlesPageElement( | 60 factory PersistentHandlesPageElement( |
61 M.VM vm, | 61 M.VM vm, |
62 M.IsolateRef isolate, | 62 M.IsolateRef isolate, |
63 M.EventRepository events, | 63 M.EventRepository events, |
64 M.NotificationRepository notifications, | 64 M.NotificationRepository notifications, |
65 M.PersistentHandlesRepository repository, | 65 M.PersistentHandlesRepository repository, |
66 M.InstanceRepository instances, | 66 M.ObjectRepository objects, |
67 {RenderingQueue queue}) { | 67 {RenderingQueue queue}) { |
68 assert(vm != null); | 68 assert(vm != null); |
69 assert(isolate != null); | 69 assert(isolate != null); |
70 assert(events != null); | 70 assert(events != null); |
71 assert(notifications != null); | 71 assert(notifications != null); |
72 assert(repository != null); | 72 assert(repository != null); |
73 assert(instances != null); | 73 assert(objects != null); |
74 PersistentHandlesPageElement e = document.createElement(tag.name); | 74 PersistentHandlesPageElement e = document.createElement(tag.name); |
75 e._r = new RenderingScheduler(e, queue: queue); | 75 e._r = new RenderingScheduler(e, queue: queue); |
76 e._vm = vm; | 76 e._vm = vm; |
77 e._isolate = isolate; | 77 e._isolate = isolate; |
78 e._events = events; | 78 e._events = events; |
79 e._notifications = notifications; | 79 e._notifications = notifications; |
80 e._repository = repository; | 80 e._repository = repository; |
81 e._instances = instances; | 81 e._objects = objects; |
82 return e; | 82 return e; |
83 } | 83 } |
84 | 84 |
85 PersistentHandlesPageElement.created() : super.created(); | 85 PersistentHandlesPageElement.created() : super.created(); |
86 | 86 |
87 @override | 87 @override |
88 attached() { | 88 attached() { |
89 super.attached(); | 89 super.attached(); |
90 _r.enable(); | 90 _r.enable(); |
91 _refresh(); | 91 _refresh(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } else { | 224 } else { |
225 _sortingDirection = defaultDirection; | 225 _sortingDirection = defaultDirection; |
226 _sortingField = field; | 226 _sortingField = field; |
227 } | 227 } |
228 _r.dirty(); | 228 _r.dirty(); |
229 } | 229 } |
230 | 230 |
231 void _updateWeakLine(Element e, M.WeakPersistentHandle item, index) { | 231 void _updateWeakLine(Element e, M.WeakPersistentHandle item, index) { |
232 e.children[0].text = Utils.formatSize(_getExternalSize(item)); | 232 e.children[0].text = Utils.formatSize(_getExternalSize(item)); |
233 e.children[1].text = '${_getPeer(item)}'; | 233 e.children[1].text = '${_getPeer(item)}'; |
234 e.children[2] = anyRef(_isolate, item.object, _instances, queue: _r.queue) | 234 e.children[2] = anyRef(_isolate, item.object, _objects, queue: _r.queue) |
235 ..classes = ['object']; | 235 ..classes = ['object']; |
236 e.children[3] | 236 e.children[3] |
237 ..text = '${_getFinalizerCallback(item)}' | 237 ..text = '${_getFinalizerCallback(item)}' |
238 ..title = '${_getFinalizerCallback(item)}'; | 238 ..title = '${_getFinalizerCallback(item)}'; |
239 } | 239 } |
240 | 240 |
241 void _updateLine(Element e, M.PersistentHandle item, index) { | 241 void _updateLine(Element e, M.PersistentHandle item, index) { |
242 e.children = [ | 242 e.children = [ |
243 anyRef(_isolate, item.object, _instances, queue: _r.queue) | 243 anyRef(_isolate, item.object, _objects, queue: _r.queue) |
244 ..classes = ['object'] | 244 ..classes = ['object'] |
245 ]; | 245 ]; |
246 } | 246 } |
247 | 247 |
248 Future _refresh({bool gc: false, bool reset: false}) async { | 248 Future _refresh({bool gc: false, bool reset: false}) async { |
249 _handles = null; | 249 _handles = null; |
250 _r.dirty(); | 250 _r.dirty(); |
251 _handles = await _repository.get(_isolate); | 251 _handles = await _repository.get(_isolate); |
252 _r.dirty(); | 252 _r.dirty(); |
253 } | 253 } |
254 | 254 |
255 static int _getExternalSize(M.WeakPersistentHandle h) => h.externalSize; | 255 static int _getExternalSize(M.WeakPersistentHandle h) => h.externalSize; |
256 static String _getPeer(M.WeakPersistentHandle h) => h.peer; | 256 static String _getPeer(M.WeakPersistentHandle h) => h.peer; |
257 static String _getFinalizerCallback(M.WeakPersistentHandle h) => | 257 static String _getFinalizerCallback(M.WeakPersistentHandle h) => |
258 '${h.callbackSymbolName} (${h.callbackAddress})'; | 258 '${h.callbackSymbolName} (${h.callbackAddress})'; |
259 } | 259 } |
OLD | NEW |