OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 source_inset_element; | 5 library source_inset_element; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | 11 import 'package:observatory/src/elements/helpers/tag.dart'; |
12 import 'package:observatory/src/elements/script_inset.dart'; | 12 import 'package:observatory/src/elements/script_inset.dart'; |
13 | 13 |
14 class SourceInsetElement extends HtmlElement implements Renderable { | 14 class SourceInsetElement extends HtmlElement implements Renderable { |
15 static const tag = const Tag<SourceInsetElement>('source-inset'); | 15 static const tag = const Tag<SourceInsetElement>('source-inset'); |
16 | 16 |
17 RenderingScheduler _r; | 17 RenderingScheduler _r; |
18 | 18 |
19 Stream<RenderedEvent<SourceInsetElement>> get onRendered => _r.onRendered; | 19 Stream<RenderedEvent<SourceInsetElement>> get onRendered => _r.onRendered; |
20 | 20 |
21 | |
22 M.IsolateRef _isolate; | 21 M.IsolateRef _isolate; |
23 M.SourceLocation _location; | 22 M.SourceLocation _location; |
24 M.ScriptRepository _scripts; | 23 M.ScriptRepository _scripts; |
25 M.InstanceRepository _instances; | 24 M.InstanceRepository _instances; |
26 M.EventRepository _events; | 25 M.EventRepository _events; |
27 int _currentPos; | 26 int _currentPos; |
28 bool _inDebuggerContext; | 27 bool _inDebuggerContext; |
29 Iterable _variables; | 28 Iterable _variables; |
30 | 29 |
31 M.IsolateRef get isolate => _isolate; | 30 M.IsolateRef get isolate => _isolate; |
32 M.SourceLocation get location => _location; | 31 M.SourceLocation get location => _location; |
33 | 32 |
34 factory SourceInsetElement(M.IsolateRef isolate, M.SourceLocation location, | 33 factory SourceInsetElement( |
35 M.ScriptRepository scripts, | 34 M.IsolateRef isolate, |
36 M.InstanceRepository instances, | 35 M.SourceLocation location, |
37 M.EventRepository events, | 36 M.ScriptRepository scripts, |
38 {int currentPos, | 37 M.InstanceRepository instances, |
39 bool inDebuggerContext: false, | 38 M.EventRepository events, |
40 Iterable variables: const [], | 39 {int currentPos, |
41 RenderingQueue queue}) { | 40 bool inDebuggerContext: false, |
| 41 Iterable variables: const [], |
| 42 RenderingQueue queue}) { |
42 assert(isolate != null); | 43 assert(isolate != null); |
43 assert(location != null); | 44 assert(location != null); |
44 assert(scripts != null); | 45 assert(scripts != null); |
45 assert(instances != null); | 46 assert(instances != null); |
46 assert(events != null); | 47 assert(events != null); |
47 assert(inDebuggerContext != null); | 48 assert(inDebuggerContext != null); |
48 assert(variables != null); | 49 assert(variables != null); |
49 SourceInsetElement e = document.createElement(tag.name); | 50 SourceInsetElement e = document.createElement(tag.name); |
50 e._r = new RenderingScheduler(e, queue: queue); | 51 e._r = new RenderingScheduler(e, queue: queue); |
51 e._isolate = isolate; | 52 e._isolate = isolate; |
(...skipping 17 matching lines...) Expand all Loading... |
69 | 70 |
70 @override | 71 @override |
71 void detached() { | 72 void detached() { |
72 super.detached(); | 73 super.detached(); |
73 children = []; | 74 children = []; |
74 _r.disable(notify: true); | 75 _r.disable(notify: true); |
75 } | 76 } |
76 | 77 |
77 void render() { | 78 void render() { |
78 children = [ | 79 children = [ |
79 new ScriptInsetElement(_isolate, _location.script, | 80 new ScriptInsetElement( |
80 _scripts, _instances, _events, | 81 _isolate, _location.script, _scripts, _instances, _events, |
81 startPos: _location.tokenPos, | 82 startPos: _location.tokenPos, |
82 endPos: _location.endTokenPos, | 83 endPos: _location.endTokenPos, |
83 currentPos: _currentPos, | 84 currentPos: _currentPos, |
84 inDebuggerContext: _inDebuggerContext, | 85 inDebuggerContext: _inDebuggerContext, |
85 variables: _variables, | 86 variables: _variables, |
86 queue: _r.queue) | 87 queue: _r.queue) |
87 ]; | 88 ]; |
88 } | 89 } |
89 } | 90 } |
OLD | NEW |