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 library script_view; | 5 library script_view; |
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/context_ref.dart'; | 10 import 'package:observatory/src/elements/context_ref.dart'; |
11 import 'package:observatory/src/elements/curly_block.dart'; | 11 import 'package:observatory/src/elements/curly_block.dart'; |
12 import 'package:observatory/src/elements/helpers/nav_bar.dart'; | 12 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
13 import 'package:observatory/src/elements/helpers/nav_menu.dart'; | 13 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
14 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 14 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
15 import 'package:observatory/src/elements/helpers/tag.dart'; | 15 import 'package:observatory/src/elements/helpers/tag.dart'; |
16 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 16 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
17 import 'package:observatory/src/elements/nav/library_menu.dart'; | 17 import 'package:observatory/src/elements/nav/library_menu.dart'; |
18 import 'package:observatory/src/elements/nav/notify.dart'; | 18 import 'package:observatory/src/elements/nav/notify.dart'; |
19 import 'package:observatory/src/elements/nav/refresh.dart'; | 19 import 'package:observatory/src/elements/nav/refresh.dart'; |
20 import 'package:observatory/src/elements/nav/top_menu.dart'; | 20 import 'package:observatory/src/elements/nav/top_menu.dart'; |
21 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 21 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
22 import 'package:observatory/src/elements/object_common.dart'; | 22 import 'package:observatory/src/elements/object_common.dart'; |
23 import 'package:observatory/src/elements/script_inset.dart'; | 23 import 'package:observatory/src/elements/script_inset.dart'; |
24 import 'package:observatory/src/elements/view_footer.dart'; | 24 import 'package:observatory/src/elements/view_footer.dart'; |
25 | 25 |
26 class ScriptViewElement extends HtmlElement implements Renderable { | 26 class ScriptViewElement extends HtmlElement implements Renderable { |
27 static const tag = const Tag<ScriptViewElement>('script-view', | 27 static const tag = |
28 dependencies: const [ | 28 const Tag<ScriptViewElement>('script-view', dependencies: const [ |
29 ContextRefElement.tag, | 29 ContextRefElement.tag, |
30 CurlyBlockElement.tag, | 30 CurlyBlockElement.tag, |
31 NavTopMenuElement.tag, | 31 NavTopMenuElement.tag, |
32 NavVMMenuElement.tag, | 32 NavVMMenuElement.tag, |
33 NavIsolateMenuElement.tag, | 33 NavIsolateMenuElement.tag, |
34 NavLibraryMenuElement.tag, | 34 NavLibraryMenuElement.tag, |
35 NavRefreshElement.tag, | 35 NavRefreshElement.tag, |
36 NavNotifyElement.tag, | 36 NavNotifyElement.tag, |
37 ObjectCommonElement.tag, | 37 ObjectCommonElement.tag, |
38 ScriptInsetElement.tag, | 38 ScriptInsetElement.tag, |
39 ViewFooterElement.tag | 39 ViewFooterElement.tag |
40 ]); | 40 ]); |
41 | 41 |
42 RenderingScheduler<ScriptViewElement> _r; | 42 RenderingScheduler<ScriptViewElement> _r; |
43 | 43 |
44 Stream<RenderedEvent<ScriptViewElement>> get onRendered => | 44 Stream<RenderedEvent<ScriptViewElement>> get onRendered => _r.onRendered; |
45 _r.onRendered; | |
46 | 45 |
47 M.VM _vm; | 46 M.VM _vm; |
48 M.IsolateRef _isolate; | 47 M.IsolateRef _isolate; |
49 M.EventRepository _events; | 48 M.EventRepository _events; |
50 M.NotificationRepository _notifications; | 49 M.NotificationRepository _notifications; |
51 M.Script _script; | 50 M.Script _script; |
52 M.ScriptRepository _scripts; | 51 M.ScriptRepository _scripts; |
53 M.RetainedSizeRepository _retainedSizes; | 52 M.RetainedSizeRepository _retainedSizes; |
54 M.ReachableSizeRepository _reachableSizes; | 53 M.ReachableSizeRepository _reachableSizes; |
55 M.InboundReferencesRepository _references; | 54 M.InboundReferencesRepository _references; |
56 M.RetainingPathRepository _retainingPaths; | 55 M.RetainingPathRepository _retainingPaths; |
57 M.InstanceRepository _instances; | 56 M.InstanceRepository _instances; |
58 int _pos; | 57 int _pos; |
59 | 58 |
60 | |
61 M.VMRef get vm => _vm; | 59 M.VMRef get vm => _vm; |
62 M.IsolateRef get isolate => _isolate; | 60 M.IsolateRef get isolate => _isolate; |
63 M.NotificationRepository get notifications => _notifications; | 61 M.NotificationRepository get notifications => _notifications; |
64 M.Script get script => _script; | 62 M.Script get script => _script; |
65 | 63 |
66 factory ScriptViewElement(M.VM vm, M.IsolateRef isolate, | 64 factory ScriptViewElement( |
67 M.Script script, | 65 M.VM vm, |
68 M.EventRepository events, | 66 M.IsolateRef isolate, |
69 M.NotificationRepository notifications, | 67 M.Script script, |
70 M.ScriptRepository scripts, | 68 M.EventRepository events, |
71 M.RetainedSizeRepository retainedSizes, | 69 M.NotificationRepository notifications, |
72 M.ReachableSizeRepository reachableSizes, | 70 M.ScriptRepository scripts, |
73 M.InboundReferencesRepository references, | 71 M.RetainedSizeRepository retainedSizes, |
74 M.RetainingPathRepository retainingPaths, | 72 M.ReachableSizeRepository reachableSizes, |
75 M.InstanceRepository instances, | 73 M.InboundReferencesRepository references, |
76 {int pos, RenderingQueue queue}) { | 74 M.RetainingPathRepository retainingPaths, |
| 75 M.InstanceRepository instances, |
| 76 {int pos, |
| 77 RenderingQueue queue}) { |
77 assert(vm != null); | 78 assert(vm != null); |
78 assert(isolate != null); | 79 assert(isolate != null); |
79 assert(events != null); | 80 assert(events != null); |
80 assert(notifications != null); | 81 assert(notifications != null); |
81 assert(script != null); | 82 assert(script != null); |
82 assert(scripts != null); | 83 assert(scripts != null); |
83 assert(retainedSizes != null); | 84 assert(retainedSizes != null); |
84 assert(reachableSizes != null); | 85 assert(reachableSizes != null); |
85 assert(references != null); | 86 assert(references != null); |
86 assert(retainingPaths != null); | 87 assert(retainingPaths != null); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 120 |
120 void render() { | 121 void render() { |
121 children = [ | 122 children = [ |
122 navBar([ | 123 navBar([ |
123 new NavTopMenuElement(queue: _r.queue), | 124 new NavTopMenuElement(queue: _r.queue), |
124 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 125 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
125 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 126 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
126 new NavLibraryMenuElement(_isolate, _script.library, queue: _r.queue), | 127 new NavLibraryMenuElement(_isolate, _script.library, queue: _r.queue), |
127 navMenu('object'), | 128 navMenu('object'), |
128 new NavRefreshElement(queue: _r.queue) | 129 new NavRefreshElement(queue: _r.queue) |
129 ..onRefresh.listen((e) async { | 130 ..onRefresh.listen((e) async { |
130 e.element.disabled = true; | 131 e.element.disabled = true; |
131 _script = await _scripts.get(_isolate, _script.id); | 132 _script = await _scripts.get(_isolate, _script.id); |
132 _r.dirty(); | 133 _r.dirty(); |
133 }), | 134 }), |
134 new NavNotifyElement(_notifications, queue: _r.queue) | 135 new NavNotifyElement(_notifications, queue: _r.queue) |
135 ]), | 136 ]), |
136 new DivElement()..classes = ['content-centered-big'] | 137 new DivElement() |
| 138 ..classes = ['content-centered-big'] |
137 ..children = [ | 139 ..children = [ |
138 new HeadingElement.h2()..text = 'Script', | 140 new HeadingElement.h2()..text = 'Script', |
139 new HRElement(), | 141 new HRElement(), |
140 new ObjectCommonElement(_isolate, _script, _retainedSizes, | 142 new ObjectCommonElement(_isolate, _script, _retainedSizes, |
141 _reachableSizes, _references, _retainingPaths, | 143 _reachableSizes, _references, _retainingPaths, _instances, |
142 _instances, queue: _r.queue), | 144 queue: _r.queue), |
143 new BRElement(), | 145 new BRElement(), |
144 new DivElement()..classes = ['memberList'] | 146 new DivElement() |
| 147 ..classes = ['memberList'] |
145 ..children = [ | 148 ..children = [ |
146 new DivElement()..classes = ['memberItem'] | 149 new DivElement() |
| 150 ..classes = ['memberItem'] |
147 ..children = [ | 151 ..children = [ |
148 new DivElement()..classes = ['memberName'] | 152 new DivElement() |
| 153 ..classes = ['memberName'] |
149 ..text = 'load time', | 154 ..text = 'load time', |
150 new DivElement()..classes = ['memberName'] | 155 new DivElement() |
| 156 ..classes = ['memberName'] |
151 ..text = '${_script.loadTime}' | 157 ..text = '${_script.loadTime}' |
152 ], | 158 ], |
153 ], | 159 ], |
154 new HRElement(), | 160 new HRElement(), |
155 new ScriptInsetElement(_isolate, _script, _scripts, _instances, | 161 new ScriptInsetElement( |
156 _events, currentPos: _pos, queue: _r.queue), | 162 _isolate, _script, _scripts, _instances, _events, |
| 163 currentPos: _pos, queue: _r.queue), |
157 new ViewFooterElement(queue: _r.queue) | 164 new ViewFooterElement(queue: _r.queue) |
158 ] | 165 ] |
159 ]; | 166 ]; |
160 } | 167 } |
161 } | 168 } |
OLD | NEW |