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

Side by Side Diff: utils/pub/error_group.dart

Issue 14251013: Rename unsubscribeOnError to cancelOnError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | 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 error_group; 5 library error_group;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'utils.dart'; 9 import 'utils.dart';
10 10
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 _group._signalError(e); 244 _group._signalError(e);
245 }, onDone: () { 245 }, onDone: () {
246 _isDone = true; 246 _isDone = true;
247 _group._signalStreamComplete(this); 247 _group._signalStreamComplete(this);
248 _controller.close(); 248 _controller.close();
249 }); 249 });
250 } 250 }
251 251
252 StreamSubscription listen(void onData(value), 252 StreamSubscription listen(void onData(value),
253 {void onError(AsyncError error), void onDone(), 253 {void onError(AsyncError error), void onDone(),
254 bool unsubscribeOnError}) { 254 bool cancelOnError}) {
255 return _controller.stream.listen(onData, 255 return _controller.stream.listen(onData,
256 onError: onError, 256 onError: onError,
257 onDone: onDone, 257 onDone: onDone,
258 unsubscribeOnError: true); 258 cancelOnError: true);
259 } 259 }
260 260
261 /// Signal that an error from [_group] should be propagated through [this], 261 /// Signal that an error from [_group] should be propagated through [this],
262 /// unless it's already complete. 262 /// unless it's already complete.
263 void _signalError(AsyncError e) { 263 void _signalError(AsyncError e) {
264 if (_isDone) return; 264 if (_isDone) return;
265 _subscription.cancel(); 265 _subscription.cancel();
266 // Call these asynchronously to work around issue 7913. 266 // Call these asynchronously to work around issue 7913.
267 new Future.immediate(null).then((_) { 267 new Future.immediate(null).then((_) {
268 _controller.addError(e.error, e.stackTrace); 268 _controller.addError(e.error, e.stackTrace);
269 _controller.close(); 269 _controller.close();
270 }); 270 });
271 } 271 }
272 } 272 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698