Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: pkg/watcher/lib/src/directory_watcher/polling.dart

Issue 68253010: Be sure we don't forward an error to a closed event stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Un-mark the test as flaky Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 watcher.directory_watcher.polling; 5 library watcher.directory_watcher.polling;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:crypto/crypto.dart'; 10 import 'package:crypto/crypto.dart';
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 AsyncQueue<String> _filesToProcess; 65 AsyncQueue<String> _filesToProcess;
66 66
67 /// The set of files that have been seen in the current directory listing. 67 /// The set of files that have been seen in the current directory listing.
68 /// 68 ///
69 /// Used to tell which files have been removed: files that are in [_statuses] 69 /// Used to tell which files have been removed: files that are in [_statuses]
70 /// but not in here when a poll completes have been removed. 70 /// but not in here when a poll completes have been removed.
71 final _polledFiles = new Set<String>(); 71 final _polledFiles = new Set<String>();
72 72
73 _PollingDirectoryWatcher(this.directory, this._pollingDelay) { 73 _PollingDirectoryWatcher(this.directory, this._pollingDelay) {
74 _filesToProcess = new AsyncQueue<String>(_processFile, 74 _filesToProcess = new AsyncQueue<String>(_processFile,
75 onError: _events.addError); 75 onError: (e, stackTrace) {
76 if (!_events.isClosed) _events.addError(e, stackTrace);
77 });
76 78
77 _poll(); 79 _poll();
78 } 80 }
79 81
80 void close() { 82 void close() {
81 _events.close(); 83 _events.close();
82 84
83 // If we're in the middle of listing the directory, stop. 85 // If we're in the middle of listing the directory, stop.
84 if (_listSubscription != null) _listSubscription.cancel(); 86 if (_listSubscription != null) _listSubscription.cancel();
85 87
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 class _FileStatus { 209 class _FileStatus {
208 /// The last time the file was modified. 210 /// The last time the file was modified.
209 DateTime modified; 211 DateTime modified;
210 212
211 /// The SHA-1 hash of the contents of the file. 213 /// The SHA-1 hash of the contents of the file.
212 List<int> hash; 214 List<int> hash;
213 215
214 _FileStatus(this.modified, this.hash); 216 _FileStatus(this.modified, this.hash);
215 } 217 }
216 218
OLDNEW
« pkg/watcher/lib/src/async_queue.dart ('K') | « pkg/watcher/lib/src/async_queue.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698