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

Issue 8318009: Update the streams interfaces (Closed)

Created:
9 years, 2 months ago by Søren Gjesse
Modified:
9 years, 1 month ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

This contains a new InputStream and StringInputStream interfaces. The readUntil is only supported through readLine on the StringInputStream. The StringInputStream implementation in string_stream.dart could live outside the VM as it is plain Dart code. BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=747

Patch Set 1 #

Total comments: 30

Patch Set 2 : Refactored InputStream #

Total comments: 14

Patch Set 3 : Starting implementation #

Total comments: 4

Patch Set 4 : Update to InputStream2 interface #

Patch Set 5 : Rebase #

Patch Set 6 : Rebased #

Patch Set 7 : New InputStream interface #

Patch Set 8 : Minor fixes #

Total comments: 34

Patch Set 9 : Addressed review comments from ager@ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+807 lines, -515 lines) Patch
M runtime/bin/bin.gypi View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M runtime/bin/file.dart View 1 2 3 4 5 6 7 1 chunk +0 lines, -8 lines 0 comments Download
M runtime/bin/file_impl.dart View 1 2 3 4 5 6 7 4 chunks +52 lines, -49 lines 0 comments Download
M runtime/bin/input_stream.dart View 1 2 3 4 5 6 7 8 1 chunk +97 lines, -7 lines 0 comments Download
M runtime/bin/process_impl.dart View 1 2 3 4 5 6 2 chunks +11 lines, -10 lines 0 comments Download
M runtime/bin/socket_impl.dart View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M runtime/bin/socket_stream.dart View 1 2 3 4 5 6 7 1 chunk +34 lines, -133 lines 0 comments Download
A runtime/bin/string_stream.dart View 1 2 3 4 5 6 7 8 1 chunk +329 lines, -0 lines 0 comments Download
D tests/standalone/src/EchoServerStreamReadUntilTest.dart View 1 2 3 4 5 6 1 chunk +0 lines, -211 lines 0 comments Download
M tests/standalone/src/EchoServerStreamTest.dart View 1 2 3 4 5 6 3 chunks +43 lines, -35 lines 0 comments Download
M tests/standalone/src/FileInputStreamTest.dart View 1 2 3 4 5 6 7 2 chunks +6 lines, -24 lines 0 comments Download
M tests/standalone/src/FileTest.dart View 1 2 3 4 5 6 4 chunks +9 lines, -9 lines 0 comments Download
M tests/standalone/src/ProcessStderrTest.dart View 1 2 3 4 5 6 1 chunk +14 lines, -12 lines 0 comments Download
M tests/standalone/src/ProcessStdoutTest.dart View 1 2 3 4 5 6 7 8 1 chunk +20 lines, -13 lines 0 comments Download
M tests/standalone/src/SocketExceptionTest.dart View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
A tests/standalone/src/StringStreamTest.dart View 1 2 3 4 5 6 7 8 1 chunk +186 lines, -0 lines 0 comments Download
M tests/standalone/src/readuntil_test.dat View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 18 (0 generated)
Søren Gjesse
This is a request for comments on the update to the streams interfaces. As we ...
9 years, 2 months ago (2011-10-17 15:36:41 UTC) #1
dcarlson
I'm interested in adding the event emitter code. This design exposes many low-level details -- ...
9 years, 2 months ago (2011-10-17 21:05:20 UTC) #2
rchandia
In the interest of simplicity I'd propose to trim the interfaces to a single method ...
9 years, 2 months ago (2011-10-17 21:53:46 UTC) #3
Søren Gjesse
I have now tried to refactor the InputStream to be more simple and event driven. ...
9 years, 2 months ago (2011-10-18 15:23:20 UTC) #4
Søren Gjesse
I forgot to mention - no updated to the OutputStream.
9 years, 2 months ago (2011-10-18 15:23:55 UTC) #5
dcarlson
In general, this feels a lot cleaner. What are you looking for on next steps? ...
9 years, 2 months ago (2011-10-18 17:26:18 UTC) #6
sra1
DBC http://codereview.chromium.org/8318009/diff/5001/runtime/bin/input_stream.dart File runtime/bin/input_stream.dart (right): http://codereview.chromium.org/8318009/diff/5001/runtime/bin/input_stream.dart#newcode21 runtime/bin/input_stream.dart:21: void set dataHandler(void callback()); There is a subtle ...
9 years, 2 months ago (2011-10-18 23:45:51 UTC) #7
Søren Gjesse
I have now done an initial implementation using the new InputStream interface. It is called ...
9 years, 2 months ago (2011-10-19 14:45:41 UTC) #8
Søren Gjesse
I discussed the InputStream2 interface with iposva@ this morning, and he was concerned by the ...
9 years, 2 months ago (2011-10-20 11:43:39 UTC) #9
dcarlson
WRT chaining: I would like to follow up with some exploration of chaining. I think ...
9 years, 2 months ago (2011-10-20 14:47:43 UTC) #10
rchandia
InputStream is missing a 'closed' getter to support the operation without callbacks.
9 years, 2 months ago (2011-10-20 15:47:19 UTC) #11
rchandia
InputStream2, I mean.
9 years, 2 months ago (2011-10-20 15:49:33 UTC) #12
rchandia
http://codereview.chromium.org/8318009/diff/11001/runtime/bin/process.dart File runtime/bin/process.dart (right): http://codereview.chromium.org/8318009/diff/11001/runtime/bin/process.dart#newcode24 runtime/bin/process.dart:24: InputStream2 get stdoutStream(); Can we rename this to stdout? ...
9 years, 2 months ago (2011-10-20 15:49:51 UTC) #13
Søren Gjesse
On 2011/10/20 14:47:43, dcarlson wrote: > WRT chaining: I would like to follow up with ...
9 years, 2 months ago (2011-10-21 15:16:50 UTC) #14
Søren Gjesse
http://codereview.chromium.org/8318009/diff/11001/runtime/bin/process.dart File runtime/bin/process.dart (right): http://codereview.chromium.org/8318009/diff/11001/runtime/bin/process.dart#newcode24 runtime/bin/process.dart:24: InputStream2 get stdoutStream(); On 2011/10/20 15:49:51, rchandia wrote: > ...
9 years, 2 months ago (2011-10-21 15:17:03 UTC) #15
Søren Gjesse
9 years, 2 months ago (2011-10-25 13:09:51 UTC) #16
Mads Ager (google)
LGTM http://codereview.chromium.org/8318009/diff/27024/runtime/bin/file_impl.dart File runtime/bin/file_impl.dart (right): http://codereview.chromium.org/8318009/diff/27024/runtime/bin/file_impl.dart#newcode49 runtime/bin/file_impl.dart:49: void set dataHandler(void callback()) { I guess a ...
9 years, 1 month ago (2011-10-26 10:56:07 UTC) #17
Søren Gjesse
9 years, 1 month ago (2011-10-26 12:03:31 UTC) #18
http://codereview.chromium.org/8318009/diff/27024/runtime/bin/file_impl.dart
File runtime/bin/file_impl.dart (right):

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/file_impl.dart#...
runtime/bin/file_impl.dart:49: void set dataHandler(void callback()) {
On 2011/10/26 10:56:07, Mads Ager wrote:
> I guess a dataHandler callback is scheduled immediately if you have enough
data.
> Then when you return, either a new one is scheduled if you have more data or
the
> endHandler is called?

I will address this in a separate cl.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/file_impl.dart#...
runtime/bin/file_impl.dart:53: void set closeHandler(void callback()) {
On 2011/10/26 10:56:07, Mads Ager wrote:
> Maybe call this end instead. That would make sense for both sockets and files.

Will change from close to end in a separate cl.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/input_stream.dart
File runtime/bin/input_stream.dart (right):

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/input_stream.da...
runtime/bin/input_stream.dart:40: * Sets the data handler gets called when data
is available.
On 2011/10/26 10:56:07, Mads Ager wrote:
> get called -> which gets called
> 
> As a separate changelist we should add a chunk size so we can control that the
> dataHandler only gets invoked at end or if at least a chunk size of data is
> available. 

Done.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/input_stream.da...
runtime/bin/input_stream.dart:45: * The close handler gets called when the
underlying communication
On 2011/10/26 10:56:07, Mads Ager wrote:
> As discussed offline we should rename to endHandler.

Will do in a separate cl.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/input_stream.da...
runtime/bin/input_stream.dart:75: * available null will be returned..
On 2011/10/26 10:56:07, Mads Ager wrote:
> .. -> .

Done.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/input_stream.da...
runtime/bin/input_stream.dart:83: bool get closed();
On 2011/10/26 10:56:07, Mads Ager wrote:
> If we rename closeHandler to endHandler maybe this should be renamed to ended?

Separate cl. Probably ended or maybe isEnded.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/input_stream.da...
runtime/bin/input_stream.dart:115: * Contains the exception message.
On 2011/10/26 10:56:07, Mads Ager wrote:
> Remove comment. Doesn't add much.

Done.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/string_stream.dart
File runtime/bin/string_stream.dart (right):

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/string_stream.d...
runtime/bin/string_stream.dart:39: // Add more binary data to be decoded.
On 2011/10/26 10:56:07, Mads Ager wrote:
> Ownership of the buffer is transferred to the Decoder, right? So people should
> not reuse the buffer when this returns? If so, we might want to add a comment
to
> that effect.

Done.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/string_stream.d...
runtime/bin/string_stream.dart:45: // Get the decoded data.
On 2011/10/26 10:56:07, Mads Ager wrote:
> Get the data decoded since the last call to decoded.

Done.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/string_stream.d...
runtime/bin/string_stream.dart:81: // Return the string decoded so far.
On 2011/10/26 10:56:07, Mads Ager wrote:
> so far -> since the last call to decoded.

Done.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/string_stream.d...
runtime/bin/string_stream.dart:150: // Check if there are not enough bytes to
decode the character
On 2011/10/26 10:56:07, Mads Ager wrote:
> Check if there are enough bytes to decode the character. Otherwise return
false.

Done.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/string_stream.d...
runtime/bin/string_stream.dart:241: print("close handler");
On 2011/10/26 10:56:07, Mads Ager wrote:
> Remove

Done.

http://codereview.chromium.org/8318009/diff/27024/runtime/bin/string_stream.d...
runtime/bin/string_stream.dart:292: // Fill decoded data into the buffer Returns
true if more data was
On 2011/10/26 10:56:07, Mads Ager wrote:
> Period after 'buffer'.

Done.

http://codereview.chromium.org/8318009/diff/27024/tests/standalone/src/Proces...
File tests/standalone/src/ProcessStdoutTest.dart (right):

http://codereview.chromium.org/8318009/diff/27024/tests/standalone/src/Proces...
tests/standalone/src/ProcessStdoutTest.dart:35: print(buffer.length);
On 2011/10/26 10:56:07, Mads Ager wrote:
> Remove?

Done.

http://codereview.chromium.org/8318009/diff/27024/tests/standalone/src/String...
File tests/standalone/src/StringStreamTest.dart (right):

http://codereview.chromium.org/8318009/diff/27024/tests/standalone/src/String...
tests/standalone/src/StringStreamTest.dart:33: print("Closing");
On 2011/10/26 10:56:07, Mads Ager wrote:
> Remove?

Done.

http://codereview.chromium.org/8318009/diff/27024/tests/standalone/src/String...
tests/standalone/src/StringStreamTest.dart:114: 
On 2011/10/26 10:56:07, Mads Ager wrote:
> remove blank line?

Done.

http://codereview.chromium.org/8318009/diff/27024/tests/standalone/src/String...
tests/standalone/src/StringStreamTest.dart:147: 
On 2011/10/26 10:56:07, Mads Ager wrote:
> Remove the blank lines?

Done.

Powered by Google App Engine
This is Rietveld 408576698