| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 void leftView() { | 144 void leftView() { |
| 145 super.leftView(); | 145 super.leftView(); |
| 146 if (_updateTimer != null) { | 146 if (_updateTimer != null) { |
| 147 _updateTimer.cancel(); | 147 _updateTimer.cancel(); |
| 148 _updateTimer = null; | 148 _updateTimer = null; |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 |
| 153 @CustomTag('io-process-list-view') |
| 154 class IOProcessListViewElement extends ObservatoryElement { |
| 155 @published ServiceMap list; |
| 156 |
| 157 IOProcessListViewElement.created() : super.created(); |
| 158 |
| 159 void refresh(var done) { |
| 160 list.reload().whenComplete(done); |
| 161 } |
| 162 } |
| 163 |
| 164 @CustomTag('io-process-ref') |
| 165 class IOProcessRefElement extends ServiceRefElement { |
| 166 // Only display the process name when small is set. |
| 167 @published bool small = false; |
| 168 IOProcessRefElement.created() : super.created(); |
| 169 } |
| 170 |
| 171 @CustomTag('io-process-view') |
| 172 class IOProcessViewElement extends ObservatoryElement { |
| 173 // TODO(ajohnsen): Create a Process object. |
| 174 @published ServiceMap process; |
| 175 Timer _updateTimer; |
| 176 |
| 177 IOProcessViewElement.created() : super.created(); |
| 178 |
| 179 void refresh(var done) { |
| 180 process.reload().whenComplete(done); |
| 181 } |
| 182 |
| 183 void _updateFile() { |
| 184 refresh(() { |
| 185 if (_updateTimer != null) { |
| 186 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); |
| 187 } |
| 188 }); |
| 189 } |
| 190 |
| 191 void enteredView() { |
| 192 super.enteredView(); |
| 193 // Start a timer to update the isolate summary once a second. |
| 194 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); |
| 195 } |
| 196 |
| 197 void leftView() { |
| 198 super.leftView(); |
| 199 if (_updateTimer != null) { |
| 200 _updateTimer.cancel(); |
| 201 _updateTimer = null; |
| 202 } |
| 203 } |
| 204 } |
| OLD | NEW |