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

Issue 10836177: Add StreamBuffer to dart:io. (Closed)

Created:
8 years, 4 months ago by Bill Hesse
Modified:
7 years, 11 months ago
Reviewers:
nweiz, Søren Gjesse
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add StreamBuffer to dart:io. BUG=

Patch Set 1 #

Total comments: 21

Patch Set 2 : Rebase, without changes. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+277 lines, -0 lines) Patch
A runtime/bin/stream_buffer.dart View 1 chunk +249 lines, -0 lines 0 comments Download
A tests/standalone/io/stream_buffer_test.dart View 1 chunk +28 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Bill Hesse
Not quite finished (writeString, and more tests are needed), but here is a StreamBuffer class ...
8 years, 4 months ago (2012-08-09 15:40:12 UTC) #1
nweiz
http://codereview.chromium.org/10836177/diff/1/runtime/bin/stream_buffer.dart File runtime/bin/stream_buffer.dart (right): http://codereview.chromium.org/10836177/diff/1/runtime/bin/stream_buffer.dart#newcode19 runtime/bin/stream_buffer.dart:19: toBuffer._buffer = this; Style nit: I think this should ...
8 years, 4 months ago (2012-08-09 22:03:45 UTC) #2
Søren Gjesse
https://chromiumcodereview.appspot.com/10836177/diff/1/runtime/bin/stream_buffer.dart File runtime/bin/stream_buffer.dart (right): https://chromiumcodereview.appspot.com/10836177/diff/1/runtime/bin/stream_buffer.dart#newcode11 runtime/bin/stream_buffer.dart:11: StreamBuffer() I think the Dart style calls for four ...
8 years, 4 months ago (2012-08-10 07:58:10 UTC) #3
Bill Hesse
Great comments. I will use _BufferList, but it needs a lot of extension to have ...
8 years, 4 months ago (2012-08-10 09:31:07 UTC) #4
nweiz
On 2012/08/10 09:31:07, Bill Hesse wrote: > OnNoPendingWrites is an event that I thought would ...
8 years, 4 months ago (2012-08-10 18:22:43 UTC) #5
nweiz
What's the status on this CL? I'm eagerly awaiting StreamBuffer.
8 years, 3 months ago (2012-09-04 18:46:21 UTC) #6
Bill Hesse
I didn't realize anyone was enthusiatic about it - It needs some work, but I'll ...
8 years, 3 months ago (2012-09-04 23:17:13 UTC) #7
nweiz
8 years, 3 months ago (2012-09-04 23:50:31 UTC) #8
Thanks for picking this up again. It'll be helpful for our Pub work, especially
if it supports error propagation.

https://chromiumcodereview.appspot.com/10836177/diff/1/runtime/bin/stream_buf...
File runtime/bin/stream_buffer.dart (right):

https://chromiumcodereview.appspot.com/10836177/diff/1/runtime/bin/stream_buf...
runtime/bin/stream_buffer.dart:35: fromBuffer._onClosedScheduledEvent.cancel();
On 2012/08/10 07:58:10, Søren Gjesse wrote:
> On 2012/08/09 22:03:45, nweiz wrote:
> > As I mentioned in issue 4222, I don't understand why [destroy] doesn't
trigger
> > onClosed. If one end is destroyed, how does the other know to stop
> > writing/reading?
> 
> Shouldn't it call onError? Destroy sounds like just killing the whole thing.
In
> normal situations you don't need destroy a assume.

That's not how InputStream#close or OutputStream#destroy work in other
implementations.

https://chromiumcodereview.appspot.com/10836177/diff/1/runtime/bin/stream_buf...
runtime/bin/stream_buffer.dart:50: bool get closed() => _buffer._closed;
On 2012/09/04 23:17:13, Bill Hesse wrote:
> On 2012/08/09 22:03:45, nweiz wrote:
> > I'm a little confused how this relates to what you wrote in issue 4222.
Won't
> > [closed] be true as soon as [close] is called, as opposed to after
[onClosed]
> 
> When close() is called on the output stream, _closePending is set.  _close is
> only set once the onClose callback on the input stream is called.
> 
> When close() is called on the input stream, then everything is shut down, and
I
> was thinking onClose shouldn't be called because this is done by the input
> stream, so it should know that it is closed.  But I could be persuaded that
> close() on the input stream and destroy() on the output stream should trigger
an
> onClose event.  
> > has fired?
> 

It seems to be that (for an InputStream) exactly one of [onClosed] or [onError]
should fire before [closed] becomes true in all cases. It's true that the code
calling [InputStream.close] will usually be the same as the code that would
receive the event, but there will be cases where that code returns the
InputStream to other code as well (especially when issue 4202 is fixed).

Powered by Google App Engine
This is Rietveld 408576698