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; |
+ } |
+ } |
+} |