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

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

Issue 12079112: Make a bunch of stuff in pub synchronous. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix after merge. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « utils/pub/entrypoint.dart ('k') | utils/pub/git_source.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) 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';
10
9 /// An [ErrorGroup] entangles the errors of multiple [Future]s and [Stream]s 11 /// An [ErrorGroup] entangles the errors of multiple [Future]s and [Stream]s
10 /// with one another. This allows APIs to expose multiple [Future]s and 12 /// with one another. This allows APIs to expose multiple [Future]s and
11 /// [Stream]s that have identical error conditions without forcing API consumers 13 /// [Stream]s that have identical error conditions without forcing API consumers
12 /// to attach error handling to objects they don't care about. 14 /// to attach error handling to objects they don't care about.
13 /// 15 ///
14 /// To use an [ErrorGroup], register [Future]s and [Stream]s with it using 16 /// To use an [ErrorGroup], register [Future]s and [Stream]s with it using
15 /// [registerFuture] and [registerStream]. These methods return wrapped versions 17 /// [registerFuture] and [registerStream]. These methods return wrapped versions
16 /// of the [Future]s and [Stream]s, which should then be used in place of the 18 /// of the [Future]s and [Stream]s, which should then be used in place of the
17 /// originals. For example: 19 /// originals. For example:
18 /// 20 ///
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 onDone: onDone, 255 onDone: onDone,
254 unsubscribeOnError: true); 256 unsubscribeOnError: true);
255 } 257 }
256 258
257 /// Signal that an error from [_group] should be propagated through [this], 259 /// Signal that an error from [_group] should be propagated through [this],
258 /// unless it's already complete. 260 /// unless it's already complete.
259 void _signalError(AsyncError e) { 261 void _signalError(AsyncError e) {
260 if (_isDone) return; 262 if (_isDone) return;
261 _subscription.cancel(); 263 _subscription.cancel();
262 // Call these asynchronously to work around issue 7913. 264 // Call these asynchronously to work around issue 7913.
263 new Future.immediate(null).then((_) { 265 defer(() {
264 _controller.signalError(e.error, e.stackTrace); 266 _controller.signalError(e.error, e.stackTrace);
265 _controller.close(); 267 _controller.close();
266 }); 268 });
267 } 269 }
268 } 270 }
OLDNEW
« no previous file with comments | « utils/pub/entrypoint.dart ('k') | utils/pub/git_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698