| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 objectpool_view; | 5 library objectpool_view; |
| 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/context_ref.dart'; | 10 import 'package:observatory/src/elements/context_ref.dart'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 M.VM _vm; | 43 M.VM _vm; |
| 44 M.IsolateRef _isolate; | 44 M.IsolateRef _isolate; |
| 45 M.EventRepository _events; | 45 M.EventRepository _events; |
| 46 M.NotificationRepository _notifications; | 46 M.NotificationRepository _notifications; |
| 47 M.ObjectPool _pool; | 47 M.ObjectPool _pool; |
| 48 M.ObjectPoolRepository _pools; | 48 M.ObjectPoolRepository _pools; |
| 49 M.RetainedSizeRepository _retainedSizes; | 49 M.RetainedSizeRepository _retainedSizes; |
| 50 M.ReachableSizeRepository _reachableSizes; | 50 M.ReachableSizeRepository _reachableSizes; |
| 51 M.InboundReferencesRepository _references; | 51 M.InboundReferencesRepository _references; |
| 52 M.RetainingPathRepository _retainingPaths; | 52 M.RetainingPathRepository _retainingPaths; |
| 53 M.InstanceRepository _instances; | 53 M.ObjectRepository _objects; |
| 54 | 54 |
| 55 M.VMRef get vm => _vm; | 55 M.VMRef get vm => _vm; |
| 56 M.IsolateRef get isolate => _isolate; | 56 M.IsolateRef get isolate => _isolate; |
| 57 M.NotificationRepository get notifications => _notifications; | 57 M.NotificationRepository get notifications => _notifications; |
| 58 M.ObjectPoolRef get pool => _pool; | 58 M.ObjectPoolRef get pool => _pool; |
| 59 | 59 |
| 60 factory ObjectPoolViewElement( | 60 factory ObjectPoolViewElement( |
| 61 M.VM vm, | 61 M.VM vm, |
| 62 M.IsolateRef isolate, | 62 M.IsolateRef isolate, |
| 63 M.ObjectPool pool, | 63 M.ObjectPool pool, |
| 64 M.EventRepository events, | 64 M.EventRepository events, |
| 65 M.NotificationRepository notifications, | 65 M.NotificationRepository notifications, |
| 66 M.ObjectPoolRepository pools, | 66 M.ObjectPoolRepository pools, |
| 67 M.RetainedSizeRepository retainedSizes, | 67 M.RetainedSizeRepository retainedSizes, |
| 68 M.ReachableSizeRepository reachableSizes, | 68 M.ReachableSizeRepository reachableSizes, |
| 69 M.InboundReferencesRepository references, | 69 M.InboundReferencesRepository references, |
| 70 M.RetainingPathRepository retainingPaths, | 70 M.RetainingPathRepository retainingPaths, |
| 71 M.InstanceRepository instances, | 71 M.ObjectRepository objects, |
| 72 {RenderingQueue queue}) { | 72 {RenderingQueue queue}) { |
| 73 assert(vm != null); | 73 assert(vm != null); |
| 74 assert(isolate != null); | 74 assert(isolate != null); |
| 75 assert(events != null); | 75 assert(events != null); |
| 76 assert(notifications != null); | 76 assert(notifications != null); |
| 77 assert(pool != null); | 77 assert(pool != null); |
| 78 assert(pools != null); | 78 assert(pools != null); |
| 79 assert(retainedSizes != null); | 79 assert(retainedSizes != null); |
| 80 assert(reachableSizes != null); | 80 assert(reachableSizes != null); |
| 81 assert(references != null); | 81 assert(references != null); |
| 82 assert(retainingPaths != null); | 82 assert(retainingPaths != null); |
| 83 assert(instances != null); | 83 assert(objects != null); |
| 84 ObjectPoolViewElement e = document.createElement(tag.name); | 84 ObjectPoolViewElement e = document.createElement(tag.name); |
| 85 e._r = new RenderingScheduler(e, queue: queue); | 85 e._r = new RenderingScheduler(e, queue: queue); |
| 86 e._vm = vm; | 86 e._vm = vm; |
| 87 e._isolate = isolate; | 87 e._isolate = isolate; |
| 88 e._events = events; | 88 e._events = events; |
| 89 e._notifications = notifications; | 89 e._notifications = notifications; |
| 90 e._pool = pool; | 90 e._pool = pool; |
| 91 e._pools = pools; | 91 e._pools = pools; |
| 92 e._retainedSizes = retainedSizes; | 92 e._retainedSizes = retainedSizes; |
| 93 e._reachableSizes = reachableSizes; | 93 e._reachableSizes = reachableSizes; |
| 94 e._references = references; | 94 e._references = references; |
| 95 e._retainingPaths = retainingPaths; | 95 e._retainingPaths = retainingPaths; |
| 96 e._instances = instances; | 96 e._objects = objects; |
| 97 return e; | 97 return e; |
| 98 } | 98 } |
| 99 | 99 |
| 100 ObjectPoolViewElement.created() : super.created(); | 100 ObjectPoolViewElement.created() : super.created(); |
| 101 | 101 |
| 102 @override | 102 @override |
| 103 attached() { | 103 attached() { |
| 104 super.attached(); | 104 super.attached(); |
| 105 _r.enable(); | 105 _r.enable(); |
| 106 } | 106 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 126 _r.dirty(); | 126 _r.dirty(); |
| 127 }), | 127 }), |
| 128 new NavNotifyElement(_notifications, queue: _r.queue) | 128 new NavNotifyElement(_notifications, queue: _r.queue) |
| 129 ]), | 129 ]), |
| 130 new DivElement() | 130 new DivElement() |
| 131 ..classes = ['content-centered-big'] | 131 ..classes = ['content-centered-big'] |
| 132 ..children = [ | 132 ..children = [ |
| 133 new HeadingElement.h2()..text = 'ObjectPool', | 133 new HeadingElement.h2()..text = 'ObjectPool', |
| 134 new HRElement(), | 134 new HRElement(), |
| 135 new ObjectCommonElement(_isolate, _pool, _retainedSizes, | 135 new ObjectCommonElement(_isolate, _pool, _retainedSizes, |
| 136 _reachableSizes, _references, _retainingPaths, _instances, | 136 _reachableSizes, _references, _retainingPaths, _objects, |
| 137 queue: _r.queue), | 137 queue: _r.queue), |
| 138 new HRElement(), | 138 new HRElement(), |
| 139 new HeadingElement.h3()..text = 'entries (${_pool.entries.length})', | 139 new HeadingElement.h3()..text = 'entries (${_pool.entries.length})', |
| 140 new DivElement() | 140 new DivElement() |
| 141 ..classes = ['memberList'] | 141 ..classes = ['memberList'] |
| 142 ..children = _pool.entries | 142 ..children = _pool.entries |
| 143 .map((entry) => new DivElement() | 143 .map((entry) => new DivElement() |
| 144 ..classes = ['memberItem'] | 144 ..classes = ['memberItem'] |
| 145 ..children = [ | 145 ..children = [ |
| 146 new DivElement() | 146 new DivElement() |
| 147 ..classes = ['memberName', 'hexadecimal'] | 147 ..classes = ['memberName', 'hexadecimal'] |
| 148 ..text = '[PP+0x${entry.offset.toRadixString(16)}]', | 148 ..text = '[PP+0x${entry.offset.toRadixString(16)}]', |
| 149 new DivElement() | 149 new DivElement() |
| 150 ..classes = ['memberName'] | 150 ..classes = ['memberName'] |
| 151 ..children = _createEntry(entry) | 151 ..children = _createEntry(entry) |
| 152 ]) | 152 ]) |
| 153 .toList(), | 153 .toList(), |
| 154 new HRElement(), | 154 new HRElement(), |
| 155 new ViewFooterElement(queue: _r.queue) | 155 new ViewFooterElement(queue: _r.queue) |
| 156 ] | 156 ] |
| 157 ]; | 157 ]; |
| 158 } | 158 } |
| 159 | 159 |
| 160 List<Element> _createEntry(M.ObjectPoolEntry entry) { | 160 List<Element> _createEntry(M.ObjectPoolEntry entry) { |
| 161 switch (entry.kind) { | 161 switch (entry.kind) { |
| 162 case M.ObjectPoolEntryKind.object: | 162 case M.ObjectPoolEntryKind.object: |
| 163 return [anyRef(_isolate, entry.asObject, _instances, queue: _r.queue)]; | 163 return [anyRef(_isolate, entry.asObject, _objects, queue: _r.queue)]; |
| 164 case M.ObjectPoolEntryKind.immediate: | 164 case M.ObjectPoolEntryKind.immediate: |
| 165 return [ | 165 return [ |
| 166 new SpanElement() | 166 new SpanElement() |
| 167 ..text = 'Immediate 0x${entry.asInteger.toRadixString(16)}' | 167 ..text = 'Immediate 0x${entry.asInteger.toRadixString(16)}' |
| 168 ]; | 168 ]; |
| 169 case M.ObjectPoolEntryKind.nativeEntry: | 169 case M.ObjectPoolEntryKind.nativeEntry: |
| 170 return [ | 170 return [ |
| 171 new SpanElement() | 171 new SpanElement() |
| 172 ..text = 'NativeEntry 0x${entry.asInteger.toRadixString(16)}' | 172 ..text = 'NativeEntry 0x${entry.asInteger.toRadixString(16)}' |
| 173 ]; | 173 ]; |
| 174 } | 174 } |
| 175 throw new Exception('Unknown ObjectPoolEntryKind (${entry.kind})'); | 175 throw new Exception('Unknown ObjectPoolEntryKind (${entry.kind})'); |
| 176 } | 176 } |
| 177 } | 177 } |
| OLD | NEW |