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 instance_view_element; | 5 library instance_view_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'observatory_element.dart'; | 8 import 'dart:html'; |
9 import 'package:observatory/service.dart'; | 9 import 'package:observatory/models.dart' as M; |
10 import 'package:polymer/polymer.dart'; | 10 import 'package:observatory/src/elements/class_ref.dart'; |
11 | 11 import 'package:observatory/src/elements/context_ref.dart'; |
12 @CustomTag('instance-view') | 12 import 'package:observatory/src/elements/curly_block.dart'; |
13 class InstanceViewElement extends ObservatoryElement { | 13 import 'package:observatory/src/elements/eval_box.dart'; |
14 @published Instance instance; | 14 import 'package:observatory/src/elements/field_ref.dart'; |
| 15 import 'package:observatory/src/elements/function_ref.dart'; |
| 16 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 17 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
| 18 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 19 import 'package:observatory/src/elements/instance_ref.dart'; |
| 20 import 'package:observatory/src/elements/nav/bar.dart'; |
| 21 import 'package:observatory/src/elements/nav/class_menu.dart'; |
| 22 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
| 23 import 'package:observatory/src/elements/nav/library_menu.dart'; |
| 24 import 'package:observatory/src/elements/nav/menu.dart'; |
| 25 import 'package:observatory/src/elements/nav/notify.dart'; |
| 26 import 'package:observatory/src/elements/nav/refresh.dart'; |
| 27 import 'package:observatory/src/elements/nav/top_menu.dart'; |
| 28 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
| 29 import 'package:observatory/src/elements/object_common.dart'; |
| 30 import 'package:observatory/src/elements/source_inset.dart'; |
| 31 import 'package:observatory/src/elements/source_link.dart'; |
| 32 import 'package:observatory/src/elements/view_footer.dart'; |
| 33 import 'package:observatory/utils.dart'; |
| 34 |
| 35 class InstanceViewElement extends HtmlElement implements Renderable { |
| 36 static const tag = const Tag<InstanceViewElement>('instance-view', |
| 37 dependencies: const [ |
| 38 ClassRefElement.tag, |
| 39 ContextRefElement.tag, |
| 40 CurlyBlockElement.tag, |
| 41 FieldRefElement.tag, |
| 42 FunctionRefElement.tag, |
| 43 InstanceRefElement.tag, |
| 44 NavBarElement.tag, |
| 45 NavClassMenuElement.tag, |
| 46 NavLibraryMenuElement.tag, |
| 47 NavTopMenuElement.tag, |
| 48 NavVMMenuElement.tag, |
| 49 NavIsolateMenuElement.tag, |
| 50 NavMenuElement.tag, |
| 51 NavRefreshElement.tag, |
| 52 NavNotifyElement.tag, |
| 53 ObjectCommonElement.tag, |
| 54 SourceInsetElement.tag, |
| 55 SourceLinkElement.tag, |
| 56 ViewFooterElement.tag |
| 57 ]); |
| 58 |
| 59 RenderingScheduler<InstanceViewElement> _r; |
| 60 |
| 61 Stream<RenderedEvent<InstanceViewElement>> get onRendered => _r.onRendered; |
| 62 |
| 63 M.VM _vm; |
| 64 M.IsolateRef _isolate; |
| 65 M.EventRepository _events; |
| 66 M.NotificationRepository _notifications; |
| 67 M.Instance _instance; |
| 68 M.LibraryRef _library; |
| 69 M.InstanceRepository _instances; |
| 70 M.ClassRepository _classes; |
| 71 M.RetainedSizeRepository _retainedSizes; |
| 72 M.ReachableSizeRepository _reachableSizes; |
| 73 M.InboundReferencesRepository _references; |
| 74 M.RetainingPathRepository _retainingPaths; |
| 75 M.ScriptRepository _scripts; |
| 76 M.EvalRepository _eval; |
| 77 M.TypeArguments _typeArguments; |
| 78 M.TypeArgumentsRepository _arguments; |
| 79 M.BreakpointRepository _breakpoints; |
| 80 M.FunctionRepository _functions; |
| 81 M.SourceLocation _location; |
| 82 |
| 83 |
| 84 M.VMRef get vm => _vm; |
| 85 M.IsolateRef get isolate => _isolate; |
| 86 M.NotificationRepository get notifications => _notifications; |
| 87 M.Instance get instance => _instance; |
| 88 |
| 89 factory InstanceViewElement(M.VM vm, M.IsolateRef isolate, |
| 90 M.Instance instance, |
| 91 M.EventRepository events, |
| 92 M.NotificationRepository notifications, |
| 93 M.InstanceRepository instances, |
| 94 M.ClassRepository classes, |
| 95 M.RetainedSizeRepository retainedSizes, |
| 96 M.ReachableSizeRepository reachableSizes, |
| 97 M.InboundReferencesRepository references, |
| 98 M.RetainingPathRepository retainingPaths, |
| 99 M.ScriptRepository scripts, |
| 100 M.EvalRepository eval, |
| 101 M.TypeArgumentsRepository arguments, |
| 102 M.BreakpointRepository breakpoints, |
| 103 M.FunctionRepository functions, |
| 104 {RenderingQueue queue}) { |
| 105 assert(vm != null); |
| 106 assert(isolate != null); |
| 107 assert(events != null); |
| 108 assert(notifications != null); |
| 109 assert(instance != null); |
| 110 assert(instances != null); |
| 111 assert(classes != null); |
| 112 assert(retainedSizes != null); |
| 113 assert(reachableSizes != null); |
| 114 assert(references != null); |
| 115 assert(retainingPaths != null); |
| 116 assert(scripts != null); |
| 117 assert(eval != null); |
| 118 assert(arguments != null); |
| 119 assert(breakpoints != null); |
| 120 assert(functions != null); |
| 121 InstanceViewElement e = document.createElement(tag.name); |
| 122 e._r = new RenderingScheduler(e, queue: queue); |
| 123 e._vm = vm; |
| 124 e._isolate = isolate; |
| 125 e._events = events; |
| 126 e._notifications = notifications; |
| 127 e._instance = instance; |
| 128 e._instances = instances; |
| 129 e._classes = classes; |
| 130 e._retainedSizes = retainedSizes; |
| 131 e._reachableSizes = reachableSizes; |
| 132 e._references = references; |
| 133 e._retainingPaths = retainingPaths; |
| 134 e._scripts = scripts; |
| 135 e._eval = eval; |
| 136 e._arguments = arguments; |
| 137 e._breakpoints = breakpoints; |
| 138 e._functions = functions; |
| 139 return e; |
| 140 } |
15 | 141 |
16 InstanceViewElement.created() : super.created(); | 142 InstanceViewElement.created() : super.created(); |
17 | 143 |
18 instanceChanged(oldValue) { | 144 @override |
19 if (instance != null) { | 145 attached() { |
20 // We load typeClass and typeArguments because we want to | 146 super.attached(); |
21 // display this info. | 147 _r.enable(); |
22 if (instance.typeClass != null) { | 148 _loadExtraData(); |
23 instance.typeClass.load(); | 149 } |
| 150 |
| 151 @override |
| 152 detached() { |
| 153 super.detached(); |
| 154 _r.disable(notify: true); |
| 155 children = []; |
| 156 } |
| 157 |
| 158 void render() { |
| 159 final content = [ |
| 160 new HeadingElement.h2()..text = M.isAbstractType(_instance.kind) |
| 161 ? 'type ${_instance.name}' |
| 162 : 'instance of ${_instance.clazz.name}', |
| 163 new HRElement(), |
| 164 new ObjectCommonElement(_isolate, _instance, _retainedSizes, |
| 165 _reachableSizes, _references, _retainingPaths, |
| 166 _instances, queue: _r.queue), |
| 167 new BRElement(), |
| 168 new DivElement()..classes = const ['memberList'] |
| 169 ..children = _createMembers(), |
| 170 new HRElement(), |
| 171 new EvalBoxElement(_isolate, _instance, _instances, _eval, |
| 172 quickExpressions: const ['toString()', |
| 173 'runtimeType'], |
| 174 queue: _r.queue) |
| 175 ]; |
| 176 if (_location != null) { |
| 177 content.addAll([ |
| 178 new HRElement(), |
| 179 new SourceInsetElement(_isolate, _location, _scripts, _instances, |
| 180 _events, queue: _r.queue) |
| 181 ]); |
| 182 } |
| 183 content.addAll([ |
| 184 new HRElement(), |
| 185 new ViewFooterElement(queue: _r.queue) |
| 186 ]); |
| 187 children = [ |
| 188 new NavBarElement(queue: _r.queue) |
| 189 ..children = _createMenu(), |
| 190 new DivElement()..classes = const ['content-centered-big'] |
| 191 ..children = content |
| 192 ]; |
| 193 } |
| 194 |
| 195 List<Element> _createMenu() { |
| 196 final menu = [ |
| 197 new NavTopMenuElement(queue: _r.queue), |
| 198 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
| 199 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue) |
| 200 ]; |
| 201 if (_library != null) { |
| 202 menu.add(new NavLibraryMenuElement(_isolate, _library, |
| 203 queue: _r.queue)); |
| 204 } |
| 205 menu.addAll([ |
| 206 new NavClassMenuElement(_isolate, _instance.clazz, queue: _r.queue), |
| 207 new NavMenuElement('instance', last: true, queue: _r.queue), |
| 208 new NavRefreshElement(queue: _r.queue) |
| 209 ..onRefresh.listen((e) { |
| 210 e.element.disabled = true; |
| 211 _refresh(); |
| 212 }), |
| 213 new NavNotifyElement(_notifications, queue: _r.queue) |
| 214 ]); |
| 215 return menu; |
| 216 } |
| 217 |
| 218 List<Element> _createMembers() { |
| 219 final members = <Element>[]; |
| 220 if (_instance.valueAsString != null) { |
| 221 members.add(new DivElement()..classes = const ['memberItem'] |
| 222 ..children = [ |
| 223 new DivElement()..classes = const ['memberName'] |
| 224 ..text = _instance.kind == M.InstanceKind.string |
| 225 ? 'value as literal' |
| 226 : 'value', |
| 227 new DivElement()..classes = const ['memberValue'] |
| 228 ..text = _instance.kind == M.InstanceKind.string |
| 229 ? Utils.formatStringAsLiteral(_instance.valueAsString, |
| 230 _instance.valueAsStringIsTruncated) |
| 231 : _instance.valueAsString |
| 232 ]); |
| 233 } |
| 234 if (_instance.typeClass != null) { |
| 235 members.add(new DivElement()..classes = const ['memberItem'] |
| 236 ..children = [ |
| 237 new DivElement()..classes = const ['memberName'] |
| 238 ..text = 'type class', |
| 239 new DivElement()..classes = const ['memberValue'] |
| 240 ..children = [ |
| 241 new ClassRefElement(_isolate, _instance.typeClass, |
| 242 queue: _r.queue) |
| 243 ] |
| 244 ]); |
| 245 } |
| 246 if (_typeArguments != null && _typeArguments.types.isNotEmpty) { |
| 247 members.add(new DivElement()..classes = const ['memberItem'] |
| 248 ..children = [ |
| 249 new DivElement()..classes = const ['memberName'] |
| 250 ..text = 'type arguments', |
| 251 new DivElement()..classes = const ['memberValue'] |
| 252 ..children = ([ |
| 253 new SpanElement()..text = '< ' |
| 254 ] |
| 255 ..addAll(_typeArguments.types.expand((type) => [ |
| 256 new InstanceRefElement(_isolate, type, _instances, queue: |
| 257 _r.queue), |
| 258 new SpanElement()..text = ', ' |
| 259 ])) |
| 260 ..removeLast() |
| 261 ..add(new SpanElement()..text = ' >')) |
| 262 ]); |
| 263 } |
| 264 if (_instance.parameterizedClass != null) { |
| 265 members.add(new DivElement()..classes = const ['memberItem'] |
| 266 ..children = [ |
| 267 new DivElement()..classes = const ['memberName'] |
| 268 ..text = 'parameterized class', |
| 269 new DivElement()..classes = const ['memberValue'] |
| 270 ..children = [ |
| 271 new ClassRefElement(_isolate, _instance.parameterizedClass, |
| 272 queue: _r.queue) |
| 273 ] |
| 274 ]); |
| 275 } |
| 276 if (_instance.parameterIndex != null) { |
| 277 members.add(new DivElement()..classes = const ['memberItem'] |
| 278 ..children = [ |
| 279 new DivElement()..classes = const ['memberName'] |
| 280 ..text = 'parameter index', |
| 281 new DivElement()..classes = const ['memberValue'] |
| 282 ..text = '${_instance.parameterIndex}' |
| 283 ]); |
| 284 } |
| 285 if (_instance.targetType != null) { |
| 286 members.add(new DivElement()..classes = const ['memberItem'] |
| 287 ..children = [ |
| 288 new DivElement()..classes = const ['memberName'] |
| 289 ..text = 'target type', |
| 290 new DivElement()..classes = const ['memberValue'] |
| 291 ..children = [ |
| 292 new InstanceRefElement(_isolate, _instance.targetType, _instances, |
| 293 queue: _r.queue) |
| 294 ] |
| 295 ]); |
| 296 } |
| 297 if (_instance.bound != null) { |
| 298 members.add(new DivElement()..classes = const ['memberItem'] |
| 299 ..children = [ |
| 300 new DivElement()..classes = const ['memberName'] |
| 301 ..text = 'bound', |
| 302 new DivElement()..classes = const ['memberValue'] |
| 303 ..children = [ |
| 304 new InstanceRefElement(_isolate, _instance.bound, _instances, |
| 305 queue: _r.queue) |
| 306 ] |
| 307 ]); |
| 308 } |
| 309 if (_instance.closureFunction != null) { |
| 310 members.add(new DivElement()..classes = const ['memberItem'] |
| 311 ..children = [ |
| 312 new DivElement()..classes = const ['memberName'] |
| 313 ..text = 'closure function', |
| 314 new DivElement()..classes = const ['memberValue'] |
| 315 ..children = [ |
| 316 new FunctionRefElement(_isolate, _instance.closureFunction, |
| 317 queue: _r.queue) |
| 318 ] |
| 319 ]); |
| 320 } |
| 321 if (_instance.closureContext != null) { |
| 322 members.add(new DivElement()..classes = const ['memberItem'] |
| 323 ..children = [ |
| 324 new DivElement()..classes = const ['memberName'] |
| 325 ..text = 'closure context', |
| 326 new DivElement()..classes = const ['memberValue'] |
| 327 ..children = [ |
| 328 new ContextRefElement(_isolate, _instance.closureContext, |
| 329 queue: _r.queue) |
| 330 ] |
| 331 ]); |
| 332 } |
| 333 if (_instance.kind == M.InstanceKind.closure) { |
| 334 ButtonElement btn; |
| 335 members.add(new DivElement()..classes = const ['memberItem'] |
| 336 ..children = [ |
| 337 new DivElement()..classes = const ['memberName'] |
| 338 ..text = 'closure breakpoint', |
| 339 new DivElement()..classes = const ['memberValue'] |
| 340 ..children = [ |
| 341 btn = new ButtonElement() |
| 342 ..text = _instance.activationBreakpoint == null |
| 343 ? 'break on activation' |
| 344 : 'remove' |
| 345 ..onClick.listen((_) { |
| 346 btn.disabled = true; |
| 347 _toggleBreakpoint(); |
| 348 }) |
| 349 ] |
| 350 ]); |
| 351 } |
| 352 |
| 353 if (_instance.nativeFields != null && _instance.nativeFields.isNotEmpty) { |
| 354 int i = 0; |
| 355 members.add(new DivElement()..classes = const ['memberItem'] |
| 356 ..children = [ |
| 357 new DivElement()..classes = const ['memberName'] |
| 358 ..text = 'native fields (${_instance.nativeFields.length})', |
| 359 new DivElement()..classes = const ['memberName'] |
| 360 ..children = [ |
| 361 new CurlyBlockElement( |
| 362 expanded: _instance.nativeFields.length <= 100, |
| 363 queue: _r.queue) |
| 364 ..children = [ |
| 365 new DivElement()..classes = const ['memberList'] |
| 366 ..children = _instance.nativeFields.map((f) => |
| 367 new DivElement()..classes = const ['memberItem'] |
| 368 ..children = [ |
| 369 new DivElement()..classes = const ['memberName'] |
| 370 ..text = '[ ${i++} ]', |
| 371 new DivElement()..classes = const ['memberValue'] |
| 372 ..text = '[ ${f.value} ]' |
| 373 ]).toList() |
| 374 ] |
| 375 ] |
| 376 ]); |
| 377 } |
| 378 |
| 379 if (_instance.fields != null && _instance.fields.isNotEmpty) { |
| 380 final fields = _instance.fields.toList(); |
| 381 members.add(new DivElement()..classes = const ['memberItem'] |
| 382 ..children = [ |
| 383 new DivElement()..classes = const ['memberName'] |
| 384 ..text = 'fields (${fields.length})', |
| 385 new DivElement()..classes = const ['memberName'] |
| 386 ..children = [ |
| 387 new CurlyBlockElement( |
| 388 expanded: fields.length <= 100, |
| 389 queue: _r.queue) |
| 390 ..children = [ |
| 391 new DivElement()..classes = const ['memberList'] |
| 392 ..children = fields.map((f) => |
| 393 new DivElement()..classes = const ['memberItem'] |
| 394 ..children = [ |
| 395 new DivElement()..classes = const ['memberName'] |
| 396 ..children = [ |
| 397 new FieldRefElement(_isolate, f.decl, _instances, |
| 398 queue: _r.queue) |
| 399 ], |
| 400 new DivElement()..classes = const ['memberValue'] |
| 401 ..children = [ |
| 402 new SpanElement()..text = ' = ', |
| 403 anyRef(_isolate, f.value, _instances, |
| 404 queue: _r.queue) |
| 405 ] |
| 406 ]).toList() |
| 407 ] |
| 408 ] |
| 409 ]); |
| 410 } |
| 411 |
| 412 if (_instance.elements != null && _instance.elements.isNotEmpty) { |
| 413 final elements = _instance.elements.toList(); |
| 414 int i = 0; |
| 415 members.add(new DivElement()..classes = const ['memberItem'] |
| 416 ..children = [ |
| 417 new DivElement()..classes = const ['memberName'] |
| 418 ..text = 'elements (${_instance.length})', |
| 419 new DivElement()..classes = const ['memberValue'] |
| 420 ..children = [ |
| 421 new CurlyBlockElement( |
| 422 expanded: elements.length <= 100, |
| 423 queue: _r.queue) |
| 424 ..children = [ |
| 425 new DivElement()..classes = const ['memberList'] |
| 426 ..children = elements.map((e) => |
| 427 new DivElement()..classes = const ['memberItem'] |
| 428 ..children = [ |
| 429 new DivElement()..classes = const ['memberName'] |
| 430 ..text = '[ ${i++} ]', |
| 431 new DivElement()..classes = const ['memberValue'] |
| 432 ..children = [ |
| 433 anyRef(_isolate, e, _instances, |
| 434 queue: _r.queue) |
| 435 ] |
| 436 ]).toList() |
| 437 ] |
| 438 ] |
| 439 ]); |
| 440 if (_instance.length != elements.length) { |
| 441 members.add(new DivElement()..classes = const ['memberItem'] |
| 442 ..children = [ |
| 443 new DivElement()..classes = const ['memberName'] |
| 444 ..text = '...', |
| 445 new DivElement()..classes = const ['memberValue'] |
| 446 ..text = '${_instance.length - elements.length} omitted elements' |
| 447 ]); |
24 } | 448 } |
25 if (instance.typeArguments != null) { | 449 } |
26 instance.typeArguments.load(); | 450 |
| 451 if (_instance.associations != null && _instance.associations.isNotEmpty) { |
| 452 final associations = _instance.associations.toList(); |
| 453 members.add(new DivElement()..classes = const ['memberItem'] |
| 454 ..children = [ |
| 455 new DivElement()..classes = const ['memberName'] |
| 456 ..text = 'associations (${_instance.length})', |
| 457 new DivElement()..classes = const ['memberName'] |
| 458 ..children = [ |
| 459 new CurlyBlockElement( |
| 460 expanded: associations.length <= 100, |
| 461 queue: _r.queue) |
| 462 ..children = [ |
| 463 new DivElement()..classes = const ['memberList'] |
| 464 ..children = associations.map((a) => |
| 465 new DivElement()..classes = const ['memberItem'] |
| 466 ..children = [ |
| 467 new DivElement()..classes = const ['memberName'] |
| 468 ..children = [ |
| 469 new SpanElement()..text = '[ ', |
| 470 anyRef(_isolate, a.key, _instances, |
| 471 queue: _r.queue), |
| 472 new SpanElement()..text = ' ]', |
| 473 ], |
| 474 new DivElement()..classes = const ['memberValue'] |
| 475 ..children = [ |
| 476 anyRef(_isolate, a.value, _instances, |
| 477 queue: _r.queue) |
| 478 ] |
| 479 ]).toList() |
| 480 ] |
| 481 ] |
| 482 ]); |
| 483 if (_instance.length != associations.length) { |
| 484 members.add(new DivElement()..classes = const ['memberItem'] |
| 485 ..children = [ |
| 486 new DivElement()..classes = const ['memberName'] |
| 487 ..text = '...', |
| 488 new DivElement()..classes = const ['memberValue'] |
| 489 ..text = '${_instance.length - associations.length} ' |
| 490 'omitted elements' |
| 491 ]); |
27 } | 492 } |
28 } | 493 } |
29 } | 494 |
30 | 495 if (_instance.typedElements != null && _instance.typedElements.isNotEmpty) { |
31 Future<ServiceObject> evaluate(String expression) { | 496 final typedElements = _instance.typedElements.toList(); |
32 return instance.evaluate(expression); | 497 int i = 0; |
33 } | 498 members.add(new DivElement()..classes = const ['memberItem'] |
34 | 499 ..children = [ |
35 Future setBreakOnActivation() { | 500 new DivElement()..classes = const ['memberName'] |
36 return instance.isolate.addBreakOnActivation(instance) | 501 ..text = 'elements (${_instance.length})', |
37 .then((_) => refresh()); | 502 new DivElement()..classes = const ['memberValue'] |
38 } | 503 ..children = [ |
39 | 504 new CurlyBlockElement( |
40 Future clearBreakOnActivation() { | 505 expanded: typedElements.length <= 100, |
41 return instance.isolate.removeBreakpoint(instance.activationBreakpoint) | 506 queue: _r.queue) |
42 .then((_) => refresh()); | 507 ..children = [ |
43 } | 508 new DivElement()..classes = const ['memberList'] |
44 | 509 ..children = typedElements.map((e) => |
45 Future refresh() { | 510 new DivElement()..classes = const ['memberItem'] |
46 return instance.reload(); | 511 ..children = [ |
| 512 new DivElement()..classes = const ['memberName'] |
| 513 ..text = '[ ${i++} ]', |
| 514 new DivElement()..classes = const ['memberValue'] |
| 515 ..text = '$e' |
| 516 ]).toList() |
| 517 ] |
| 518 ] |
| 519 ]); |
| 520 if (_instance.length != typedElements.length) { |
| 521 members.add(new DivElement()..classes = const ['memberItem'] |
| 522 ..children = [ |
| 523 new DivElement()..classes = const ['memberName'] |
| 524 ..text = '...', |
| 525 new DivElement()..classes = const ['memberValue'] |
| 526 ..text = '${_instance.length - typedElements.length} ' |
| 527 'omitted elements' |
| 528 ]); |
| 529 } |
| 530 } |
| 531 |
| 532 if (_instance.kind == M.InstanceKind.regExp) { |
| 533 members.addAll([ |
| 534 new DivElement()..classes = const ['memberItem'] |
| 535 ..children = [ |
| 536 new DivElement()..classes = const ['memberName'] |
| 537 ..text = 'pattern', |
| 538 new DivElement()..classes = const ['memberValue'] |
| 539 ..children = [ |
| 540 anyRef(_isolate, _instance.pattern, _instances, queue: _r.queue) |
| 541 ] |
| 542 ], |
| 543 new DivElement()..classes = const ['memberItem'] |
| 544 ..children = [ |
| 545 new DivElement()..classes = const ['memberName'] |
| 546 ..text = 'isCaseSensitive', |
| 547 new DivElement()..classes = const ['memberValue'] |
| 548 ..text = _instance.isCaseSensitive ? 'yes' : 'no' |
| 549 ], |
| 550 new DivElement()..classes = const ['memberItem'] |
| 551 ..children = [ |
| 552 new DivElement()..classes = const ['memberName'] |
| 553 ..text = 'isMultiLine', |
| 554 new DivElement()..classes = const ['memberValue'] |
| 555 ..text = _instance.isMultiLine ? 'yes' : 'no' |
| 556 ], |
| 557 new DivElement()..classes = const ['memberItem'] |
| 558 ..children = [ |
| 559 new DivElement()..classes = const ['memberName'] |
| 560 ..text = 'oneByteFunction', |
| 561 new DivElement()..classes = const ['memberValue'] |
| 562 ..children = [ |
| 563 new FunctionRefElement(_isolate, _instance.oneByteFunction, |
| 564 queue: _r.queue) |
| 565 ] |
| 566 ], |
| 567 new DivElement()..classes = const ['memberItem'] |
| 568 ..children = [ |
| 569 new DivElement()..classes = const ['memberName'] |
| 570 ..text = 'twoByteFunction', |
| 571 new DivElement()..classes = const ['memberValue'] |
| 572 ..children = [ |
| 573 new FunctionRefElement(_isolate, _instance.twoByteFunction, |
| 574 queue: _r.queue) |
| 575 ] |
| 576 ], |
| 577 new DivElement()..classes = const ['memberItem'] |
| 578 ..children = [ |
| 579 new DivElement()..classes = const ['memberName'] |
| 580 ..text = 'externalOneByteFunction', |
| 581 new DivElement()..classes = const ['memberValue'] |
| 582 ..children = [ |
| 583 new FunctionRefElement(_isolate, |
| 584 _instance.externalOneByteFunction, |
| 585 queue: _r.queue) |
| 586 ] |
| 587 ], |
| 588 new DivElement()..classes = const ['memberItem'] |
| 589 ..children = [ |
| 590 new DivElement()..classes = const ['memberName'] |
| 591 ..text = 'externalTwoByteFunction', |
| 592 new DivElement()..classes = const ['memberValue'] |
| 593 ..children = [ |
| 594 new FunctionRefElement(_isolate, |
| 595 _instance.externalTwoByteFunction, |
| 596 queue: _r.queue) |
| 597 ] |
| 598 ], |
| 599 new DivElement()..classes = const ['memberItem'] |
| 600 ..children = [ |
| 601 new DivElement()..classes = const ['memberName'] |
| 602 ..text = 'oneByteBytecode', |
| 603 new DivElement()..classes = const ['memberValue'] |
| 604 ..children = [ |
| 605 new InstanceRefElement(_isolate, _instance.oneByteBytecode, |
| 606 _instances, queue: _r.queue) |
| 607 ] |
| 608 ], |
| 609 new DivElement()..classes = const ['memberItem'] |
| 610 ..children = [ |
| 611 new DivElement()..classes = const ['memberName'] |
| 612 ..text = 'twoByteBytecode', |
| 613 new DivElement()..classes = const ['memberValue'] |
| 614 ..children = [ |
| 615 new InstanceRefElement(_isolate, _instance.twoByteBytecode, |
| 616 _instances, queue: _r.queue) |
| 617 ] |
| 618 ] |
| 619 ]); |
| 620 } |
| 621 |
| 622 if (_instance.kind == M.InstanceKind.mirrorReference) { |
| 623 members.add(new DivElement()..classes = const ['memberItem'] |
| 624 ..children = [ |
| 625 new DivElement()..classes = const ['memberName'] |
| 626 ..text = 'referent', |
| 627 new DivElement()..classes = const ['memberValue'] |
| 628 ..children = [ |
| 629 new ContextRefElement(_isolate, _instance.referent, |
| 630 queue: _r.queue) |
| 631 ] |
| 632 ]); |
| 633 } |
| 634 if (_instance.kind == M.InstanceKind.weakProperty) { |
| 635 members.addAll([ |
| 636 new DivElement()..classes = const ['memberItem'] |
| 637 ..children = [ |
| 638 new DivElement()..classes = const ['memberName'] |
| 639 ..text = 'key', |
| 640 new DivElement()..classes = const ['memberValue'] |
| 641 ..children = [ |
| 642 new InstanceRefElement(_isolate, _instance.key, _instances, |
| 643 queue: _r.queue), |
| 644 ] |
| 645 ], |
| 646 new DivElement()..classes = const ['memberItem'] |
| 647 ..children = [ |
| 648 new DivElement()..classes = const ['memberName'] |
| 649 ..text = 'value', |
| 650 new DivElement()..classes = const ['memberValue'] |
| 651 ..children = [ |
| 652 new InstanceRefElement(_isolate, _instance.value, _instances, |
| 653 queue: _r.queue), |
| 654 ] |
| 655 ] |
| 656 ]); |
| 657 } |
| 658 return members; |
| 659 } |
| 660 |
| 661 Future _refresh() async { |
| 662 _instance = await _instances.get(_isolate, _instance.id); |
| 663 await _loadExtraData(); |
| 664 _r.dirty(); |
| 665 } |
| 666 |
| 667 Future _loadExtraData() async { |
| 668 _library = (await _classes.get(_isolate, _instance.clazz.id)).library; |
| 669 if (_instance.typeArguments != null) { |
| 670 _typeArguments = await _arguments.get(_isolate, |
| 671 _instance.typeArguments.id); |
| 672 } else { |
| 673 _typeArguments = null; |
| 674 } |
| 675 if (_instance.closureFunction != null) { |
| 676 _location = (await _functions.get(_isolate, |
| 677 _instance.closureFunction.id)).location; |
| 678 } else if (_instance.typeClass != null) { |
| 679 _location = (await _classes.get(_isolate, |
| 680 _instance.typeClass.id)).location; |
| 681 } |
| 682 _r.dirty(); |
| 683 } |
| 684 |
| 685 Future _toggleBreakpoint() async { |
| 686 if (_instance.activationBreakpoint == null) { |
| 687 await _breakpoints.addOnActivation(_isolate, _instance); |
| 688 } else { |
| 689 await _breakpoints.remove(_isolate, _instance.activationBreakpoint); |
| 690 } |
| 691 await _refresh(); |
47 } | 692 } |
48 } | 693 } |
OLD | NEW |