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

Issue 9029001: Add close to input stream and cleanup socket and streams (Closed)

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

Description

Add close to input stream and cleanup socket and streams * All input streams now have a close method for just cutting the stream * Removed interfaces FileInputStream and FileOutputStream * Added exceptions to socket to avoid mixing stream and non-stream use of the same socket * Added special handling of the socket connect handler callback R=ager@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=2893

Patch Set 1 #

Total comments: 14

Patch Set 2 : Addressed comments by ager@ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+328 lines, -185 lines) Patch
M runtime/bin/eventhandler_linux.h View 1 2 chunks +2 lines, -1 line 0 comments Download
M runtime/bin/file.dart View 2 chunks +2 lines, -11 lines 0 comments Download
M runtime/bin/file_impl.dart View 7 chunks +8 lines, -14 lines 0 comments Download
M runtime/bin/input_stream.dart View 1 1 chunk +9 lines, -0 lines 0 comments Download
M runtime/bin/list_stream.dart View 1 3 chunks +12 lines, -0 lines 0 comments Download
M runtime/bin/process_impl.dart View 2 chunks +4 lines, -9 lines 0 comments Download
M runtime/bin/socket_impl.dart View 1 2 chunks +75 lines, -6 lines 0 comments Download
M runtime/bin/socket_stream.dart View 7 chunks +25 lines, -8 lines 0 comments Download
M runtime/bin/stream_util.dart View 1 chunk +6 lines, -0 lines 0 comments Download
M tests/standalone/src/EchoServerStreamTest.dart View 4 chunks +15 lines, -17 lines 0 comments Download
M tests/standalone/src/FileInputStreamTest.dart View 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/src/FileTest.dart View 1 4 chunks +11 lines, -29 lines 0 comments Download
M tests/standalone/src/ListInputStreamTest.dart View 3 chunks +96 lines, -2 lines 0 comments Download
M tests/standalone/src/ReadIntoConstList.dart View 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/src/SocketCloseTest.dart View 2 chunks +15 lines, -22 lines 0 comments Download
A + tests/standalone/src/SocketStreamCloseTest.dart View 8 chunks +44 lines, -61 lines 0 comments Download
M tests/stub-generator/test_config.dart View 1 chunk +1 line, -1 line 0 comments Download
M tools/testing/dart/status_file_parser.dart View 2 chunks +1 line, -2 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Søren Gjesse
9 years ago (2011-12-22 15:31:18 UTC) #1
Mads Ager (google)
LGTM with a couple of comments. http://codereview.chromium.org/9029001/diff/1/runtime/bin/eventhandler_linux.h File runtime/bin/eventhandler_linux.h (right): http://codereview.chromium.org/9029001/diff/1/runtime/bin/eventhandler_linux.h#newcode63 runtime/bin/eventhandler_linux.h:63: ASSERT(fd_ -1); Looks ...
9 years ago (2011-12-23 08:35:39 UTC) #2
Søren Gjesse
8 years, 11 months ago (2012-01-02 11:51:17 UTC) #3
http://codereview.chromium.org/9029001/diff/1/runtime/bin/eventhandler_linux.h
File runtime/bin/eventhandler_linux.h (right):

http://codereview.chromium.org/9029001/diff/1/runtime/bin/eventhandler_linux....
runtime/bin/eventhandler_linux.h:63: ASSERT(fd_ -1);
On 2011/12/23 08:35:40, Mads Ager wrote:
> Looks like you never finished this? What do you want to assert here, that fd_
!=
> -1?

ASSERT(fd_ != -1)

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

http://codereview.chromium.org/9029001/diff/1/runtime/bin/input_stream.dart#n...
runtime/bin/input_stream.dart:71: * more data. In normal situations where all
data is read from the
On 2011/12/23 08:35:40, Mads Ager wrote:
> A couple of commas would help me read this:
> 
> In normal situations, where ... called, calling [close] is not required.

Done.

http://codereview.chromium.org/9029001/diff/1/runtime/bin/list_stream.dart
File runtime/bin/list_stream.dart (right):

http://codereview.chromium.org/9029001/diff/1/runtime/bin/list_stream.dart#ne...
runtime/bin/list_stream.dart:35: bool _closeCalled = false;
On 2011/12/23 08:35:40, Mads Ager wrote:
> Is this ever used?

No, removed.

http://codereview.chromium.org/9029001/diff/1/runtime/bin/list_stream.dart#ne...
runtime/bin/list_stream.dart:46: if (_streamMarkedClosed || _closeCalled) {
On 2011/12/23 08:35:40, Mads Ager wrote:
> I think you can get rid of _closeCalled here as well (and the declaration of
it
> below).

Done.

http://codereview.chromium.org/9029001/diff/1/runtime/bin/socket_impl.dart
File runtime/bin/socket_impl.dart (right):

http://codereview.chromium.org/9029001/diff/1/runtime/bin/socket_impl.dart#ne...
runtime/bin/socket_impl.dart:355: if (_outputStream != null) throw new
StreamException("Illegal state");
On 2011/12/23 08:35:40, Mads Ager wrote:
> An error message that gave the programmer more help figuring out what is wrong
> would be nice for all of these 'illegal state' exceptions.

Done.

http://codereview.chromium.org/9029001/diff/1/runtime/bin/socket_impl.dart#ne...
runtime/bin/socket_impl.dart:422: if (_clientWriteHandler === null)
_writeHandler = null;
On 2011/12/23 08:35:40, Mads Ager wrote:
> Can't we just unconditionally do '_writeHandler = _clientWriteHandler' here?
No
> reason the keep checking for the first out event when we have just received
it?
> 
> Maybe we should even move that to the first line of writeHandler before the
> check on first out event. Once writeHandler has been called once there is no
> need to check for first out event again?

Good point. Refactored to only use this write handler for the first out event.
After that the write handler is always set to the _clientWriteHandler.

http://codereview.chromium.org/9029001/diff/1/tests/standalone/src/FileTest.dart
File tests/standalone/src/FileTest.dart (right):

http://codereview.chromium.org/9029001/diff/1/tests/standalone/src/FileTest.d...
tests/standalone/src/FileTest.dart:80: //input.close();
On 2011/12/23 08:35:40, Mads Ager wrote:
> Code in comment.

Done.

Powered by Google App Engine
This is Rietveld 408576698