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

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

Issue 2204973003: Converted Observatory class-ref & library-ref elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixed indentation 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 class_ref_element; 5 library class_ref_element;
6 6
7 import 'package:observatory/service.dart'; 7 import 'dart:html';
8 import 'package:polymer/polymer.dart';
9 import 'service_ref.dart';
10 import 'dart:async'; 8 import 'dart:async';
9 import 'package:observatory/models.dart' as M
10 show IsolateRef, ClassRef;
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';
11 14
12 @CustomTag('class-ref') 15 class ClassRefElement extends HtmlElement implements Renderable {
13 class ClassRefElement extends ServiceRefElement { 16 static const tag = const Tag<ClassRefElement>('class-ref-wrapped');
14 @observable bool asValue = false; 17
18 RenderingScheduler<ClassRefElement> _r;
19
20 Stream<RenderedEvent<ClassRefElement>> get onRendered => _r.onRendered;
21
22 M.IsolateRef _isolate;
23 M.ClassRef _class;
24
25 M.IsolateRef get isolate => _isolate;
26 M.ClassRef get cls => _class;
27
28 factory ClassRefElement(M.IsolateRef isolate, M.ClassRef cls,
29 {RenderingQueue queue}) {
30 assert(isolate != null);
31 assert(cls != null);
32 ClassRefElement e = document.createElement(tag.name);
33 e._r = new RenderingScheduler(e, queue: queue);
34 e._isolate = isolate;
35 e._class = cls;
36 return e;
37 }
15 38
16 ClassRefElement.created() : super.created(); 39 ClassRefElement.created() : super.created();
17 40
18 String makeExpandKey(String key) { 41 @override
19 return '${expandKey}/${key}'; 42 void attached() {
43 super.attached();
44 _r.enable();
20 } 45 }
21 46
22 dynamic expander() { 47 @override
23 return expandEvent; 48 void detached() {
49 super.detached();
50 _r.disable(notify: true);
51 children = [];
24 } 52 }
25 53
26 void expandEvent(bool expand, Function onDone) { 54 void render() {
27 if (expand) { 55 children = [
28 Class cls = ref; 56 new AnchorElement(href: Uris.inspect(_isolate, object: _class))
29 cls.reload().then((result) { 57 ..text = _class.name
30 return Future.wait(cls.fields.map((field) => field.reload())); 58 ];
31 }).whenComplete(onDone);
32 } else {
33 onDone();
34 }
35 } 59 }
36 } 60 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/elements.html ('k') | runtime/observatory/lib/src/elements/class_ref.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698