| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:html'; | 5 import 'dart:html'; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
| 8 import 'package:observatory/src/elements/curly_block.dart'; | 8 import 'package:observatory/src/elements/curly_block.dart'; |
| 9 import 'package:observatory/src/elements/instance_ref.dart'; | 9 import 'package:observatory/src/elements/instance_ref.dart'; |
| 10 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 10 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
| 12 import 'package:observatory/src/elements/helpers/tag.dart'; | 12 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 13 import 'package:observatory/utils.dart'; | 13 import 'package:observatory/utils.dart'; |
| 14 | 14 |
| 15 class TopRetainingInstancesElement extends HtmlElement implements Renderable { | 15 class TopRetainingInstancesElement extends HtmlElement implements Renderable { |
| 16 static const tag = const Tag<TopRetainingInstancesElement>( | 16 static const tag = const Tag<TopRetainingInstancesElement>( |
| 17 'top-retainig-instances', | 17 'top-retainig-instances', |
| 18 dependencies: const [CurlyBlockElement.tag, InstanceRefElement.tag]); | 18 dependencies: const [CurlyBlockElement.tag, InstanceRefElement.tag]); |
| 19 | 19 |
| 20 RenderingScheduler<TopRetainingInstancesElement> _r; | 20 RenderingScheduler<TopRetainingInstancesElement> _r; |
| 21 | 21 |
| 22 Stream<RenderedEvent<TopRetainingInstancesElement>> get onRendered => | 22 Stream<RenderedEvent<TopRetainingInstancesElement>> get onRendered => |
| 23 _r.onRendered; | 23 _r.onRendered; |
| 24 | 24 |
| 25 M.IsolateRef _isolate; | 25 M.IsolateRef _isolate; |
| 26 M.ClassRef _cls; | 26 M.ClassRef _cls; |
| 27 M.TopRetainingInstancesRepository _topRetainingInstances; | 27 M.TopRetainingInstancesRepository _topRetainingInstances; |
| 28 M.InstanceRepository _instances; | 28 M.ObjectRepository _objects; |
| 29 Iterable<M.RetainingObject> _topRetaining; | 29 Iterable<M.RetainingObject> _topRetaining; |
| 30 bool _expanded = false; | 30 bool _expanded = false; |
| 31 | 31 |
| 32 M.IsolateRef get isolate => _isolate; | 32 M.IsolateRef get isolate => _isolate; |
| 33 M.ClassRef get cls => _cls; | 33 M.ClassRef get cls => _cls; |
| 34 | 34 |
| 35 factory TopRetainingInstancesElement( | 35 factory TopRetainingInstancesElement( |
| 36 M.IsolateRef isolate, | 36 M.IsolateRef isolate, |
| 37 M.ClassRef cls, | 37 M.ClassRef cls, |
| 38 M.TopRetainingInstancesRepository topRetainingInstances, | 38 M.TopRetainingInstancesRepository topRetainingInstances, |
| 39 M.InstanceRepository instances, | 39 M.ObjectRepository objects, |
| 40 {RenderingQueue queue}) { | 40 {RenderingQueue queue}) { |
| 41 assert(isolate != null); | 41 assert(isolate != null); |
| 42 assert(cls != null); | 42 assert(cls != null); |
| 43 assert(topRetainingInstances != null); | 43 assert(topRetainingInstances != null); |
| 44 assert(instances != null); | 44 assert(objects != null); |
| 45 TopRetainingInstancesElement e = document.createElement(tag.name); | 45 TopRetainingInstancesElement e = document.createElement(tag.name); |
| 46 e._r = new RenderingScheduler(e, queue: queue); | 46 e._r = new RenderingScheduler(e, queue: queue); |
| 47 e._isolate = isolate; | 47 e._isolate = isolate; |
| 48 e._cls = cls; | 48 e._cls = cls; |
| 49 e._topRetainingInstances = topRetainingInstances; | 49 e._topRetainingInstances = topRetainingInstances; |
| 50 e._instances = instances; | 50 e._objects = objects; |
| 51 return e; | 51 return e; |
| 52 } | 52 } |
| 53 | 53 |
| 54 TopRetainingInstancesElement.created() : super.created(); | 54 TopRetainingInstancesElement.created() : super.created(); |
| 55 | 55 |
| 56 @override | 56 @override |
| 57 void attached() { | 57 void attached() { |
| 58 super.attached(); | 58 super.attached(); |
| 59 _r.enable(); | 59 _r.enable(); |
| 60 } | 60 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return _topRetaining | 98 return _topRetaining |
| 99 .map((r) => new DivElement() | 99 .map((r) => new DivElement() |
| 100 ..classes = ['memberItem'] | 100 ..classes = ['memberItem'] |
| 101 ..children = [ | 101 ..children = [ |
| 102 new DivElement() | 102 new DivElement() |
| 103 ..classes = ['memberName'] | 103 ..classes = ['memberName'] |
| 104 ..text = '${Utils.formatSize(r.retainedSize)} ', | 104 ..text = '${Utils.formatSize(r.retainedSize)} ', |
| 105 new DivElement() | 105 new DivElement() |
| 106 ..classes = ['memberValue'] | 106 ..classes = ['memberValue'] |
| 107 ..children = [ | 107 ..children = [ |
| 108 anyRef(_isolate, r.object, _instances, queue: _r.queue) | 108 anyRef(_isolate, r.object, _objects, queue: _r.queue) |
| 109 ] | 109 ] |
| 110 ]) | 110 ]) |
| 111 .toList(); | 111 .toList(); |
| 112 } | 112 } |
| 113 } | 113 } |
| OLD | NEW |