Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: runtime/observatory/lib/src/elements/instance_view.dart

Issue 2310003004: Removed polymer & mirror from Observatory (Closed)
Patch Set: Fixed crash in heap-map page Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 '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';
11 import 'package:observatory/src/elements/context_ref.dart'; 11 import 'package:observatory/src/elements/context_ref.dart';
12 import 'package:observatory/src/elements/curly_block.dart'; 12 import 'package:observatory/src/elements/curly_block.dart';
13 import 'package:observatory/src/elements/eval_box.dart'; 13 import 'package:observatory/src/elements/eval_box.dart';
14 import 'package:observatory/src/elements/field_ref.dart'; 14 import 'package:observatory/src/elements/field_ref.dart';
15 import 'package:observatory/src/elements/function_ref.dart'; 15 import 'package:observatory/src/elements/function_ref.dart';
16 import 'package:observatory/src/elements/helpers/any_ref.dart'; 16 import 'package:observatory/src/elements/helpers/any_ref.dart';
17 import 'package:observatory/src/elements/helpers/nav_bar.dart';
18 import 'package:observatory/src/elements/helpers/nav_menu.dart';
17 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 19 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
18 import 'package:observatory/src/elements/helpers/tag.dart'; 20 import 'package:observatory/src/elements/helpers/tag.dart';
19 import 'package:observatory/src/elements/instance_ref.dart'; 21 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/class_menu.dart';
22 import 'package:observatory/src/elements/nav/isolate_menu.dart'; 23 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/library_menu.dart';
24 import 'package:observatory/src/elements/nav/menu.dart';
25 import 'package:observatory/src/elements/nav/notify.dart'; 25 import 'package:observatory/src/elements/nav/notify.dart';
26 import 'package:observatory/src/elements/nav/refresh.dart'; 26 import 'package:observatory/src/elements/nav/refresh.dart';
27 import 'package:observatory/src/elements/nav/top_menu.dart'; 27 import 'package:observatory/src/elements/nav/top_menu.dart';
28 import 'package:observatory/src/elements/nav/vm_menu.dart'; 28 import 'package:observatory/src/elements/nav/vm_menu.dart';
29 import 'package:observatory/src/elements/object_common.dart'; 29 import 'package:observatory/src/elements/object_common.dart';
30 import 'package:observatory/src/elements/source_inset.dart'; 30 import 'package:observatory/src/elements/source_inset.dart';
31 import 'package:observatory/src/elements/source_link.dart'; 31 import 'package:observatory/src/elements/source_link.dart';
32 import 'package:observatory/src/elements/view_footer.dart'; 32 import 'package:observatory/src/elements/view_footer.dart';
33 import 'package:observatory/utils.dart'; 33 import 'package:observatory/utils.dart';
34 34
35 class InstanceViewElement extends HtmlElement implements Renderable { 35 class InstanceViewElement extends HtmlElement implements Renderable {
36 static const tag = const Tag<InstanceViewElement>('instance-view', 36 static const tag = const Tag<InstanceViewElement>('instance-view',
37 dependencies: const [ 37 dependencies: const [
38 ClassRefElement.tag, 38 ClassRefElement.tag,
39 ContextRefElement.tag, 39 ContextRefElement.tag,
40 CurlyBlockElement.tag, 40 CurlyBlockElement.tag,
41 FieldRefElement.tag, 41 FieldRefElement.tag,
42 FunctionRefElement.tag, 42 FunctionRefElement.tag,
43 InstanceRefElement.tag, 43 InstanceRefElement.tag,
44 NavBarElement.tag,
45 NavClassMenuElement.tag, 44 NavClassMenuElement.tag,
46 NavLibraryMenuElement.tag, 45 NavLibraryMenuElement.tag,
47 NavTopMenuElement.tag, 46 NavTopMenuElement.tag,
48 NavVMMenuElement.tag, 47 NavVMMenuElement.tag,
49 NavIsolateMenuElement.tag, 48 NavIsolateMenuElement.tag,
50 NavMenuElement.tag,
51 NavRefreshElement.tag, 49 NavRefreshElement.tag,
52 NavNotifyElement.tag, 50 NavNotifyElement.tag,
53 ObjectCommonElement.tag, 51 ObjectCommonElement.tag,
54 SourceInsetElement.tag, 52 SourceInsetElement.tag,
55 SourceLinkElement.tag, 53 SourceLinkElement.tag,
56 ViewFooterElement.tag 54 ViewFooterElement.tag
57 ]); 55 ]);
58 56
59 RenderingScheduler<InstanceViewElement> _r; 57 RenderingScheduler<InstanceViewElement> _r;
60 58
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 new HRElement(), 176 new HRElement(),
179 new SourceInsetElement(_isolate, _location, _scripts, _instances, 177 new SourceInsetElement(_isolate, _location, _scripts, _instances,
180 _events, queue: _r.queue) 178 _events, queue: _r.queue)
181 ]); 179 ]);
182 } 180 }
183 content.addAll([ 181 content.addAll([
184 new HRElement(), 182 new HRElement(),
185 new ViewFooterElement(queue: _r.queue) 183 new ViewFooterElement(queue: _r.queue)
186 ]); 184 ]);
187 children = [ 185 children = [
188 new NavBarElement(queue: _r.queue) 186 navBar(_createMenu()),
189 ..children = _createMenu(),
190 new DivElement()..classes = ['content-centered-big'] 187 new DivElement()..classes = ['content-centered-big']
191 ..children = content 188 ..children = content
192 ]; 189 ];
193 } 190 }
194 191
195 List<Element> _createMenu() { 192 List<Element> _createMenu() {
196 final menu = [ 193 final menu = [
197 new NavTopMenuElement(queue: _r.queue), 194 new NavTopMenuElement(queue: _r.queue),
198 new NavVMMenuElement(_vm, _events, queue: _r.queue), 195 new NavVMMenuElement(_vm, _events, queue: _r.queue),
199 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue) 196 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue)
200 ]; 197 ];
201 if (_library != null) { 198 if (_library != null) {
202 menu.add(new NavLibraryMenuElement(_isolate, _library, 199 menu.add(new NavLibraryMenuElement(_isolate, _library,
203 queue: _r.queue)); 200 queue: _r.queue));
204 } 201 }
205 menu.addAll([ 202 menu.addAll([
206 new NavClassMenuElement(_isolate, _instance.clazz, queue: _r.queue), 203 new NavClassMenuElement(_isolate, _instance.clazz, queue: _r.queue),
207 new NavMenuElement('instance', last: true, queue: _r.queue), 204 navMenu('instance'),
208 new NavRefreshElement(queue: _r.queue) 205 new NavRefreshElement(queue: _r.queue)
209 ..onRefresh.listen((e) { 206 ..onRefresh.listen((e) {
210 e.element.disabled = true; 207 e.element.disabled = true;
211 _refresh(); 208 _refresh();
212 }), 209 }),
213 new NavNotifyElement(_notifications, queue: _r.queue) 210 new NavNotifyElement(_notifications, queue: _r.queue)
214 ]); 211 ]);
215 return menu; 212 return menu;
216 } 213 }
217 214
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 int i = 0; 351 int i = 0;
355 members.add(new DivElement()..classes = ['memberItem'] 352 members.add(new DivElement()..classes = ['memberItem']
356 ..children = [ 353 ..children = [
357 new DivElement()..classes = ['memberName'] 354 new DivElement()..classes = ['memberName']
358 ..text = 'native fields (${_instance.nativeFields.length})', 355 ..text = 'native fields (${_instance.nativeFields.length})',
359 new DivElement()..classes = ['memberName'] 356 new DivElement()..classes = ['memberName']
360 ..children = [ 357 ..children = [
361 new CurlyBlockElement( 358 new CurlyBlockElement(
362 expanded: _instance.nativeFields.length <= 100, 359 expanded: _instance.nativeFields.length <= 100,
363 queue: _r.queue) 360 queue: _r.queue)
364 ..children = [ 361 ..content = [
365 new DivElement()..classes = ['memberList'] 362 new DivElement()..classes = ['memberList']
366 ..children = _instance.nativeFields.map((f) => 363 ..children = _instance.nativeFields.map((f) =>
367 new DivElement()..classes = ['memberItem'] 364 new DivElement()..classes = ['memberItem']
368 ..children = [ 365 ..children = [
369 new DivElement()..classes = ['memberName'] 366 new DivElement()..classes = ['memberName']
370 ..text = '[ ${i++} ]', 367 ..text = '[ ${i++} ]',
371 new DivElement()..classes = ['memberValue'] 368 new DivElement()..classes = ['memberValue']
372 ..text = '[ ${f.value} ]' 369 ..text = '[ ${f.value} ]'
373 ]).toList() 370 ]).toList()
374 ] 371 ]
375 ] 372 ]
376 ]); 373 ]);
377 } 374 }
378 375
379 if (_instance.fields != null && _instance.fields.isNotEmpty) { 376 if (_instance.fields != null && _instance.fields.isNotEmpty) {
380 final fields = _instance.fields.toList(); 377 final fields = _instance.fields.toList();
381 members.add(new DivElement()..classes = ['memberItem'] 378 members.add(new DivElement()..classes = ['memberItem']
382 ..children = [ 379 ..children = [
383 new DivElement()..classes = ['memberName'] 380 new DivElement()..classes = ['memberName']
384 ..text = 'fields (${fields.length})', 381 ..text = 'fields (${fields.length})',
385 new DivElement()..classes = ['memberName'] 382 new DivElement()..classes = ['memberName']
386 ..children = [ 383 ..children = [
387 new CurlyBlockElement( 384 new CurlyBlockElement(
388 expanded: fields.length <= 100, 385 expanded: fields.length <= 100,
389 queue: _r.queue) 386 queue: _r.queue)
390 ..children = [ 387 ..content = [
391 new DivElement()..classes = ['memberList'] 388 new DivElement()..classes = ['memberList']
392 ..children = fields.map((f) => 389 ..children = fields.map((f) =>
393 new DivElement()..classes = ['memberItem'] 390 new DivElement()..classes = ['memberItem']
394 ..children = [ 391 ..children = [
395 new DivElement()..classes = ['memberName'] 392 new DivElement()..classes = ['memberName']
396 ..children = [ 393 ..children = [
397 new FieldRefElement(_isolate, f.decl, _instances, 394 new FieldRefElement(_isolate, f.decl, _instances,
398 queue: _r.queue) 395 queue: _r.queue)
399 ], 396 ],
400 new DivElement()..classes = ['memberValue'] 397 new DivElement()..classes = ['memberValue']
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 final associations = _instance.associations.toList(); 449 final associations = _instance.associations.toList();
453 members.add(new DivElement()..classes = ['memberItem'] 450 members.add(new DivElement()..classes = ['memberItem']
454 ..children = [ 451 ..children = [
455 new DivElement()..classes = ['memberName'] 452 new DivElement()..classes = ['memberName']
456 ..text = 'associations (${_instance.length})', 453 ..text = 'associations (${_instance.length})',
457 new DivElement()..classes = ['memberName'] 454 new DivElement()..classes = ['memberName']
458 ..children = [ 455 ..children = [
459 new CurlyBlockElement( 456 new CurlyBlockElement(
460 expanded: associations.length <= 100, 457 expanded: associations.length <= 100,
461 queue: _r.queue) 458 queue: _r.queue)
462 ..children = [ 459 ..content = [
463 new DivElement()..classes = ['memberList'] 460 new DivElement()..classes = ['memberList']
464 ..children = associations.map((a) => 461 ..children = associations.map((a) =>
465 new DivElement()..classes = ['memberItem'] 462 new DivElement()..classes = ['memberItem']
466 ..children = [ 463 ..children = [
467 new DivElement()..classes = ['memberName'] 464 new DivElement()..classes = ['memberName']
468 ..children = [ 465 ..children = [
469 new SpanElement()..text = '[ ', 466 new SpanElement()..text = '[ ',
470 anyRef(_isolate, a.key, _instances, 467 anyRef(_isolate, a.key, _instances,
471 queue: _r.queue), 468 queue: _r.queue),
472 new SpanElement()..text = ' ]', 469 new SpanElement()..text = ' ]',
(...skipping 24 matching lines...) Expand all
497 int i = 0; 494 int i = 0;
498 members.add(new DivElement()..classes = ['memberItem'] 495 members.add(new DivElement()..classes = ['memberItem']
499 ..children = [ 496 ..children = [
500 new DivElement()..classes = ['memberName'] 497 new DivElement()..classes = ['memberName']
501 ..text = 'elements (${_instance.length})', 498 ..text = 'elements (${_instance.length})',
502 new DivElement()..classes = ['memberValue'] 499 new DivElement()..classes = ['memberValue']
503 ..children = [ 500 ..children = [
504 new CurlyBlockElement( 501 new CurlyBlockElement(
505 expanded: typedElements.length <= 100, 502 expanded: typedElements.length <= 100,
506 queue: _r.queue) 503 queue: _r.queue)
507 ..children = [ 504 ..content = [
508 new DivElement()..classes = ['memberList'] 505 new DivElement()..classes = ['memberList']
509 ..children = typedElements.map((e) => 506 ..children = typedElements.map((e) =>
510 new DivElement()..classes = ['memberItem'] 507 new DivElement()..classes = ['memberItem']
511 ..children = [ 508 ..children = [
512 new DivElement()..classes = ['memberName'] 509 new DivElement()..classes = ['memberName']
513 ..text = '[ ${i++} ]', 510 ..text = '[ ${i++} ]',
514 new DivElement()..classes = ['memberValue'] 511 new DivElement()..classes = ['memberValue']
515 ..text = '$e' 512 ..text = '$e'
516 ]).toList() 513 ]).toList()
517 ] 514 ]
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 681
685 Future _toggleBreakpoint() async { 682 Future _toggleBreakpoint() async {
686 if (_instance.activationBreakpoint == null) { 683 if (_instance.activationBreakpoint == null) {
687 await _breakpoints.addOnActivation(_isolate, _instance); 684 await _breakpoints.addOnActivation(_isolate, _instance);
688 } else { 685 } else {
689 await _breakpoints.remove(_isolate, _instance.activationBreakpoint); 686 await _breakpoints.remove(_isolate, _instance.activationBreakpoint);
690 } 687 }
691 await _refresh(); 688 await _refresh();
692 } 689 }
693 } 690 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698