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

Side by Side Diff: runtime/observatory/lib/src/elements/library_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 library_ref_element; 5 library library_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, LibraryRef;
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('library-ref') 15 class LibraryRefElement extends HtmlElement implements Renderable {
13 class LibraryRefElement extends ServiceRefElement { 16 static const tag = const Tag<LibraryRefElement>('library-ref-wrapped');
14 @observable bool asValue = false; 17
18 RenderingScheduler<LibraryRefElement> _r;
19
20 Stream<RenderedEvent<LibraryRefElement>> get onRendered => _r.onRendered;
21
22 M.IsolateRef _isolate;
23 M.LibraryRef _library;
24
25 M.IsolateRef get isolate => _isolate;
26 M.LibraryRef get library => _library;
27
28 factory LibraryRefElement(M.IsolateRef isolate, M.LibraryRef library,
29 {RenderingQueue queue}) {
30 assert(isolate != null);
31 assert(library != null);
32 LibraryRefElement e = document.createElement(tag.name);
33 e._r = new RenderingScheduler(e, queue: queue);
34 e._isolate = isolate;
35 e._library = library;
36 return e;
37 }
15 38
16 LibraryRefElement.created() : super.created(); 39 LibraryRefElement.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 final name = _library.name;
28 Library lib = ref; 56 children = [
29 lib.reload().then((result) { 57 new AnchorElement(href: Uris.inspect(_isolate, object: _library))
30 return Future.wait(lib.variables.map((field) => field.reload())); 58 ..text = (name == null || name.isEmpty) ? 'unnamed' : name
31 }).whenComplete(onDone); 59 ];
32 } else {
33 onDone();
34 }
35 } 60 }
36 } 61 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/isolate_view.html ('k') | runtime/observatory/lib/src/elements/library_ref.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698