Chromium Code Reviews| Index: runtime/observatory/lib/src/elements/script_ref.dart | 
| diff --git a/runtime/observatory/lib/src/elements/script_ref.dart b/runtime/observatory/lib/src/elements/script_ref.dart | 
| index c11f26d7f3146d37d8f88e430b59fef6812a7657..8911b7f2b31a762821976a87737f06c5819f7297 100644 | 
| --- a/runtime/observatory/lib/src/elements/script_ref.dart | 
| +++ b/runtime/observatory/lib/src/elements/script_ref.dart | 
| @@ -4,69 +4,59 @@ | 
| library script_ref_element; | 
| -import 'package:polymer/polymer.dart'; | 
| -import 'package:observatory/service.dart'; | 
| -import 'service_ref.dart'; | 
| +import 'dart:html'; | 
| +import 'dart:async'; | 
| +import 'package:observatory/models.dart' as M show IsolateRef, ScriptRef; | 
| +import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 
| +import 'package:observatory/src/elements/helpers/tag.dart'; | 
| +import 'package:observatory/src/elements/helpers/uris.dart'; | 
| -@CustomTag('script-ref') | 
| -class ScriptRefElement extends ServiceRefElement { | 
| - @published int pos; | 
| +class ScriptRefElement extends HtmlElement implements Renderable{ | 
| + static const tag = const Tag<ScriptRefElement>('script-ref-wrapped'); | 
| - String get hoverText { | 
| - if (ref == null) { | 
| - return super.hoverText; | 
| - } | 
| - return ref.vmName; | 
| - } | 
| + RenderingScheduler _r; | 
| - void posChanged(oldValue) { | 
| - _updateProperties(null); | 
| - } | 
| + Stream<RenderedEvent<ScriptRefElement>> get onRendered => _r.onRendered; | 
| - void _updateProperties(_) { | 
| - if (ref != null && ref.loaded) { | 
| - notifyPropertyChange(#name, 0, 1); | 
| - notifyPropertyChange(#url, 0, 1); | 
| - } | 
| - } | 
| - String get name { | 
| - if (ref == null) { | 
| - return super.name; | 
| - } | 
| - if ((pos != null) && (pos >= 0)) { | 
| - if (ref.loaded) { | 
| - // Script is loaded, get the line number. | 
| - Script script = ref; | 
| - return '${super.name}:${script.tokenToLine(pos)}:' | 
| - '${script.tokenToCol(pos)}'; | 
| - } else { | 
| - ref.load().then(_updateProperties); | 
| - } | 
| - } | 
| - return super.name; | 
| - } | 
| + M.IsolateRef _isolate; | 
| + M.ScriptRef _script; | 
| + | 
| + M.IsolateRef get isolate => _isolate; | 
| + M.ScriptRef get script => _script; | 
| - String get url { | 
| - if (ref == null) { | 
| - return super.url; | 
| - } | 
| - if ((pos != null) && (pos >= 0)) { | 
| - if (ref.loaded) { | 
| - return '${super.url}---pos=${pos}'; | 
| - } else { | 
| - ref.load().then(_updateProperties); | 
| - } | 
| - } | 
| - return super.url; | 
| + factory ScriptRefElement(M.IsolateRef isolate, M.ScriptRef script, | 
| 
 
Cutch
2016/07/25 20:29:42
what happened to the ---pos= parameter?
 
cbernaschina
2016/07/25 20:44:37
script-ref had an optional pos parameter that was
 
 | 
| + {RenderingQueue queue}) { | 
| + assert(isolate != null); | 
| + assert(script != null); | 
| + ScriptRefElement e = document.createElement(tag.name); | 
| + e._r = new RenderingScheduler(e, queue: queue); | 
| + e._isolate = isolate; | 
| + e._script = script; | 
| + return e; | 
| } | 
| ScriptRefElement.created() : super.created(); | 
| -} | 
| -@CustomTag('source-link') | 
| -class SourceLinkElement extends PolymerElement { | 
| - SourceLinkElement.created() : super.created(); | 
| + @override | 
| + void attached() { | 
| + super.attached(); | 
| + assert(script != null); | 
| + _r.enable(); | 
| + } | 
| - @published SourceLocation location; | 
| + @override | 
| + void detached() { | 
| + super.detached(); | 
| + children = []; | 
| + _r.disable(notify: true); | 
| + } | 
| + | 
| + void render() { | 
| + children = [ | 
| + new AnchorElement(href: Uris.inspect(isolate, object: script)) | 
| + ..title = script.uri | 
| + ..text = script.uri.split('/').last | 
| + ]; | 
| + } | 
| } |