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

Unified Diff: runtime/observatory/lib/src/elements/class_instances.dart

Issue 2294073003: Converted Observatory class-view element (Closed)
Patch Set: Addressed comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/class_instances.dart
diff --git a/runtime/observatory/lib/src/elements/object_common.dart b/runtime/observatory/lib/src/elements/class_instances.dart
similarity index 61%
copy from runtime/observatory/lib/src/elements/object_common.dart
copy to runtime/observatory/lib/src/elements/class_instances.dart
index 3e40ca2b04716b04241f17e429e165f7d1f1bf04..4b2903233403cb124e192b4ee0ada120150be0a3 100644
--- a/runtime/observatory/lib/src/elements/object_common.dart
+++ b/runtime/observatory/lib/src/elements/class_instances.dart
@@ -11,27 +11,29 @@ import 'package:observatory/src/elements/helpers/tag.dart';
import 'package:observatory/src/elements/inbound_references.dart';
import 'package:observatory/src/elements/retaining_path.dart';
import 'package:observatory/src/elements/sentinel_value.dart';
+import 'package:observatory/src/elements/strongly_reachable_instances.dart';
+import 'package:observatory/src/elements/top_retaining_instances.dart';
import 'package:observatory/utils.dart';
-class ObjectCommonElement extends HtmlElement implements Renderable {
- static const tag = const Tag<ObjectCommonElement>('object-common-wrapped',
+class ClassInstancesElement extends HtmlElement implements Renderable {
+ static const tag = const Tag<ClassInstancesElement>('class-instances',
dependencies: const [
ClassRefElement.tag,
InboundReferencesElement.tag,
RetainingPathElement.tag,
- SentinelValueElement.tag
+ TopRetainingInstancesElement.tag
]);
- RenderingScheduler<ObjectCommonElement> _r;
+ RenderingScheduler<ClassInstancesElement> _r;
- Stream<RenderedEvent<ObjectCommonElement>> get onRendered => _r.onRendered;
+ Stream<RenderedEvent<ClassInstancesElement>> get onRendered => _r.onRendered;
M.IsolateRef _isolate;
- M.Object _object;
+ M.Class _cls;
M.RetainedSizeRepository _retainedSizes;
M.ReachableSizeRepository _reachableSizes;
- M.InboundReferencesRepository _references;
- M.RetainingPathRepository _retainingPaths;
+ M.StronglyReachableInstancesRepository _stronglyReachableInstances;
+ M.TopRetainingInstancesRepository _topRetainingInstances;
M.InstanceRepository _instances;
M.Guarded<M.Instance> _retainedSize = null;
bool _loadingRetainedBytes = false;
@@ -39,35 +41,35 @@ class ObjectCommonElement extends HtmlElement implements Renderable {
bool _loadingReachableBytes = false;
M.IsolateRef get isolate => _isolate;
- M.Object get object => _object;
+ M.Class get cls => _cls;
- factory ObjectCommonElement(M.IsolateRef isolate, M.Object object,
- M.RetainedSizeRepository retainedSizes,
- M.ReachableSizeRepository reachableSizes,
- M.InboundReferencesRepository references,
- M.RetainingPathRepository retainingPaths,
- M.InstanceRepository instances,
- {RenderingQueue queue}) {
+ factory ClassInstancesElement(M.IsolateRef isolate, M.Class cls,
+ M.RetainedSizeRepository retainedSizes,
+ M.ReachableSizeRepository reachableSizes,
+ M.StronglyReachableInstancesRepository stronglyReachableInstances,
+ M.TopRetainingInstancesRepository topRetainingInstances,
+ M.InstanceRepository instances,
+ {RenderingQueue queue}) {
assert(isolate != null);
- assert(object != null);
+ assert(cls != null);
assert(retainedSizes != null);
assert(reachableSizes != null);
- assert(references != null);
- assert(retainingPaths != null);
+ assert(stronglyReachableInstances != null);
+ assert(topRetainingInstances != null);
assert(instances != null);
- ObjectCommonElement e = document.createElement(tag.name);
+ ClassInstancesElement e = document.createElement(tag.name);
e._r = new RenderingScheduler(e, queue: queue);
e._isolate = isolate;
- e._object = object;
+ e._cls = cls;
e._retainedSizes = retainedSizes;
e._reachableSizes = reachableSizes;
- e._references = references;
+ e._stronglyReachableInstances = stronglyReachableInstances;
+ e._topRetainingInstances = topRetainingInstances;
e._instances = instances;
- e._retainingPaths = retainingPaths;
return e;
}
- ObjectCommonElement.created() : super.created();
+ ClassInstancesElement.created() : super.created();
@override
void attached() {
@@ -82,39 +84,34 @@ class ObjectCommonElement extends HtmlElement implements Renderable {
children = [];
}
- RetainingPathElement _path;
- InboundReferencesElement _inbounds;
+ StronglyReachableInstancesElement _strong;
+ TopRetainingInstancesElement _topRetainig;
void render() {
- _path = _path ?? new RetainingPathElement(_isolate, _object,
- _retainingPaths, _instances,
- queue: _r.queue);
- _inbounds = _inbounds ?? new InboundReferencesElement(_isolate, _object,
- _references,
- _instances,
- queue: _r.queue);
+ _strong = _strong ?? new StronglyReachableInstancesElement(_isolate,
+ _cls, _stronglyReachableInstances, _instances, queue: _r.queue);
+ _topRetainig = _topRetainig ?? new TopRetainingInstancesElement(_isolate,
+ _cls, _topRetainingInstances, _instances, queue: _r.queue);
+ final instanceCount = _cls.newSpace.current.instances +
+ _cls.oldSpace.current.instances;
+ final size = Utils.formatSize(_cls.newSpace.current.bytes +
+ _cls.oldSpace.current.bytes);
children = [
new DivElement()..classes = ['memberList']
..children = [
- new DivElement()..classes = ['memberItem']
+ new DivElement()..classes = const ['memberItem']
..children = [
- new DivElement()..classes = ['memberName']
- ..text = 'Class ',
- new DivElement()..classes = ['memberValue']
- ..children = [
- _object.clazz == null
- ? (new SpanElement()..text = '...')
- : new ClassRefElement(_isolate, _object.clazz,
- queue: _r.queue)
- ]
+ new DivElement()..classes = const ['memberName']
+ ..text = 'currently allocated',
+ new DivElement()..classes = const ['memberValue']
+ ..text = 'count ${instanceCount} (shallow size ${size})'
],
new DivElement()..classes = ['memberItem']
- ..title = 'Space for this object in memory'
..children = [
new DivElement()..classes = ['memberName']
- ..text = 'Shallow size ',
+ ..text = 'strongly reachable ',
new DivElement()..classes = ['memberValue']
- ..text = Utils.formatSize(_object.size ?? 0)
+ ..children = [_strong]
],
new DivElement()..classes = ['memberItem']
..title = 'Space reachable from this object, '
@@ -137,17 +134,9 @@ class ObjectCommonElement extends HtmlElement implements Renderable {
new DivElement()..classes = ['memberItem']
..children = [
new DivElement()..classes = ['memberName']
- ..text = 'Retaining path ',
- new DivElement()..classes = ['memberValue']
- ..children = [_path]
- ],
- new DivElement()..classes = ['memberItem']
- ..title = 'Objects which directly reference this object'
- ..children = [
- new DivElement()..classes = ['memberName']
- ..text = 'Inbound references ',
+ ..text = 'toplist by retained memory ',
new DivElement()..classes = ['memberValue']
- ..children = [_inbounds]
+ ..children = [_topRetainig]
]
]
];
@@ -177,7 +166,7 @@ class ObjectCommonElement extends HtmlElement implements Renderable {
button.onClick.listen((_) async {
button.disabled = true;
_loadingReachableBytes = true;
- _reachableSize = await _reachableSizes.get(_isolate, _object.id);
+ _reachableSize = await _reachableSizes.get(_isolate, _cls.id);
_r.dirty();
});
content.add(button);
@@ -208,7 +197,7 @@ class ObjectCommonElement extends HtmlElement implements Renderable {
button.onClick.listen((_) async {
button.disabled = true;
_loadingRetainedBytes = true;
- _retainedSize = await _retainedSizes.get(_isolate, _object.id);
+ _retainedSize = await _retainedSizes.get(_isolate, _cls.id);
_r.dirty();
});
content.add(button);

Powered by Google App Engine
This is Rietveld 408576698