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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/library_ref.dart
diff --git a/runtime/observatory/lib/src/elements/library_ref.dart b/runtime/observatory/lib/src/elements/library_ref.dart
index 4f65a39ab3b9d3d85b488fed10d06c65f572f591..be8918bb358fdb9014e4cd4bbe894155c4a5450b 100644
--- a/runtime/observatory/lib/src/elements/library_ref.dart
+++ b/runtime/observatory/lib/src/elements/library_ref.dart
@@ -4,33 +4,58 @@
library library_ref_element;
-import 'package:observatory/service.dart';
-import 'package:polymer/polymer.dart';
-import 'service_ref.dart';
+import 'dart:html';
import 'dart:async';
+import 'package:observatory/models.dart' as M
+ show IsolateRef, LibraryRef;
+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('library-ref')
-class LibraryRefElement extends ServiceRefElement {
- @observable bool asValue = false;
+class LibraryRefElement extends HtmlElement implements Renderable {
+ static const tag = const Tag<LibraryRefElement>('library-ref-wrapped');
+
+ RenderingScheduler<LibraryRefElement> _r;
+
+ Stream<RenderedEvent<LibraryRefElement>> get onRendered => _r.onRendered;
+
+ M.IsolateRef _isolate;
+ M.LibraryRef _library;
+
+ M.IsolateRef get isolate => _isolate;
+ M.LibraryRef get library => _library;
+
+ factory LibraryRefElement(M.IsolateRef isolate, M.LibraryRef library,
+ {RenderingQueue queue}) {
+ assert(isolate != null);
+ assert(library != null);
+ LibraryRefElement e = document.createElement(tag.name);
+ e._r = new RenderingScheduler(e, queue: queue);
+ e._isolate = isolate;
+ e._library = library;
+ return e;
+ }
LibraryRefElement.created() : super.created();
- String makeExpandKey(String key) {
- return '${expandKey}/${key}';
+ @override
+ void attached() {
+ super.attached();
+ _r.enable();
}
- dynamic expander() {
- return expandEvent;
+ @override
+ void detached() {
+ super.detached();
+ _r.disable(notify: true);
+ children = [];
}
- void expandEvent(bool expand, Function onDone) {
- if (expand) {
- Library lib = ref;
- lib.reload().then((result) {
- return Future.wait(lib.variables.map((field) => field.reload()));
- }).whenComplete(onDone);
- } else {
- onDone();
- }
+ void render() {
+ final name = _library.name;
+ children = [
+ new AnchorElement(href: Uris.inspect(_isolate, object: _library))
+ ..text = (name == null || name.isEmpty) ? 'unnamed' : name
+ ];
}
}
« 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