| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/rendering_scheduler.dart'; | 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
| 9 import 'package:observatory/src/elements/helpers/tag.dart'; | 9 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 10 import 'package:observatory/src/elements/helpers/uris.dart'; | 10 import 'package:observatory/src/elements/helpers/uris.dart'; |
| 11 import 'package:observatory/src/elements/isolate_ref.dart'; | 11 import 'package:observatory/src/elements/isolate_ref.dart'; |
| 12 import 'package:observatory/src/elements/isolate/location.dart'; | 12 import 'package:observatory/src/elements/isolate/location.dart'; |
| 13 import 'package:observatory/src/elements/isolate/run_state.dart'; | 13 import 'package:observatory/src/elements/isolate/run_state.dart'; |
| 14 import 'package:observatory/src/elements/isolate/shared_summary.dart'; | 14 import 'package:observatory/src/elements/isolate/shared_summary.dart'; |
| 15 | 15 |
| 16 class IsolateSummaryElement extends HtmlElement implements Renderable { | 16 class IsolateSummaryElement extends HtmlElement implements Renderable { |
| 17 static const tag = const Tag<IsolateSummaryElement>('isolate-summary', | 17 static const tag = |
| 18 dependencies: const [ | 18 const Tag<IsolateSummaryElement>('isolate-summary', dependencies: const [ |
| 19 IsolateRefElement.tag, | 19 IsolateRefElement.tag, |
| 20 IsolateLocationElement.tag, | 20 IsolateLocationElement.tag, |
| 21 IsolateRunStateElement.tag, | 21 IsolateRunStateElement.tag, |
| 22 IsolateSharedSummaryElement.tag | 22 IsolateSharedSummaryElement.tag |
| 23 ]); | 23 ]); |
| 24 | 24 |
| 25 RenderingScheduler<IsolateSummaryElement> _r; | 25 RenderingScheduler<IsolateSummaryElement> _r; |
| 26 | 26 |
| 27 Stream<RenderedEvent<IsolateSummaryElement>> get onRendered => | 27 Stream<RenderedEvent<IsolateSummaryElement>> get onRendered => _r.onRendered; |
| 28 _r.onRendered; | |
| 29 | 28 |
| 30 M.IsolateRef _isolate; | 29 M.IsolateRef _isolate; |
| 31 M.EventRepository _events; | 30 M.EventRepository _events; |
| 32 M.IsolateRepository _isolates; | 31 M.IsolateRepository _isolates; |
| 33 M.ScriptRepository _scripts; | 32 M.ScriptRepository _scripts; |
| 34 M.Isolate _loadedIsolate; | 33 M.Isolate _loadedIsolate; |
| 35 | 34 |
| 36 factory IsolateSummaryElement(M.IsolateRef isolate, | 35 factory IsolateSummaryElement( |
| 37 M.IsolateRepository isolates, | 36 M.IsolateRef isolate, |
| 38 M.EventRepository events, | 37 M.IsolateRepository isolates, |
| 39 M.ScriptRepository scripts, | 38 M.EventRepository events, |
| 40 {RenderingQueue queue}) { | 39 M.ScriptRepository scripts, |
| 40 {RenderingQueue queue}) { |
| 41 assert(isolate != null); | 41 assert(isolate != null); |
| 42 assert(isolates != null); | 42 assert(isolates != null); |
| 43 assert(events != null); | 43 assert(events != null); |
| 44 assert(scripts != null); | 44 assert(scripts != null); |
| 45 IsolateSummaryElement e = document.createElement(tag.name); | 45 IsolateSummaryElement e = document.createElement(tag.name); |
| 46 e._r = new RenderingScheduler(e, queue: queue); | 46 e._r = new RenderingScheduler(e, queue: queue); |
| 47 e._isolate = isolate; | 47 e._isolate = isolate; |
| 48 e._isolates = isolates; | 48 e._isolates = isolates; |
| 49 e._events = events; | 49 e._events = events; |
| 50 e._scripts = scripts; | 50 e._scripts = scripts; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 void render() { | 70 void render() { |
| 71 if (_loadedIsolate == null) { | 71 if (_loadedIsolate == null) { |
| 72 children = [ | 72 children = [ |
| 73 new SpanElement()..text = 'loading ', | 73 new SpanElement()..text = 'loading ', |
| 74 new IsolateRefElement(_isolate, _events, queue: _r.queue) | 74 new IsolateRefElement(_isolate, _events, queue: _r.queue) |
| 75 ]; | 75 ]; |
| 76 } else { | 76 } else { |
| 77 children = [ | 77 children = [ |
| 78 new DivElement()..classes = ['flex-row'] | 78 new DivElement() |
| 79 ..classes = ['flex-row'] |
| 79 ..children = [ | 80 ..children = [ |
| 80 new DivElement() | 81 new DivElement() |
| 81 ..children = [ | 82 ..children = [ |
| 82 new IsolateRefElement(_isolate, _events, queue: _r.queue) | 83 new IsolateRefElement(_isolate, _events, queue: _r.queue) |
| 83 ], | 84 ], |
| 84 new DivElement()..style.flex = '1', | 85 new DivElement()..style.flex = '1', |
| 85 new DivElement() | 86 new DivElement() |
| 86 ..children = [ | 87 ..children = [ |
| 87 new IsolateRunStateElement(_isolate, _events, queue: _r.queue), | 88 new IsolateRunStateElement(_isolate, _events, queue: _r.queue), |
| 88 new IsolateLocationElement(_isolate, _events, _scripts, | 89 new IsolateLocationElement(_isolate, _events, _scripts, |
| 89 queue: _r.queue), | 90 queue: _r.queue), |
| 90 new SpanElement()..text = ' [', | 91 new SpanElement()..text = ' [', |
| 91 new AnchorElement(href: Uris.debugger(_isolate)) | 92 new AnchorElement(href: Uris.debugger(_isolate)) |
| 92 ..text = 'debug', | 93 ..text = 'debug', |
| 93 new SpanElement()..text = ']' | 94 new SpanElement()..text = ']' |
| 94 ] | 95 ] |
| 95 ], | 96 ], |
| 96 new BRElement(), | 97 new BRElement(), |
| 97 new IsolateSharedSummaryElement(_isolate, _events, queue: _r.queue) | 98 new IsolateSharedSummaryElement(_isolate, _events, queue: _r.queue) |
| 98 ]; | 99 ]; |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 | 102 |
| 102 Future _load() async { | 103 Future _load() async { |
| 103 _loadedIsolate = await _isolates.get(_isolate); | 104 _loadedIsolate = await _isolates.get(_isolate); |
| 104 _r.dirty(); | 105 _r.dirty(); |
| 105 } | 106 } |
| 106 } | 107 } |
| OLD | NEW |