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 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/class_ref.dart'; | 8 import 'package:observatory/src/elements/class_ref.dart'; |
9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
10 import 'package:observatory/src/elements/helpers/tag.dart'; | 10 import 'package:observatory/src/elements/helpers/tag.dart'; |
(...skipping 16 matching lines...) Expand all Loading... |
27 RenderingScheduler<ClassInstancesElement> _r; | 27 RenderingScheduler<ClassInstancesElement> _r; |
28 | 28 |
29 Stream<RenderedEvent<ClassInstancesElement>> get onRendered => _r.onRendered; | 29 Stream<RenderedEvent<ClassInstancesElement>> get onRendered => _r.onRendered; |
30 | 30 |
31 M.IsolateRef _isolate; | 31 M.IsolateRef _isolate; |
32 M.Class _cls; | 32 M.Class _cls; |
33 M.RetainedSizeRepository _retainedSizes; | 33 M.RetainedSizeRepository _retainedSizes; |
34 M.ReachableSizeRepository _reachableSizes; | 34 M.ReachableSizeRepository _reachableSizes; |
35 M.StronglyReachableInstancesRepository _stronglyReachableInstances; | 35 M.StronglyReachableInstancesRepository _stronglyReachableInstances; |
36 M.TopRetainingInstancesRepository _topRetainingInstances; | 36 M.TopRetainingInstancesRepository _topRetainingInstances; |
37 M.InstanceRepository _instances; | 37 M.ObjectRepository _objects; |
38 M.Guarded<M.Instance> _retainedSize = null; | 38 M.Guarded<M.Instance> _retainedSize = null; |
39 bool _loadingRetainedBytes = false; | 39 bool _loadingRetainedBytes = false; |
40 M.Guarded<M.Instance> _reachableSize = null; | 40 M.Guarded<M.Instance> _reachableSize = null; |
41 bool _loadingReachableBytes = false; | 41 bool _loadingReachableBytes = false; |
42 | 42 |
43 M.IsolateRef get isolate => _isolate; | 43 M.IsolateRef get isolate => _isolate; |
44 M.Class get cls => _cls; | 44 M.Class get cls => _cls; |
45 | 45 |
46 factory ClassInstancesElement( | 46 factory ClassInstancesElement( |
47 M.IsolateRef isolate, | 47 M.IsolateRef isolate, |
48 M.Class cls, | 48 M.Class cls, |
49 M.RetainedSizeRepository retainedSizes, | 49 M.RetainedSizeRepository retainedSizes, |
50 M.ReachableSizeRepository reachableSizes, | 50 M.ReachableSizeRepository reachableSizes, |
51 M.StronglyReachableInstancesRepository stronglyReachableInstances, | 51 M.StronglyReachableInstancesRepository stronglyReachableInstances, |
52 M.TopRetainingInstancesRepository topRetainingInstances, | 52 M.TopRetainingInstancesRepository topRetainingInstances, |
53 M.InstanceRepository instances, | 53 M.ObjectRepository objects, |
54 {RenderingQueue queue}) { | 54 {RenderingQueue queue}) { |
55 assert(isolate != null); | 55 assert(isolate != null); |
56 assert(cls != null); | 56 assert(cls != null); |
57 assert(retainedSizes != null); | 57 assert(retainedSizes != null); |
58 assert(reachableSizes != null); | 58 assert(reachableSizes != null); |
59 assert(stronglyReachableInstances != null); | 59 assert(stronglyReachableInstances != null); |
60 assert(topRetainingInstances != null); | 60 assert(topRetainingInstances != null); |
61 assert(instances != null); | 61 assert(objects != null); |
62 ClassInstancesElement e = document.createElement(tag.name); | 62 ClassInstancesElement e = document.createElement(tag.name); |
63 e._r = new RenderingScheduler(e, queue: queue); | 63 e._r = new RenderingScheduler(e, queue: queue); |
64 e._isolate = isolate; | 64 e._isolate = isolate; |
65 e._cls = cls; | 65 e._cls = cls; |
66 e._retainedSizes = retainedSizes; | 66 e._retainedSizes = retainedSizes; |
67 e._reachableSizes = reachableSizes; | 67 e._reachableSizes = reachableSizes; |
68 e._stronglyReachableInstances = stronglyReachableInstances; | 68 e._stronglyReachableInstances = stronglyReachableInstances; |
69 e._topRetainingInstances = topRetainingInstances; | 69 e._topRetainingInstances = topRetainingInstances; |
70 e._instances = instances; | 70 e._objects = objects; |
71 return e; | 71 return e; |
72 } | 72 } |
73 | 73 |
74 ClassInstancesElement.created() : super.created(); | 74 ClassInstancesElement.created() : super.created(); |
75 | 75 |
76 @override | 76 @override |
77 void attached() { | 77 void attached() { |
78 super.attached(); | 78 super.attached(); |
79 _r.enable(); | 79 _r.enable(); |
80 } | 80 } |
81 | 81 |
82 @override | 82 @override |
83 void detached() { | 83 void detached() { |
84 super.detached(); | 84 super.detached(); |
85 _r.disable(notify: true); | 85 _r.disable(notify: true); |
86 children = []; | 86 children = []; |
87 } | 87 } |
88 | 88 |
89 StronglyReachableInstancesElement _strong; | 89 StronglyReachableInstancesElement _strong; |
90 TopRetainingInstancesElement _topRetainig; | 90 TopRetainingInstancesElement _topRetainig; |
91 | 91 |
92 void render() { | 92 void render() { |
93 _strong = _strong ?? | 93 _strong = _strong ?? |
94 new StronglyReachableInstancesElement( | 94 new StronglyReachableInstancesElement( |
95 _isolate, _cls, _stronglyReachableInstances, _instances, | 95 _isolate, _cls, _stronglyReachableInstances, _objects, |
96 queue: _r.queue); | 96 queue: _r.queue); |
97 _topRetainig = _topRetainig ?? | 97 _topRetainig = _topRetainig ?? |
98 new TopRetainingInstancesElement( | 98 new TopRetainingInstancesElement( |
99 _isolate, _cls, _topRetainingInstances, _instances, | 99 _isolate, _cls, _topRetainingInstances, _objects, |
100 queue: _r.queue); | 100 queue: _r.queue); |
101 final instanceCount = | 101 final instanceCount = |
102 _cls.newSpace.current.instances + _cls.oldSpace.current.instances; | 102 _cls.newSpace.current.instances + _cls.oldSpace.current.instances; |
103 final size = Utils | 103 final size = Utils |
104 .formatSize(_cls.newSpace.current.bytes + _cls.oldSpace.current.bytes); | 104 .formatSize(_cls.newSpace.current.bytes + _cls.oldSpace.current.bytes); |
105 children = [ | 105 children = [ |
106 new DivElement() | 106 new DivElement() |
107 ..classes = ['memberList'] | 107 ..classes = ['memberList'] |
108 ..children = [ | 108 ..children = [ |
109 new DivElement() | 109 new DivElement() |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 button.onClick.listen((_) async { | 213 button.onClick.listen((_) async { |
214 button.disabled = true; | 214 button.disabled = true; |
215 _loadingRetainedBytes = true; | 215 _loadingRetainedBytes = true; |
216 _retainedSize = await _retainedSizes.get(_isolate, _cls.id); | 216 _retainedSize = await _retainedSizes.get(_isolate, _cls.id); |
217 _r.dirty(); | 217 _r.dirty(); |
218 }); | 218 }); |
219 content.add(button); | 219 content.add(button); |
220 return content; | 220 return content; |
221 } | 221 } |
222 } | 222 } |
OLD | NEW |