| OLD | NEW | 
|---|
| 1 // Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 io_view_element; | 5 library io_view_element; | 
| 6 | 6 | 
| 7 import 'dart:async'; | 7 import 'dart:async'; | 
| 8 import 'observatory_element.dart'; | 8 import 'observatory_element.dart'; | 
| 9 import 'service_ref.dart'; | 9 import 'service_ref.dart'; | 
| 10 import 'package:observatory/service.dart'; | 10 import 'package:observatory/service.dart'; | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 70 | 70 | 
| 71   void leftView() { | 71   void leftView() { | 
| 72     super.leftView(); | 72     super.leftView(); | 
| 73     if (_updateTimer != null) { | 73     if (_updateTimer != null) { | 
| 74       _updateTimer.cancel(); | 74       _updateTimer.cancel(); | 
| 75       _updateTimer = null; | 75       _updateTimer = null; | 
| 76     } | 76     } | 
| 77   } | 77   } | 
| 78 } | 78 } | 
| 79 | 79 | 
|  | 80 @CustomTag('io-http-server-connection-view') | 
|  | 81 class IOHttpServerConnectionViewElement extends ObservatoryElement { | 
|  | 82   @published ServiceMap connection; | 
|  | 83   Timer _updateTimer; | 
|  | 84 | 
|  | 85   IOHttpServerConnectionViewElement.created() : super.created(); | 
|  | 86 | 
|  | 87   void refresh(var done) { | 
|  | 88     connection.reload().whenComplete(done); | 
|  | 89   } | 
|  | 90 | 
|  | 91   void _updateHttpServer() { | 
|  | 92     refresh(() { | 
|  | 93       if (_updateTimer != null) { | 
|  | 94         _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); | 
|  | 95       } | 
|  | 96     }); | 
|  | 97   } | 
|  | 98 | 
|  | 99   void enteredView() { | 
|  | 100     super.enteredView(); | 
|  | 101     // Start a timer to update the isolate summary once a second. | 
|  | 102     _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); | 
|  | 103   } | 
|  | 104 | 
|  | 105   void leftView() { | 
|  | 106     super.leftView(); | 
|  | 107     if (_updateTimer != null) { | 
|  | 108       _updateTimer.cancel(); | 
|  | 109       _updateTimer = null; | 
|  | 110     } | 
|  | 111   } | 
|  | 112 } | 
|  | 113 | 
|  | 114 @CustomTag('io-http-server-connection-ref') | 
|  | 115 class IOHttpServerConnectionRefElement extends ServiceRefElement { | 
|  | 116   IOHttpServerConnectionRefElement.created() : super.created(); | 
|  | 117 } | 
|  | 118 | 
| 80 @CustomTag('io-socket-ref') | 119 @CustomTag('io-socket-ref') | 
| 81 class IOSocketRefElement extends ServiceRefElement { | 120 class IOSocketRefElement extends ServiceRefElement { | 
| 82   IOSocketRefElement.created() : super.created(); | 121   IOSocketRefElement.created() : super.created(); | 
| 83 } | 122 } | 
| 84 | 123 | 
| 85 @CustomTag('io-socket-list-view') | 124 @CustomTag('io-socket-list-view') | 
| 86 class IOSocketListViewElement extends ObservatoryElement { | 125 class IOSocketListViewElement extends ObservatoryElement { | 
| 87   @published ServiceMap list; | 126   @published ServiceMap list; | 
| 88 | 127 | 
| 89   IOSocketListViewElement.created() : super.created(); | 128   IOSocketListViewElement.created() : super.created(); | 
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 227   } | 266   } | 
| 228 | 267 | 
| 229   void leftView() { | 268   void leftView() { | 
| 230     super.leftView(); | 269     super.leftView(); | 
| 231     if (_updateTimer != null) { | 270     if (_updateTimer != null) { | 
| 232       _updateTimer.cancel(); | 271       _updateTimer.cancel(); | 
| 233       _updateTimer = null; | 272       _updateTimer = null; | 
| 234     } | 273     } | 
| 235   } | 274   } | 
| 236 } | 275 } | 
| OLD | NEW | 
|---|