| 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 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/helpers/any_ref.dart'; | 8 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 9 import 'package:observatory/src/elements/helpers/nav_bar.dart'; | 9 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 10 import 'package:observatory/src/elements/helpers/nav_menu.dart'; | 10 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 RenderingScheduler<PortsElement> _r; | 32 RenderingScheduler<PortsElement> _r; |
| 33 | 33 |
| 34 Stream<RenderedEvent<PortsElement>> get onRendered => _r.onRendered; | 34 Stream<RenderedEvent<PortsElement>> get onRendered => _r.onRendered; |
| 35 | 35 |
| 36 M.VM _vm; | 36 M.VM _vm; |
| 37 M.IsolateRef _isolate; | 37 M.IsolateRef _isolate; |
| 38 M.EventRepository _events; | 38 M.EventRepository _events; |
| 39 M.NotificationRepository _notifications; | 39 M.NotificationRepository _notifications; |
| 40 M.PortsRepository _ports; | 40 M.PortsRepository _ports; |
| 41 M.InstanceRepository _instances; | 41 M.ObjectRepository _objects; |
| 42 M.Ports _isolatePorts; | 42 M.Ports _isolatePorts; |
| 43 | 43 |
| 44 M.IsolateRef get isolate => _isolate; | 44 M.IsolateRef get isolate => _isolate; |
| 45 M.NotificationRepository get notifications => _notifications; | 45 M.NotificationRepository get notifications => _notifications; |
| 46 M.PortsRepository get ports => _ports; | 46 M.PortsRepository get ports => _ports; |
| 47 M.VMRef get vm => _vm; | 47 M.VMRef get vm => _vm; |
| 48 | 48 |
| 49 factory PortsElement( | 49 factory PortsElement( |
| 50 M.VM vm, | 50 M.VM vm, |
| 51 M.IsolateRef isolate, | 51 M.IsolateRef isolate, |
| 52 M.EventRepository events, | 52 M.EventRepository events, |
| 53 M.NotificationRepository notifications, | 53 M.NotificationRepository notifications, |
| 54 M.PortsRepository ports, | 54 M.PortsRepository ports, |
| 55 M.InstanceRepository instances, | 55 M.ObjectRepository objects, |
| 56 {RenderingQueue queue}) { | 56 {RenderingQueue queue}) { |
| 57 assert(vm != null); | 57 assert(vm != null); |
| 58 assert(isolate != null); | 58 assert(isolate != null); |
| 59 assert(events != null); | 59 assert(events != null); |
| 60 assert(notifications != null); | 60 assert(notifications != null); |
| 61 assert(ports != null); | 61 assert(ports != null); |
| 62 assert(instances != null); | 62 assert(objects != null); |
| 63 PortsElement e = document.createElement(tag.name); | 63 PortsElement e = document.createElement(tag.name); |
| 64 e._r = new RenderingScheduler(e, queue: queue); | 64 e._r = new RenderingScheduler(e, queue: queue); |
| 65 e._vm = vm; | 65 e._vm = vm; |
| 66 e._isolate = isolate; | 66 e._isolate = isolate; |
| 67 e._events = events; | 67 e._events = events; |
| 68 e._notifications = notifications; | 68 e._notifications = notifications; |
| 69 e._ports = ports; | 69 e._ports = ports; |
| 70 e._instances = instances; | 70 e._objects = objects; |
| 71 return e; | 71 return e; |
| 72 } | 72 } |
| 73 | 73 |
| 74 PortsElement.created() : super.created(); | 74 PortsElement.created() : super.created(); |
| 75 | 75 |
| 76 int get portCount { | 76 int get portCount { |
| 77 return _isolatePorts == null ? 0 : _isolatePorts.elements.length; | 77 return _isolatePorts == null ? 0 : _isolatePorts.elements.length; |
| 78 } | 78 } |
| 79 | 79 |
| 80 @override | 80 @override |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 ..classes = ['memberName'] | 127 ..classes = ['memberName'] |
| 128 ..children = [ | 128 ..children = [ |
| 129 new SpanElement() | 129 new SpanElement() |
| 130 ..classes = ['port-number'] | 130 ..classes = ['port-number'] |
| 131 ..text = '[ ${++i} ] ', | 131 ..text = '[ ${++i} ] ', |
| 132 new SpanElement()..text = '${port.name}' | 132 new SpanElement()..text = '${port.name}' |
| 133 ], | 133 ], |
| 134 new DivElement() | 134 new DivElement() |
| 135 ..classes = ['memberValue'] | 135 ..classes = ['memberValue'] |
| 136 ..children = [ | 136 ..children = [ |
| 137 anyRef(_isolate, port.handler, _instances, queue: _r.queue) | 137 anyRef(_isolate, port.handler, _objects, queue: _r.queue) |
| 138 ] | 138 ] |
| 139 ]) | 139 ]) |
| 140 .toList(); | 140 .toList(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 Future _refresh() async { | 143 Future _refresh() async { |
| 144 _isolatePorts = null; | 144 _isolatePorts = null; |
| 145 _r.dirty(); | 145 _r.dirty(); |
| 146 _isolatePorts = await _ports.get(_isolate); | 146 _isolatePorts = await _ports.get(_isolate); |
| 147 _r.dirty(); | 147 _r.dirty(); |
| 148 } | 148 } |
| 149 } | 149 } |
| OLD | NEW |