Index: runtime/observatory/lib/src/elements/icdata_view.dart |
diff --git a/runtime/observatory/lib/src/elements/icdata_view.dart b/runtime/observatory/lib/src/elements/icdata_view.dart |
index d69f6729e46edc91b1898edc139e90e894b6d823..557de5b16de711c5bb21a193ff31616ed20009b9 100644 |
--- a/runtime/observatory/lib/src/elements/icdata_view.dart |
+++ b/runtime/observatory/lib/src/elements/icdata_view.dart |
@@ -1,21 +1,179 @@ |
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-library icdata_view; |
- |
import 'dart:async'; |
-import 'observatory_element.dart'; |
-import 'package:observatory/service.dart'; |
-import 'package:polymer/polymer.dart'; |
+import 'dart:html'; |
+import 'package:observatory/models.dart' as M; |
+import 'package:observatory/src/elements/curly_block.dart'; |
+import 'package:observatory/src/elements/helpers/any_ref.dart'; |
+import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
+import 'package:observatory/src/elements/helpers/tag.dart'; |
+import 'package:observatory/src/elements/nav/bar.dart'; |
+import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
+import 'package:observatory/src/elements/nav/menu.dart'; |
+import 'package:observatory/src/elements/nav/notify.dart'; |
+import 'package:observatory/src/elements/nav/refresh.dart'; |
+import 'package:observatory/src/elements/nav/top_menu.dart'; |
+import 'package:observatory/src/elements/nav/vm_menu.dart'; |
+import 'package:observatory/src/elements/object_common.dart'; |
+import 'package:observatory/src/elements/view_footer.dart'; |
+ |
+class ICDataViewElement extends HtmlElement implements Renderable { |
+ static const tag = const Tag<ICDataViewElement>('icdata-view', |
+ dependencies: const [ |
+ CurlyBlockElement.tag, |
+ NavBarElement.tag, |
+ NavTopMenuElement.tag, |
+ NavVMMenuElement.tag, |
+ NavIsolateMenuElement.tag, |
+ NavMenuElement.tag, |
+ NavRefreshElement.tag, |
+ NavNotifyElement.tag, |
+ ObjectCommonElement.tag, |
+ ViewFooterElement.tag |
+ ]); |
+ |
+ RenderingScheduler<ICDataViewElement> _r; |
+ |
+ Stream<RenderedEvent<ICDataViewElement>> get onRendered => _r.onRendered; |
-@CustomTag('icdata-view') |
-class ICDataViewElement extends ObservatoryElement { |
- @published ICData icData; |
+ M.VM _vm; |
+ M.IsolateRef _isolate; |
+ M.EventRepository _events; |
+ M.NotificationRepository _notifications; |
+ M.ICData _icdata; |
+ M.ICDataRepository _icdatas; |
+ M.RetainedSizeRepository _retainedSizes; |
+ M.ReachableSizeRepository _reachableSizes; |
+ M.InboundReferencesRepository _references; |
+ M.RetainingPathRepository _retainingPaths; |
+ M.InstanceRepository _instances; |
+ |
+ |
+ M.VMRef get vm => _vm; |
+ M.IsolateRef get isolate => _isolate; |
+ M.NotificationRepository get notifications => _notifications; |
+ M.ICData get icdata => _icdata; |
+ |
+ factory ICDataViewElement(M.VM vm, M.IsolateRef isolate, M.ICData icdata, |
+ M.EventRepository events, |
+ M.NotificationRepository notifications, |
+ M.ICDataRepository icdatas, |
+ M.RetainedSizeRepository retainedSizes, |
+ M.ReachableSizeRepository reachableSizes, |
+ M.InboundReferencesRepository references, |
+ M.RetainingPathRepository retainingPaths, |
+ M.InstanceRepository instances, |
+ {RenderingQueue queue}) { |
+ assert(vm != null); |
+ assert(isolate != null); |
+ assert(events != null); |
+ assert(notifications != null); |
+ assert(icdata != null); |
+ assert(icdatas != null); |
+ assert(retainedSizes != null); |
+ assert(reachableSizes != null); |
+ assert(references != null); |
+ assert(retainingPaths != null); |
+ assert(instances != null); |
+ ICDataViewElement e = document.createElement(tag.name); |
+ e._r = new RenderingScheduler(e, queue: queue); |
+ e._vm = vm; |
+ e._isolate = isolate; |
+ e._events = events; |
+ e._notifications = notifications; |
+ e._icdata = icdata; |
+ e._icdatas = icdatas; |
+ e._retainedSizes = retainedSizes; |
+ e._reachableSizes = reachableSizes; |
+ e._references = references; |
+ e._retainingPaths = retainingPaths; |
+ e._instances = instances; |
+ return e; |
+ } |
ICDataViewElement.created() : super.created(); |
- Future refresh() { |
- return icData.reload(); |
+ @override |
+ attached() { |
+ super.attached(); |
+ _r.enable(); |
+ } |
+ |
+ @override |
+ detached() { |
+ super.detached(); |
+ _r.disable(notify: true); |
+ children = []; |
+ } |
+ |
+ void render() { |
+ children = [ |
+ new NavBarElement(queue: _r.queue) |
+ ..children = [ |
+ new NavTopMenuElement(queue: _r.queue), |
+ new NavVMMenuElement(_vm, _events, queue: _r.queue), |
+ new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
+ new NavMenuElement('instance', last: true, queue: _r.queue), |
+ new NavRefreshElement(queue: _r.queue) |
+ ..onRefresh.listen((e) async { |
+ e.element.disabled = true; |
+ _icdata = await _icdatas.get(_isolate, _icdata.id); |
+ _r.dirty(); |
+ }), |
+ new NavNotifyElement(_notifications, queue: _r.queue) |
+ ], |
+ |
+ new DivElement()..classes = const ['content-centered-big'] |
+ ..children = [ |
+ new HeadingElement.h2()..text = 'ICData', |
+ new HRElement(), |
+ new ObjectCommonElement(_isolate, _icdata, _retainedSizes, |
+ _reachableSizes, _references, _retainingPaths, |
+ _instances, queue: _r.queue), |
+ new DivElement()..classes = ['memberList'] |
+ ..children = [ |
+ new DivElement()..classes = ['memberItem'] |
+ ..children = [ |
+ new DivElement()..classes = ['memberName'] |
+ ..text = 'owner', |
+ new DivElement()..classes = ['memberName'] |
+ ..children = [ |
+ _icdata.dartOwner == null |
+ ? (new SpanElement()..text = '<none>') |
+ : anyRef(_isolate, _icdata.dartOwner, _instances, |
+ queue: _r.queue) |
+ ] |
+ ], |
+ new DivElement()..classes = ['memberItem'] |
+ ..children = [ |
+ new DivElement()..classes = ['memberName'] |
+ ..text = 'argumentsDescriptor', |
+ new DivElement()..classes = ['memberName'] |
+ ..children = [ |
+ _icdata.argumentsDescriptor == null |
+ ? (new SpanElement()..text = '<none>') |
+ : anyRef(_isolate, _icdata.argumentsDescriptor, |
+ _instances, queue: _r.queue) |
+ ] |
+ ], |
+ new DivElement()..classes = ['memberItem'] |
+ ..children = [ |
+ new DivElement()..classes = ['memberName'] |
+ ..text = 'entries', |
+ new DivElement()..classes = ['memberName'] |
+ ..children = [ |
+ _icdata.entries == null |
+ ? (new SpanElement()..text = '<none>') |
+ : anyRef(_isolate, _icdata.entries, _instances, |
+ queue: _r.queue) |
+ ] |
+ ] |
+ ], |
+ new HRElement(), |
+ new ViewFooterElement(queue: _r.queue) |
+ ] |
+ ]; |
} |
} |