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

Side by Side Diff: lib/src/stream_queue.dart

Issue 2660333005: Change generic comment syntax to real generic syntax. (Closed)
Patch Set: Update version. Created 3 years, 10 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
« no previous file with comments | « lib/src/stream_group.dart ('k') | lib/src/stream_sink_completer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 7
8 import 'package:collection/collection.dart'; 8 import 'package:collection/collection.dart';
9 9
10 import "cancelable_operation.dart"; 10 import "cancelable_operation.dart";
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 /// ```dart 347 /// ```dart
348 /// final _stdinQueue = new StreamQueue(stdin); 348 /// final _stdinQueue = new StreamQueue(stdin);
349 /// 349 ///
350 /// /// Returns an operation that completes when the user sends a line to 350 /// /// Returns an operation that completes when the user sends a line to
351 /// /// standard input. 351 /// /// standard input.
352 /// /// 352 /// ///
353 /// /// If the operation is canceled, stops waiting for user input. 353 /// /// If the operation is canceled, stops waiting for user input.
354 /// CancelableOperation<String> nextStdinLine() => 354 /// CancelableOperation<String> nextStdinLine() =>
355 /// _stdinQueue.cancelable((queue) => queue.next); 355 /// _stdinQueue.cancelable((queue) => queue.next);
356 /// ``` 356 /// ```
357 CancelableOperation/*<S>*/ cancelable/*<S>*/( 357 CancelableOperation<S> cancelable<S>(
358 Future/*<S>*/ callback(StreamQueue<T> queue)) { 358 Future<S> callback(StreamQueue<T> queue)) {
359 var transaction = startTransaction(); 359 var transaction = startTransaction();
360 var completer = new CancelableCompleter/*<S>*/(onCancel: () { 360 var completer = new CancelableCompleter<S>(onCancel: () {
361 transaction.reject(); 361 transaction.reject();
362 }); 362 });
363 363
364 var queue = transaction.newQueue(); 364 var queue = transaction.newQueue();
365 completer.complete(callback(queue).whenComplete(() { 365 completer.complete(callback(queue).whenComplete(() {
366 if (!completer.isCanceled) transaction.commit(queue); 366 if (!completer.isCanceled) transaction.commit(queue);
367 })); 367 }));
368 368
369 return completer.operation; 369 return completer.operation;
370 } 370 }
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 } 980 }
981 981
982 bool update(QueueList<Result<T>> events, bool isDone) { 982 bool update(QueueList<Result<T>> events, bool isDone) {
983 while (_eventsSent < events.length) { 983 while (_eventsSent < events.length) {
984 events[_eventsSent++].addTo(_controller); 984 events[_eventsSent++].addTo(_controller);
985 } 985 }
986 if (isDone && !_controller.isClosed) _controller.close(); 986 if (isDone && !_controller.isClosed) _controller.close();
987 return false; 987 return false;
988 } 988 }
989 } 989 }
OLDNEW
« no previous file with comments | « lib/src/stream_group.dart ('k') | lib/src/stream_sink_completer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698