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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/io.dart

Issue 25094002: Adapt streams for additional stackTrace argument. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove types in closures. Created 7 years, 2 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 /// Helper functionality to make working with IO easier. 5 /// Helper functionality to make working with IO easier.
6 library pub.io; 6 library pub.io;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection'; 9 import 'dart:collection';
10 import 'dart:convert'; 10 import 'dart:convert';
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 /// 456 ///
457 /// When an error occurs on [stream], that error is passed to [sink]. If 457 /// When an error occurs on [stream], that error is passed to [sink]. If
458 /// [cancelOnError] is true, [Future] will be completed successfully and no 458 /// [cancelOnError] is true, [Future] will be completed successfully and no
459 /// more data or errors will be piped from [stream] to [sink]. If 459 /// more data or errors will be piped from [stream] to [sink]. If
460 /// [cancelOnError] and [closeSink] are both true, [sink] will then be 460 /// [cancelOnError] and [closeSink] are both true, [sink] will then be
461 /// closed. 461 /// closed.
462 Future store(Stream stream, EventSink sink, 462 Future store(Stream stream, EventSink sink,
463 {bool cancelOnError: true, bool closeSink: true}) { 463 {bool cancelOnError: true, bool closeSink: true}) {
464 var completer = new Completer(); 464 var completer = new Completer();
465 stream.listen(sink.add, 465 stream.listen(sink.add,
466 onError: (e) { 466 onError: (e, [stackTrace]) {
467 // TODO(floitsch): Sink.addError without stack trace.
467 sink.addError(e); 468 sink.addError(e);
468 if (cancelOnError) { 469 if (cancelOnError) {
469 completer.complete(); 470 completer.complete();
470 if (closeSink) sink.close(); 471 if (closeSink) sink.close();
471 } 472 }
472 }, 473 },
473 onDone: () { 474 onDone: () {
474 if (closeSink) sink.close(); 475 if (closeSink) sink.close();
475 completer.complete(); 476 completer.complete();
476 }, cancelOnError: cancelOnError); 477 }, cancelOnError: cancelOnError);
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 const PubProcessResult(this.stdout, this.stderr, this.exitCode); 834 const PubProcessResult(this.stdout, this.stderr, this.exitCode);
834 835
835 bool get success => exitCode == 0; 836 bool get success => exitCode == 0;
836 } 837 }
837 838
838 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 839 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
839 Uri _getUri(uri) { 840 Uri _getUri(uri) {
840 if (uri is Uri) return uri; 841 if (uri is Uri) return uri;
841 return Uri.parse(uri); 842 return Uri.parse(uri);
842 } 843 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/error_group.dart ('k') | sdk/lib/_internal/pub/lib/src/safe_http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698