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

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

Issue 1777453002: Modernize the package's style. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Code review changes Created 4 years, 9 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/async_memoizer.dart ('k') | lib/src/delegate/event_sink.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 library async.cancelable_operation;
6
7 import 'dart:async'; 5 import 'dart:async';
8 6
9 import 'package:async/async.dart'; 7 import 'package:async/async.dart';
10 8
11 /// An asynchronous operation that can be cancelled. 9 /// An asynchronous operation that can be cancelled.
12 /// 10 ///
13 /// The value of this operation is exposed as [value]. When this operation is 11 /// 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 12 /// cancelled, [value] won't complete either successfully or with an error. If
15 /// [value] has already completed, cancelling the operation does nothing. 13 /// [value] has already completed, cancelling the operation does nothing.
16 class CancelableOperation<T> { 14 class CancelableOperation<T> {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 /// Cancel the completer. 158 /// Cancel the completer.
161 Future _cancel() { 159 Future _cancel() {
162 if (_inner.isCompleted) return new Future.value(); 160 if (_inner.isCompleted) return new Future.value();
163 161
164 return _cancelMemo.runOnce(() { 162 return _cancelMemo.runOnce(() {
165 _isCanceled = true; 163 _isCanceled = true;
166 if (_onCancel != null) return _onCancel(); 164 if (_onCancel != null) return _onCancel();
167 }); 165 });
168 } 166 }
169 } 167 }
OLDNEW
« no previous file with comments | « lib/src/async_memoizer.dart ('k') | lib/src/delegate/event_sink.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698