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

Side by Side Diff: packages/watcher/lib/src/async_queue.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months 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
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.async_queue;
6
7 import 'dart:async'; 5 import 'dart:async';
8 import 'dart:collection'; 6 import 'dart:collection';
9 7
10 typedef Future ItemProcessor<T>(T item); 8 typedef Future ItemProcessor<T>(T item);
11 9
12 /// A queue of items that are sequentially, asynchronously processed. 10 /// A queue of items that are sequentially, asynchronously processed.
13 /// 11 ///
14 /// Unlike [Stream.map] or [Stream.forEach], the callback used to process each 12 /// Unlike [Stream.map] or [Stream.forEach], the callback used to process each
15 /// item returns a [Future], and it will not advance to the next item until the 13 /// item returns a [Future], and it will not advance to the next item until the
16 /// current item is finished processing. 14 /// current item is finished processing.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 var item = _items.removeFirst(); 62 var item = _items.removeFirst();
65 return _processor(item).then((_) { 63 return _processor(item).then((_) {
66 if (_items.isNotEmpty) return _processNextItem(); 64 if (_items.isNotEmpty) return _processNextItem();
67 65
68 // We have drained the queue, stop processing and wait until something 66 // We have drained the queue, stop processing and wait until something
69 // has been enqueued. 67 // has been enqueued.
70 _isProcessing = false; 68 _isProcessing = false;
71 }); 69 });
72 } 70 }
73 } 71 }
OLDNEW
« no previous file with comments | « packages/watcher/benchmark/path_set.dart ('k') | packages/watcher/lib/src/constructable_file_system_event.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698