Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Side by Side Diff: runtime/observatory/lib/src/elements/code_ref.dart

Issue 2194383002: Converted Observatory code-ref function-ref element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixed CSS problem Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 code_ref_element; 5 library code_ref_element;
6 6
7 import 'package:polymer/polymer.dart'; 7 import 'dart:html';
8 import 'service_ref.dart'; 8 import 'dart:async';
9 import 'package:observatory/service.dart'; 9 import 'package:observatory/models.dart' as M
10 show IsolateRef, CodeRef, isSyntheticCode;
11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
12 import 'package:observatory/src/elements/helpers/tag.dart';
13 import 'package:observatory/src/elements/helpers/uris.dart';
10 14
11 @CustomTag('code-ref') 15 class CodeRefElement extends HtmlElement implements Renderable {
12 class CodeRefElement extends ServiceRefElement { 16 static const tag = const Tag<CodeRefElement>('code-ref-wrapped');
17
18 RenderingScheduler<CodeRefElement> _r;
19
20 Stream<RenderedEvent<CodeRefElement>> get onRendered => _r.onRendered;
21
22 M.IsolateRef _isolate;
23 M.CodeRef _code;
24
25 M.IsolateRef get isolate => _isolate;
26 M.CodeRef get code => _code;
27
28 factory CodeRefElement(M.IsolateRef isolate, M.CodeRef code,
29 {RenderingQueue queue}) {
30 assert(isolate != null);
31 assert(code != null);
32 CodeRefElement e = document.createElement(tag.name);
33 e._r = new RenderingScheduler(e, queue: queue);
34 e._isolate = isolate;
35 e._code = code;
36 return e;
37 }
38
13 CodeRefElement.created() : super.created(); 39 CodeRefElement.created() : super.created();
14 40
15 Code get code => ref; 41 @override
16 42 void attached() {
17 refChanged(oldValue) { 43 super.attached();
18 super.refChanged(oldValue); 44 _r.enable();
19 _updateShadowDom();
20 } 45 }
21 46
22 void _updateShadowDom() { 47 @override
23 clearShadowRoot(); 48 void detached() {
24 if (code == null) { 49 super.detached();
25 return; 50 _r.disable(notify: true);
26 } 51 children = [];
27 var name = (code.isOptimized ? '*' : '') + code.name; 52 }
28 if (code.isDartCode) { 53
29 insertLinkIntoShadowRoot(name, url, hoverText); 54 void render() {
30 } else { 55 final name = (_code.isOptimized ? '*' : '') + _code.name;
31 insertTextSpanIntoShadowRoot(name); 56 children = [
32 } 57 new AnchorElement(href: M.isSyntheticCode(_code.kind) ? null
58 : Uris.inspect(isolate, object: _code))
59 ..text = name
60 ..classes = ['isolate-ref']
61 ];
33 } 62 }
34 } 63 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/class_view.html ('k') | runtime/observatory/lib/src/elements/code_ref.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698