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

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

Issue 1415393004: Mention CancelableCompleter in the CHANGELOG. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Created 5 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
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('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 library async.cancelable_operation; 5 library async.cancelable_operation;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:async/async.dart'; 9 import 'package:async/async.dart';
10 10
11 /// An asynchronuos operation that can be cancelled. 11 /// An asynchronous operation that can be cancelled.
12 /// 12 ///
13 /// The value of this operation is exposed as [value]. When this operation is 13 /// The value of this operation is exposed as [value]. When this operation is
14 /// cancelled, [value] won't complete either successfully or with an error. If 14 /// cancelled, [value] won't complete either successfully or with an error. If
15 /// [value] has already completed, cancelling the operation does nothing. 15 /// [value] has already completed, cancelling the operation does nothing.
16 class CancelableOperation<T> { 16 class CancelableOperation<T> {
17 /// The completer that produced this operation. 17 /// The completer that produced this operation.
18 /// 18 ///
19 /// This is canceled when [cancel] is called. 19 /// This is canceled when [cancel] is called.
20 final CancelableCompleter<T> _completer; 20 final CancelableCompleter<T> _completer;
21 21
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 _inner.completeError(error, stackTrace); 139 _inner.completeError(error, stackTrace);
140 } 140 }
141 141
142 /// Cancel the completer. 142 /// Cancel the completer.
143 Future _cancel() => _cancelMemo.runOnce(() { 143 Future _cancel() => _cancelMemo.runOnce(() {
144 if (_inner.isCompleted) return null; 144 if (_inner.isCompleted) return null;
145 _isCanceled = true; 145 _isCanceled = true;
146 if (_onCancel != null) return _onCancel(); 146 if (_onCancel != null) return _onCancel();
147 }); 147 });
148 } 148 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698