| 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 field_view_element; | 5 library field_view_element; |
| 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/class_ref.dart'; | 10 import 'package:observatory/src/elements/class_ref.dart'; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 M.NotificationRepository _notifications; | 54 M.NotificationRepository _notifications; |
| 55 M.Field _field; | 55 M.Field _field; |
| 56 M.LibraryRef _library; | 56 M.LibraryRef _library; |
| 57 M.FieldRepository _fields; | 57 M.FieldRepository _fields; |
| 58 M.ClassRepository _classes; | 58 M.ClassRepository _classes; |
| 59 M.RetainedSizeRepository _retainedSizes; | 59 M.RetainedSizeRepository _retainedSizes; |
| 60 M.ReachableSizeRepository _reachableSizes; | 60 M.ReachableSizeRepository _reachableSizes; |
| 61 M.InboundReferencesRepository _references; | 61 M.InboundReferencesRepository _references; |
| 62 M.RetainingPathRepository _retainingPaths; | 62 M.RetainingPathRepository _retainingPaths; |
| 63 M.ScriptRepository _scripts; | 63 M.ScriptRepository _scripts; |
| 64 M.InstanceRepository _instances; | 64 M.ObjectRepository _objects; |
| 65 | 65 |
| 66 M.VMRef get vm => _vm; | 66 M.VMRef get vm => _vm; |
| 67 M.IsolateRef get isolate => _isolate; | 67 M.IsolateRef get isolate => _isolate; |
| 68 M.NotificationRepository get notifications => _notifications; | 68 M.NotificationRepository get notifications => _notifications; |
| 69 M.Field get field => _field; | 69 M.Field get field => _field; |
| 70 | 70 |
| 71 factory FieldViewElement( | 71 factory FieldViewElement( |
| 72 M.VM vm, | 72 M.VM vm, |
| 73 M.IsolateRef isolate, | 73 M.IsolateRef isolate, |
| 74 M.Field field, | 74 M.Field field, |
| 75 M.EventRepository events, | 75 M.EventRepository events, |
| 76 M.NotificationRepository notifications, | 76 M.NotificationRepository notifications, |
| 77 M.FieldRepository fields, | 77 M.FieldRepository fields, |
| 78 M.ClassRepository classes, | 78 M.ClassRepository classes, |
| 79 M.RetainedSizeRepository retainedSizes, | 79 M.RetainedSizeRepository retainedSizes, |
| 80 M.ReachableSizeRepository reachableSizes, | 80 M.ReachableSizeRepository reachableSizes, |
| 81 M.InboundReferencesRepository references, | 81 M.InboundReferencesRepository references, |
| 82 M.RetainingPathRepository retainingPaths, | 82 M.RetainingPathRepository retainingPaths, |
| 83 M.ScriptRepository scripts, | 83 M.ScriptRepository scripts, |
| 84 M.InstanceRepository instances, | 84 M.ObjectRepository objects, |
| 85 {RenderingQueue queue}) { | 85 {RenderingQueue queue}) { |
| 86 assert(vm != null); | 86 assert(vm != null); |
| 87 assert(isolate != null); | 87 assert(isolate != null); |
| 88 assert(events != null); | 88 assert(events != null); |
| 89 assert(notifications != null); | 89 assert(notifications != null); |
| 90 assert(field != null); | 90 assert(field != null); |
| 91 assert(fields != null); | 91 assert(fields != null); |
| 92 assert(classes != null); | 92 assert(classes != null); |
| 93 assert(retainedSizes != null); | 93 assert(retainedSizes != null); |
| 94 assert(reachableSizes != null); | 94 assert(reachableSizes != null); |
| 95 assert(references != null); | 95 assert(references != null); |
| 96 assert(retainingPaths != null); | 96 assert(retainingPaths != null); |
| 97 assert(scripts != null); | 97 assert(scripts != null); |
| 98 assert(instances != null); | 98 assert(objects != null); |
| 99 FieldViewElement e = document.createElement(tag.name); | 99 FieldViewElement e = document.createElement(tag.name); |
| 100 e._r = new RenderingScheduler(e, queue: queue); | 100 e._r = new RenderingScheduler(e, queue: queue); |
| 101 e._vm = vm; | 101 e._vm = vm; |
| 102 e._isolate = isolate; | 102 e._isolate = isolate; |
| 103 e._events = events; | 103 e._events = events; |
| 104 e._notifications = notifications; | 104 e._notifications = notifications; |
| 105 e._field = field; | 105 e._field = field; |
| 106 e._fields = fields; | 106 e._fields = fields; |
| 107 e._classes = classes; | 107 e._classes = classes; |
| 108 e._retainedSizes = retainedSizes; | 108 e._retainedSizes = retainedSizes; |
| 109 e._reachableSizes = reachableSizes; | 109 e._reachableSizes = reachableSizes; |
| 110 e._references = references; | 110 e._references = references; |
| 111 e._retainingPaths = retainingPaths; | 111 e._retainingPaths = retainingPaths; |
| 112 e._scripts = scripts; | 112 e._scripts = scripts; |
| 113 e._instances = instances; | 113 e._objects = objects; |
| 114 if (field.dartOwner is M.LibraryRef) { | 114 if (field.dartOwner is M.LibraryRef) { |
| 115 e._library = field.dartOwner; | 115 e._library = field.dartOwner; |
| 116 } | 116 } |
| 117 return e; | 117 return e; |
| 118 } | 118 } |
| 119 | 119 |
| 120 FieldViewElement.created() : super.created(); | 120 FieldViewElement.created() : super.created(); |
| 121 | 121 |
| 122 @override | 122 @override |
| 123 attached() { | 123 attached() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 153 header += _field.declaredType.name; | 153 header += _field.declaredType.name; |
| 154 } | 154 } |
| 155 children = [ | 155 children = [ |
| 156 navBar(_createMenu()), | 156 navBar(_createMenu()), |
| 157 new DivElement() | 157 new DivElement() |
| 158 ..classes = ['content-centered-big'] | 158 ..classes = ['content-centered-big'] |
| 159 ..children = [ | 159 ..children = [ |
| 160 new HeadingElement.h2()..text = '$header ${field.name}', | 160 new HeadingElement.h2()..text = '$header ${field.name}', |
| 161 new HRElement(), | 161 new HRElement(), |
| 162 new ObjectCommonElement(_isolate, _field, _retainedSizes, | 162 new ObjectCommonElement(_isolate, _field, _retainedSizes, |
| 163 _reachableSizes, _references, _retainingPaths, _instances, | 163 _reachableSizes, _references, _retainingPaths, _objects, |
| 164 queue: _r.queue), | 164 queue: _r.queue), |
| 165 new BRElement(), | 165 new BRElement(), |
| 166 new DivElement() | 166 new DivElement() |
| 167 ..classes = ['memberList'] | 167 ..classes = ['memberList'] |
| 168 ..children = _createMembers(), | 168 ..children = _createMembers(), |
| 169 new HRElement(), | 169 new HRElement(), |
| 170 new DivElement() | 170 new DivElement() |
| 171 ..children = _field.location == null | 171 ..children = _field.location == null |
| 172 ? const [] | 172 ? const [] |
| 173 : [ | 173 : [ |
| 174 new ScriptInsetElement(_isolate, _field.location.script, | 174 new ScriptInsetElement(_isolate, _field.location.script, |
| 175 _scripts, _instances, _events, | 175 _scripts, _objects, _events, |
| 176 startPos: field.location.tokenPos, | 176 startPos: field.location.tokenPos, |
| 177 endPos: field.location.tokenPos, | 177 endPos: field.location.tokenPos, |
| 178 queue: _r.queue) | 178 queue: _r.queue) |
| 179 ], | 179 ], |
| 180 new ViewFooterElement(queue: _r.queue) | 180 new ViewFooterElement(queue: _r.queue) |
| 181 ] | 181 ] |
| 182 ]; | 182 ]; |
| 183 } | 183 } |
| 184 | 184 |
| 185 List<Element> _createMenu() { | 185 List<Element> _createMenu() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 213 ..classes = ['memberItem'] | 213 ..classes = ['memberItem'] |
| 214 ..children = [ | 214 ..children = [ |
| 215 new DivElement() | 215 new DivElement() |
| 216 ..classes = ['memberName'] | 216 ..classes = ['memberName'] |
| 217 ..text = 'owner', | 217 ..text = 'owner', |
| 218 new DivElement() | 218 new DivElement() |
| 219 ..classes = ['memberName'] | 219 ..classes = ['memberName'] |
| 220 ..children = [ | 220 ..children = [ |
| 221 _field.dartOwner == null | 221 _field.dartOwner == null |
| 222 ? (new SpanElement()..text = '...') | 222 ? (new SpanElement()..text = '...') |
| 223 : anyRef(_isolate, _field.dartOwner, _instances, | 223 : anyRef(_isolate, _field.dartOwner, _objects, |
| 224 queue: _r.queue) | 224 queue: _r.queue) |
| 225 ] | 225 ] |
| 226 ], | 226 ], |
| 227 new DivElement() | 227 new DivElement() |
| 228 ..classes = ['memberItem'] | 228 ..classes = ['memberItem'] |
| 229 ..children = [ | 229 ..children = [ |
| 230 new DivElement() | 230 new DivElement() |
| 231 ..classes = ['memberName'] | 231 ..classes = ['memberName'] |
| 232 ..text = 'script', | 232 ..text = 'script', |
| 233 new DivElement() | 233 new DivElement() |
| (...skipping 22 matching lines...) Expand all Loading... |
| 256 if (_field.staticValue != null) { | 256 if (_field.staticValue != null) { |
| 257 members.add(new DivElement() | 257 members.add(new DivElement() |
| 258 ..classes = ['memberItem'] | 258 ..classes = ['memberItem'] |
| 259 ..children = [ | 259 ..children = [ |
| 260 new DivElement() | 260 new DivElement() |
| 261 ..classes = ['memberName'] | 261 ..classes = ['memberName'] |
| 262 ..text = 'static value', | 262 ..text = 'static value', |
| 263 new DivElement() | 263 new DivElement() |
| 264 ..classes = ['memberName'] | 264 ..classes = ['memberName'] |
| 265 ..children = [ | 265 ..children = [ |
| 266 anyRef(_isolate, _field.staticValue, _instances, queue: _r.queue) | 266 anyRef(_isolate, _field.staticValue, _objects, queue: _r.queue) |
| 267 ] | 267 ] |
| 268 ]); | 268 ]); |
| 269 } | 269 } |
| 270 return members; | 270 return members; |
| 271 } | 271 } |
| 272 | 272 |
| 273 List<Element> _createGuard() { | 273 List<Element> _createGuard() { |
| 274 final guard = <Element>[]; | 274 final guard = <Element>[]; |
| 275 switch (_field.guardClassKind) { | 275 switch (_field.guardClassKind) { |
| 276 case M.GuardClassKind.unknown: | 276 case M.GuardClassKind.unknown: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 293 Future _refresh() async { | 293 Future _refresh() async { |
| 294 _field = await _fields.get(_isolate, _field.id); | 294 _field = await _fields.get(_isolate, _field.id); |
| 295 if (_field.dartOwner is M.LibraryRef) { | 295 if (_field.dartOwner is M.LibraryRef) { |
| 296 _library = _field.dartOwner; | 296 _library = _field.dartOwner; |
| 297 } else if (_field.dartOwner is M.ClassRef) { | 297 } else if (_field.dartOwner is M.ClassRef) { |
| 298 _library = (await _classes.get(_isolate, _field.dartOwner.id)).library; | 298 _library = (await _classes.get(_isolate, _field.dartOwner.id)).library; |
| 299 } | 299 } |
| 300 _r.dirty(); | 300 _r.dirty(); |
| 301 } | 301 } |
| 302 } | 302 } |
| OLD | NEW |