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

Issue 9474004: Make FileInputStream and FileOutputStream actually asynchronous. (Closed)

Created:
8 years, 10 months ago by Mads Ager (google)
Modified:
8 years, 10 months ago
Reviewers:
Søren Gjesse
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Make FileInputStream and FileOutputStream actually asynchronous. Use the async API of the underlying file. This also means that openInputStream and openOutputStream can directly return the stream without performing IO. I'll do that change as a follow-up. R=sgjesse@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=4662

Patch Set 1 #

Patch Set 2 : Remove accidental edit #

Total comments: 13

Patch Set 3 : Fix stream test. #

Patch Set 4 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+421 lines, -290 lines) Patch
M runtime/bin/chunked_stream.dart View 3 chunks +5 lines, -2 lines 0 comments Download
M runtime/bin/file.dart View 3 chunks +3 lines, -3 lines 0 comments Download
M runtime/bin/file_impl.dart View 1 2 3 10 chunks +160 lines, -116 lines 0 comments Download
M runtime/bin/stream_util.dart View 6 chunks +12 lines, -4 lines 0 comments Download
M runtime/bin/string_stream.dart View 3 chunks +7 lines, -3 lines 0 comments Download
M runtime/bin/timer_impl.dart View 2 chunks +10 lines, -5 lines 0 comments Download
M tests/standalone/src/FileInputStreamTest.dart View 1 2 3 2 chunks +23 lines, -14 lines 0 comments Download
M tests/standalone/src/FileInvalidArgumentsTest.dart View 4 chunks +10 lines, -7 lines 0 comments Download
M tests/standalone/src/FileTest.dart View 1 2 3 5 chunks +126 lines, -90 lines 0 comments Download
M tests/standalone/src/StreamPipeTest.dart View 1 2 7 chunks +38 lines, -18 lines 0 comments Download
M tests/standalone/src/TimerCancelTest.dart View 1 2 3 1 chunk +27 lines, -28 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Mads Ager (google)
8 years, 10 months ago (2012-02-27 16:04:55 UTC) #1
Søren Gjesse
lgtm http://codereview.chromium.org/9474004/diff/1001/runtime/bin/chunked_stream.dart File runtime/bin/chunked_stream.dart (right): http://codereview.chromium.org/9474004/diff/1001/runtime/bin/chunked_stream.dart#newcode125 runtime/bin/chunked_stream.dart:125: if (_scheduledDataCallback != null) { Woops! http://codereview.chromium.org/9474004/diff/1001/runtime/bin/file_impl.dart File ...
8 years, 10 months ago (2012-02-28 07:40:25 UTC) #2
Søren Gjesse
http://codereview.chromium.org/9474004/diff/1001/runtime/bin/file_impl.dart File runtime/bin/file_impl.dart (right): http://codereview.chromium.org/9474004/diff/1001/runtime/bin/file_impl.dart#newcode35 runtime/bin/file_impl.dart:35: openedFile.length(); On 2012/02/28 07:40:25, Søren Gjesse wrote: > What ...
8 years, 10 months ago (2012-02-28 08:10:26 UTC) #3
Mads Ager (google)
8 years, 10 months ago (2012-02-28 08:21:00 UTC) #4
http://codereview.chromium.org/9474004/diff/1001/runtime/bin/file_impl.dart
File runtime/bin/file_impl.dart (right):

http://codereview.chromium.org/9474004/diff/1001/runtime/bin/file_impl.dart#n...
runtime/bin/file_impl.dart:145: return false;
On 2012/02/28 07:40:25, Søren Gjesse wrote:
> We should probably revisit whether write and writeFrom should have boolean
> return type.

Agreed, we probably should.

http://codereview.chromium.org/9474004/diff/1001/runtime/bin/file_impl.dart#n...
runtime/bin/file_impl.dart:519: void openInputStream() {
On 2012/02/28 07:40:25, Søren Gjesse wrote:
> So you kept the Sync/non Sync versions for now?

Yes, I will do a follow-up change today to get rid of that again. :)

http://codereview.chromium.org/9474004/diff/1001/tests/standalone/src/FileInp...
File tests/standalone/src/FileInputStreamTest.dart (right):

http://codereview.chromium.org/9474004/diff/1001/tests/standalone/src/FileInp...
tests/standalone/src/FileInputStreamTest.dart:74: x.chunkSize = 5;
On 2012/02/28 07:40:25, Søren Gjesse wrote:
> I guess that this test is actually wrong, as the data handler callback only
> ensures that 9 bytes are available. The additional reads should be in a new
data
> handler callback.

Thanks. Done.

http://codereview.chromium.org/9474004/diff/1001/tests/standalone/src/FileTes...
File tests/standalone/src/FileTest.dart (right):

http://codereview.chromium.org/9474004/diff/1001/tests/standalone/src/FileTes...
tests/standalone/src/FileTest.dart:327: OutputStream appendingOutput =
file2.openOutputStreamSync(FileMode.APPEND);
On 2012/02/28 07:40:25, Søren Gjesse wrote:
> Long line.

Done.

http://codereview.chromium.org/9474004/diff/1001/tests/standalone/src/TimerCa...
File tests/standalone/src/TimerCancelTest.dart (right):

http://codereview.chromium.org/9474004/diff/1001/tests/standalone/src/TimerCa...
tests/standalone/src/TimerCancelTest.dart:34: var t2;
On 2012/02/28 07:40:25, Søren Gjesse wrote:
> Does the API specify that timers with the same timeout will be processed in
> creation order? Also in some cases the two timers will probably not get the
same
> timeout, as the wall time have advanced when t2 is created.

Good point. I have changed the test so the timer that fires first cancels the
other timer.

Powered by Google App Engine
This is Rietveld 408576698