| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library source_inset_element; |
| 6 |
| 7 import 'dart:html'; |
| 8 import 'dart:async'; |
| 9 import 'package:observatory/models.dart' as M; |
| 10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
| 11 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 12 import 'package:observatory/src/elements/script_inset.dart'; |
| 13 |
| 14 class SourceInsetElement extends HtmlElement implements Renderable { |
| 15 static const tag = const Tag<SourceInsetElement>('source-inset-wrapped'); |
| 16 |
| 17 RenderingScheduler _r; |
| 18 |
| 19 Stream<RenderedEvent<SourceInsetElement>> get onRendered => _r.onRendered; |
| 20 |
| 21 |
| 22 M.IsolateRef _isolate; |
| 23 M.SourceLocation _location; |
| 24 M.ScriptRepository _scripts; |
| 25 M.InstanceRepository _instances; |
| 26 M.EventRepository _events; |
| 27 int _currentPos; |
| 28 bool _inDebuggerContext; |
| 29 Iterable _variables; |
| 30 |
| 31 M.IsolateRef get isolate => _isolate; |
| 32 M.SourceLocation get location => _location; |
| 33 |
| 34 factory SourceInsetElement(M.IsolateRef isolate, M.SourceLocation location, |
| 35 M.ScriptRepository scripts, |
| 36 M.InstanceRepository instances, |
| 37 M.EventRepository events, |
| 38 {int currentPos, |
| 39 bool inDebuggerContext: false, |
| 40 Iterable variables: const [], |
| 41 RenderingQueue queue}) { |
| 42 assert(isolate != null); |
| 43 assert(location != null); |
| 44 assert(scripts != null); |
| 45 assert(instances != null); |
| 46 assert(events != null); |
| 47 assert(inDebuggerContext != null); |
| 48 assert(variables != null); |
| 49 SourceInsetElement e = document.createElement(tag.name); |
| 50 e._r = new RenderingScheduler(e, queue: queue); |
| 51 e._isolate = isolate; |
| 52 e._location = location; |
| 53 e._scripts = scripts; |
| 54 e._instances = instances; |
| 55 e._events = events; |
| 56 e._currentPos = currentPos; |
| 57 e._inDebuggerContext = inDebuggerContext; |
| 58 e._variables = variables; |
| 59 return e; |
| 60 } |
| 61 |
| 62 SourceInsetElement.created() : super.created(); |
| 63 |
| 64 @override |
| 65 void attached() { |
| 66 super.attached(); |
| 67 _r.enable(); |
| 68 } |
| 69 |
| 70 @override |
| 71 void detached() { |
| 72 super.detached(); |
| 73 children = []; |
| 74 _r.disable(notify: true); |
| 75 } |
| 76 |
| 77 void render() { |
| 78 children = [ |
| 79 new ScriptInsetElement(_isolate, _location.script, |
| 80 _scripts, _instances, _events, |
| 81 startPos: _location.tokenPos, |
| 82 endPos: _location.endTokenPos, |
| 83 currentPos: _currentPos, |
| 84 inDebuggerContext: _inDebuggerContext, |
| 85 variables: _variables, |
| 86 queue: _r.queue) |
| 87 ]; |
| 88 } |
| 89 } |
| OLD | NEW |