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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); | 63 _updateTimer = new Timer(new Duration(seconds: 1), _updateHttpServer); |
64 } | 64 } |
65 | 65 |
66 void leftView() { | 66 void leftView() { |
67 super.leftView(); | 67 super.leftView(); |
68 if (_updateTimer != null) { | 68 if (_updateTimer != null) { |
69 _updateTimer.cancel(); | 69 _updateTimer.cancel(); |
70 _updateTimer = null; | 70 _updateTimer = null; |
71 } | 71 } |
72 } | 72 } |
73 } | 73 } |
| 74 |
| 75 @CustomTag('io-random-access-file-list-view') |
| 76 class IORandomAccessFileListViewElement extends ObservatoryElement { |
| 77 @published ServiceMap list; |
| 78 |
| 79 IORandomAccessFileListViewElement.created() : super.created(); |
| 80 |
| 81 void refresh(var done) { |
| 82 list.reload().whenComplete(done); |
| 83 } |
| 84 } |
| 85 |
| 86 @CustomTag('io-random-access-file-ref') |
| 87 class IORandomAccessFileRefElement extends ServiceRefElement { |
| 88 IORandomAccessFileRefElement.created() : super.created(); |
| 89 } |
| 90 |
| 91 @CustomTag('io-random-access-file-view') |
| 92 class IORandomAccessFileViewElement extends ObservatoryElement { |
| 93 // TODO(ajohnsen): Create a RandomAccessFile object. |
| 94 @published ServiceMap file; |
| 95 Timer _updateTimer; |
| 96 |
| 97 IORandomAccessFileViewElement.created() : super.created(); |
| 98 |
| 99 void refresh(var done) { |
| 100 file.reload().whenComplete(done); |
| 101 } |
| 102 |
| 103 void _updateFile() { |
| 104 refresh(() { |
| 105 if (_updateTimer != null) { |
| 106 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); |
| 107 } |
| 108 }); |
| 109 } |
| 110 |
| 111 void enteredView() { |
| 112 super.enteredView(); |
| 113 // Start a timer to update the isolate summary once a second. |
| 114 _updateTimer = new Timer(new Duration(seconds: 1), _updateFile); |
| 115 } |
| 116 |
| 117 void leftView() { |
| 118 super.leftView(); |
| 119 if (_updateTimer != null) { |
| 120 _updateTimer.cancel(); |
| 121 _updateTimer = null; |
| 122 } |
| 123 } |
| 124 } |
OLD | NEW |