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

Side by Side Diff: sdk/lib/io/file_impl.dart

Issue 686703002: Revert "Make stdout/stderr async" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/stdio_patch.dart ('k') | sdk/lib/io/stdio.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 part of dart.io; 5 part of dart.io;
6 6
7 // Read the file in blocks of size 64k. 7 // Read the file in blocks of size 64k.
8 const int _BLOCK_SIZE = 64 * 1024; 8 const int _BLOCK_SIZE = 64 * 1024;
9 9
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 170
171 class _FileStreamConsumer extends StreamConsumer<List<int>> { 171 class _FileStreamConsumer extends StreamConsumer<List<int>> {
172 File _file; 172 File _file;
173 Future<RandomAccessFile> _openFuture; 173 Future<RandomAccessFile> _openFuture;
174 174
175 _FileStreamConsumer(File this._file, FileMode mode) { 175 _FileStreamConsumer(File this._file, FileMode mode) {
176 _openFuture = _file.open(mode: mode); 176 _openFuture = _file.open(mode: mode);
177 } 177 }
178 178
179 _FileStreamConsumer.fromStdio(int fd) {
180 assert(1 <= fd && fd <= 2);
181 _openFuture = new Future.value(_File._openStdioSync(fd));
182 }
183
184 Future<File> addStream(Stream<List<int>> stream) { 179 Future<File> addStream(Stream<List<int>> stream) {
185 Completer<File> completer = new Completer<File>.sync(); 180 Completer<File> completer = new Completer<File>.sync();
186 _openFuture 181 _openFuture
187 .then((openedFile) { 182 .then((openedFile) {
188 var _subscription; 183 var _subscription;
189 void error(e, [StackTrace stackTrace]) { 184 void error(e, [StackTrace stackTrace]) {
190 _subscription.cancel(); 185 _subscription.cancel();
191 openedFile.close(); 186 openedFile.close();
192 completer.completeError(e, stackTrace); 187 completer.completeError(e, stackTrace);
193 } 188 }
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 void _checkAvailable() { 964 void _checkAvailable() {
970 if (_asyncDispatched) { 965 if (_asyncDispatched) {
971 throw new FileSystemException("An async operation is currently pending", 966 throw new FileSystemException("An async operation is currently pending",
972 path); 967 path);
973 } 968 }
974 if (closed) { 969 if (closed) {
975 throw new FileSystemException("File closed", path); 970 throw new FileSystemException("File closed", path);
976 } 971 }
977 } 972 }
978 } 973 }
OLDNEW
« no previous file with comments | « runtime/bin/stdio_patch.dart ('k') | sdk/lib/io/stdio.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698