| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 void _updateHttpServer() { | 57 void _updateHttpServer() { |
| 58 refresh(() { | 58 refresh(() { |
| 59 if (_updateTimer != null) { | 59 if (_updateTimer != null) { |
| 60 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); | 60 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); |
| 61 } | 61 } |
| 62 }); | 62 }); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void enteredView() { | 65 @override |
| 66 super.enteredView(); | 66 void attached() { |
| 67 super.attached(); |
| 67 // Start a timer to update the isolate summary once a second. | 68 // Start a timer to update the isolate summary once a second. |
| 68 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); | 69 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); |
| 69 } | 70 } |
| 70 | 71 |
| 71 void leftView() { | 72 @override |
| 72 super.leftView(); | 73 void detached() { |
| 74 super.detached(); |
| 73 if (_updateTimer != null) { | 75 if (_updateTimer != null) { |
| 74 _updateTimer.cancel(); | 76 _updateTimer.cancel(); |
| 75 _updateTimer = null; | 77 _updateTimer = null; |
| 76 } | 78 } |
| 77 } | 79 } |
| 78 } | 80 } |
| 79 | 81 |
| 80 @CustomTag('io-http-server-connection-view') | 82 @CustomTag('io-http-server-connection-view') |
| 81 class IOHttpServerConnectionViewElement extends ObservatoryElement { | 83 class IOHttpServerConnectionViewElement extends ObservatoryElement { |
| 82 @published ServiceMap connection; | 84 @published ServiceMap connection; |
| 83 Timer _updateTimer; | 85 Timer _updateTimer; |
| 84 | 86 |
| 85 IOHttpServerConnectionViewElement.created() : super.created(); | 87 IOHttpServerConnectionViewElement.created() : super.created(); |
| 86 | 88 |
| 87 void refresh(var done) { | 89 void refresh(var done) { |
| 88 connection.reload().whenComplete(done); | 90 connection.reload().whenComplete(done); |
| 89 } | 91 } |
| 90 | 92 |
| 91 void _updateHttpServer() { | 93 void _updateHttpServer() { |
| 92 refresh(() { | 94 refresh(() { |
| 93 if (_updateTimer != null) { | 95 if (_updateTimer != null) { |
| 94 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); | 96 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); |
| 95 } | 97 } |
| 96 }); | 98 }); |
| 97 } | 99 } |
| 98 | 100 |
| 99 void enteredView() { | 101 @override |
| 100 super.enteredView(); | 102 void attached() { |
| 103 super.attached(); |
| 101 // Start a timer to update the isolate summary once a second. | 104 // Start a timer to update the isolate summary once a second. |
| 102 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); | 105 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); |
| 103 } | 106 } |
| 104 | 107 |
| 105 void leftView() { | 108 @override |
| 106 super.leftView(); | 109 void detached() { |
| 110 super.detached(); |
| 107 if (_updateTimer != null) { | 111 if (_updateTimer != null) { |
| 108 _updateTimer.cancel(); | 112 _updateTimer.cancel(); |
| 109 _updateTimer = null; | 113 _updateTimer = null; |
| 110 } | 114 } |
| 111 } | 115 } |
| 112 } | 116 } |
| 113 | 117 |
| 114 @CustomTag('io-http-server-connection-ref') | 118 @CustomTag('io-http-server-connection-ref') |
| 115 class IOHttpServerConnectionRefElement extends ServiceRefElement { | 119 class IOHttpServerConnectionRefElement extends ServiceRefElement { |
| 116 IOHttpServerConnectionRefElement.created() : super.created(); | 120 IOHttpServerConnectionRefElement.created() : super.created(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 203 } |
| 200 | 204 |
| 201 void _updateFile() { | 205 void _updateFile() { |
| 202 refresh(() { | 206 refresh(() { |
| 203 if (_updateTimer != null) { | 207 if (_updateTimer != null) { |
| 204 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); | 208 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); |
| 205 } | 209 } |
| 206 }); | 210 }); |
| 207 } | 211 } |
| 208 | 212 |
| 209 void enteredView() { | 213 @override |
| 210 super.enteredView(); | 214 void attached() { |
| 215 super.attached(); |
| 211 // Start a timer to update the isolate summary once a second. | 216 // Start a timer to update the isolate summary once a second. |
| 212 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); | 217 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); |
| 213 } | 218 } |
| 214 | 219 |
| 215 void leftView() { | 220 @override |
| 216 super.leftView(); | 221 void detached() { |
| 222 super.detached(); |
| 217 if (_updateTimer != null) { | 223 if (_updateTimer != null) { |
| 218 _updateTimer.cancel(); | 224 _updateTimer.cancel(); |
| 219 _updateTimer = null; | 225 _updateTimer = null; |
| 220 } | 226 } |
| 221 } | 227 } |
| 222 } | 228 } |
| 223 | 229 |
| 224 @CustomTag('io-process-list-view') | 230 @CustomTag('io-process-list-view') |
| 225 class IOProcessListViewElement extends ObservatoryElement { | 231 class IOProcessListViewElement extends ObservatoryElement { |
| 226 @published ServiceMap list; | 232 @published ServiceMap list; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 252 } | 258 } |
| 253 | 259 |
| 254 void _updateFile() { | 260 void _updateFile() { |
| 255 refresh(() { | 261 refresh(() { |
| 256 if (_updateTimer != null) { | 262 if (_updateTimer != null) { |
| 257 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); | 263 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); |
| 258 } | 264 } |
| 259 }); | 265 }); |
| 260 } | 266 } |
| 261 | 267 |
| 262 void enteredView() { | 268 @override |
| 263 super.enteredView(); | 269 void attached() { |
| 270 super.attached(); |
| 264 // Start a timer to update the isolate summary once a second. | 271 // Start a timer to update the isolate summary once a second. |
| 265 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); | 272 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); |
| 266 } | 273 } |
| 267 | 274 |
| 268 void leftView() { | 275 @override |
| 269 super.leftView(); | 276 void detached() { |
| 277 super.detached(); |
| 270 if (_updateTimer != null) { | 278 if (_updateTimer != null) { |
| 271 _updateTimer.cancel(); | 279 _updateTimer.cancel(); |
| 272 _updateTimer = null; | 280 _updateTimer = null; |
| 273 } | 281 } |
| 274 } | 282 } |
| 275 } | 283 } |
| OLD | NEW |