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

Unified Diff: runtime/bin/vmservice/client/lib/src/elements/io_view.dart

Issue 286903010: Add dart:io view to the observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing files. Created 6 years, 7 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/bin/vmservice/client/lib/src/elements/io_view.dart
diff --git a/runtime/bin/vmservice/client/lib/src/elements/io_view.dart b/runtime/bin/vmservice/client/lib/src/elements/io_view.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0796775f8967da194b7edfa9dec7c8cc174fe882
--- /dev/null
+++ b/runtime/bin/vmservice/client/lib/src/elements/io_view.dart
@@ -0,0 +1,73 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library io_view_element;
+
+import 'dart:async';
+import 'observatory_element.dart';
+import 'service_ref.dart';
+import 'package:observatory/service.dart';
+import 'package:polymer/polymer.dart';
+
+@CustomTag('io-view')
+class IOViewElement extends ObservatoryElement {
+ @published ServiceMap io;
+
+ IOViewElement.created() : super.created();
+
+ void refresh(var done) {
+ io.reload().whenComplete(done);
+ }
+}
+
+@CustomTag('io-http-server-list-view')
+class IOHttpServerListViewElement extends ObservatoryElement {
+ @published ServiceMap list;
+
+ IOHttpServerListViewElement.created() : super.created();
+
+ void refresh(var done) {
+ list.reload().whenComplete(done);
+ }
+}
+
+@CustomTag('io-http-server-ref')
+class IOHttpServerRefElement extends ServiceRefElement {
+ IOHttpServerRefElement.created() : super.created();
+}
+
+@CustomTag('io-http-server-view')
+class IOHttpServerViewElement extends ObservatoryElement {
+ // TODO(ajohnsen): Create a HttpServer object.
+ @published ServiceMap httpServer;
+ Timer _updateTimer;
+
+ IOHttpServerViewElement.created() : super.created();
+
+ void refresh(var done) {
+ httpServer.reload().whenComplete(done);
+ }
+
+ void _updateHttpServer() {
+ refresh(() {
+ if (_updateTimer != null) {
+ _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer);
+ }
+ });
+ }
+
+ void enteredView() {
+ super.enteredView();
+ // Start a timer to update the isolate summary once a second.
+ _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer);
+ }
+
+ void leftView() {
+ super.leftView();
+ if (_updateTimer != null) {
+ _updateTimer.cancel();
+ _updateTimer = null;
+ }
+ }
+}
« no previous file with comments | « runtime/bin/vmservice/client/lib/elements.html ('k') | runtime/bin/vmservice/client/lib/src/elements/io_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698