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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/src/elements/context_ref.dart'; | 8 import 'package:observatory/src/elements/context_ref.dart'; |
9 import 'package:observatory/src/elements/curly_block.dart'; | 9 import 'package:observatory/src/elements/curly_block.dart'; |
10 import 'package:observatory/src/elements/helpers/nav_bar.dart'; | 10 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
11 import 'package:observatory/src/elements/helpers/nav_menu.dart'; | 11 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
13 import 'package:observatory/src/elements/helpers/tag.dart'; | 13 import 'package:observatory/src/elements/helpers/tag.dart'; |
14 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 14 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
15 import 'package:observatory/src/elements/nav/notify.dart'; | 15 import 'package:observatory/src/elements/nav/notify.dart'; |
16 import 'package:observatory/src/elements/nav/refresh.dart'; | 16 import 'package:observatory/src/elements/nav/refresh.dart'; |
17 import 'package:observatory/src/elements/nav/top_menu.dart'; | 17 import 'package:observatory/src/elements/nav/top_menu.dart'; |
18 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 18 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
19 import 'package:observatory/src/elements/object_common.dart'; | 19 import 'package:observatory/src/elements/object_common.dart'; |
20 import 'package:observatory/src/elements/view_footer.dart'; | 20 import 'package:observatory/src/elements/view_footer.dart'; |
21 | 21 |
22 class ObjectViewElement extends HtmlElement implements Renderable { | 22 class ObjectViewElement extends HtmlElement implements Renderable { |
23 static const tag = const Tag<ObjectViewElement>('object-view', | 23 static const tag = |
24 dependencies: const [ | 24 const Tag<ObjectViewElement>('object-view', dependencies: const [ |
25 ContextRefElement.tag, | 25 ContextRefElement.tag, |
26 CurlyBlockElement.tag, | 26 CurlyBlockElement.tag, |
27 NavTopMenuElement.tag, | 27 NavTopMenuElement.tag, |
28 NavVMMenuElement.tag, | 28 NavVMMenuElement.tag, |
29 NavIsolateMenuElement.tag, | 29 NavIsolateMenuElement.tag, |
30 NavRefreshElement.tag, | 30 NavRefreshElement.tag, |
31 NavNotifyElement.tag, | 31 NavNotifyElement.tag, |
32 ObjectCommonElement.tag, | 32 ObjectCommonElement.tag, |
33 ViewFooterElement.tag | 33 ViewFooterElement.tag |
34 ]); | 34 ]); |
35 | 35 |
36 RenderingScheduler<ObjectViewElement> _r; | 36 RenderingScheduler<ObjectViewElement> _r; |
37 | 37 |
38 Stream<RenderedEvent<ObjectViewElement>> get onRendered => _r.onRendered; | 38 Stream<RenderedEvent<ObjectViewElement>> get onRendered => _r.onRendered; |
39 | 39 |
40 M.VM _vm; | 40 M.VM _vm; |
41 M.IsolateRef _isolate; | 41 M.IsolateRef _isolate; |
42 M.EventRepository _events; | 42 M.EventRepository _events; |
43 M.NotificationRepository _notifications; | 43 M.NotificationRepository _notifications; |
44 M.Object _object; | 44 M.Object _object; |
45 M.ObjectRepository _objects; | 45 M.ObjectRepository _objects; |
46 M.RetainedSizeRepository _retainedSizes; | 46 M.RetainedSizeRepository _retainedSizes; |
47 M.ReachableSizeRepository _reachableSizes; | 47 M.ReachableSizeRepository _reachableSizes; |
48 M.InboundReferencesRepository _references; | 48 M.InboundReferencesRepository _references; |
49 M.RetainingPathRepository _retainingPaths; | 49 M.RetainingPathRepository _retainingPaths; |
50 M.InstanceRepository _instances; | 50 M.InstanceRepository _instances; |
51 | 51 |
52 | |
53 M.VMRef get vm => _vm; | 52 M.VMRef get vm => _vm; |
54 M.IsolateRef get isolate => _isolate; | 53 M.IsolateRef get isolate => _isolate; |
55 M.NotificationRepository get notifications => _notifications; | 54 M.NotificationRepository get notifications => _notifications; |
56 M.Context get object => _object; | 55 M.Context get object => _object; |
57 | 56 |
58 factory ObjectViewElement(M.VM vm, M.IsolateRef isolate, M.Object object, | 57 factory ObjectViewElement( |
59 M.EventRepository events, | 58 M.VM vm, |
60 M.NotificationRepository notifications, | 59 M.IsolateRef isolate, |
61 M.ObjectRepository objects, | 60 M.Object object, |
62 M.RetainedSizeRepository retainedSizes, | 61 M.EventRepository events, |
63 M.ReachableSizeRepository reachableSizes, | 62 M.NotificationRepository notifications, |
64 M.InboundReferencesRepository references, | 63 M.ObjectRepository objects, |
65 M.RetainingPathRepository retainingPaths, | 64 M.RetainedSizeRepository retainedSizes, |
66 M.InstanceRepository instances, | 65 M.ReachableSizeRepository reachableSizes, |
67 {RenderingQueue queue}) { | 66 M.InboundReferencesRepository references, |
| 67 M.RetainingPathRepository retainingPaths, |
| 68 M.InstanceRepository instances, |
| 69 {RenderingQueue queue}) { |
68 assert(vm != null); | 70 assert(vm != null); |
69 assert(isolate != null); | 71 assert(isolate != null); |
70 assert(events != null); | 72 assert(events != null); |
71 assert(notifications != null); | 73 assert(notifications != null); |
72 assert(object != null); | 74 assert(object != null); |
73 assert(objects != null); | 75 assert(objects != null); |
74 assert(retainedSizes != null); | 76 assert(retainedSizes != null); |
75 assert(reachableSizes != null); | 77 assert(reachableSizes != null); |
76 assert(references != null); | 78 assert(references != null); |
77 assert(retainingPaths != null); | 79 assert(retainingPaths != null); |
(...skipping 30 matching lines...) Expand all Loading... |
108 } | 110 } |
109 | 111 |
110 void render() { | 112 void render() { |
111 children = [ | 113 children = [ |
112 navBar([ | 114 navBar([ |
113 new NavTopMenuElement(queue: _r.queue), | 115 new NavTopMenuElement(queue: _r.queue), |
114 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 116 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
115 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 117 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
116 navMenu('object'), | 118 navMenu('object'), |
117 new NavRefreshElement(queue: _r.queue) | 119 new NavRefreshElement(queue: _r.queue) |
118 ..onRefresh.listen((e) async { | 120 ..onRefresh.listen((e) async { |
119 e.element.disabled = true; | 121 e.element.disabled = true; |
120 _object = await _objects.get(_isolate, _object.id); | 122 _object = await _objects.get(_isolate, _object.id); |
121 _r.dirty(); | 123 _r.dirty(); |
122 }), | 124 }), |
123 new NavNotifyElement(_notifications, queue: _r.queue) | 125 new NavNotifyElement(_notifications, queue: _r.queue) |
124 ]), | 126 ]), |
125 new DivElement()..classes = ['content-centered-big'] | 127 new DivElement() |
| 128 ..classes = ['content-centered-big'] |
126 ..children = [ | 129 ..children = [ |
127 new HeadingElement.h2()..text = 'Object', | 130 new HeadingElement.h2()..text = 'Object', |
128 new HRElement(), | 131 new HRElement(), |
129 new ObjectCommonElement(_isolate, _object, _retainedSizes, | 132 new ObjectCommonElement(_isolate, _object, _retainedSizes, |
130 _reachableSizes, _references, _retainingPaths, | 133 _reachableSizes, _references, _retainingPaths, _instances, |
131 _instances, queue: _r.queue), | 134 queue: _r.queue), |
132 new HRElement(), | 135 new HRElement(), |
133 new ViewFooterElement(queue: _r.queue) | 136 new ViewFooterElement(queue: _r.queue) |
134 ] | 137 ] |
135 ]; | 138 ]; |
136 } | 139 } |
137 } | 140 } |
OLD | NEW |