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

Issue 1616543002: Add a StreamSinkCompleter class. (Closed)

Created:
4 years, 11 months ago by nweiz
Modified:
4 years, 11 months ago
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/async.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Patch Set 1 #

Patch Set 2 : typo #

Patch Set 3 : add another test #

Total comments: 24

Patch Set 4 : Code review changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+458 lines, -1 line) Patch
M CHANGELOG.md View 1 chunk +5 lines, -0 lines 0 comments Download
M lib/async.dart View 1 chunk +1 line, -0 lines 0 comments Download
A lib/src/stream_sink_completer.dart View 1 2 3 1 chunk +151 lines, -0 lines 0 comments Download
M pubspec.yaml View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
A test/stream_sink_completer_test.dart View 1 2 3 1 chunk +255 lines, -0 lines 0 comments Download
M test/utils.dart View 2 chunks +45 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (1 generated)
nweiz
4 years, 11 months ago (2016-01-21 00:21:30 UTC) #1
Lasse Reichstein Nielsen
lgtm https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_completer.dart File lib/src/stream_sink_completer.dart (right): https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_completer.dart#newcode19 lib/src/stream_sink_completer.dart:19: class StreamSinkCompleter<T> { I don't think I like ...
4 years, 11 months ago (2016-01-21 07:28:47 UTC) #2
nweiz
Code review changes
4 years, 11 months ago (2016-01-21 20:55:40 UTC) #3
nweiz
https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_completer.dart File lib/src/stream_sink_completer.dart (right): https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_completer.dart#newcode19 lib/src/stream_sink_completer.dart:19: class StreamSinkCompleter<T> { On 2016/01/21 07:28:47, Lasse Reichstein Nielsen ...
4 years, 11 months ago (2016-01-21 20:59:05 UTC) #4
nweiz
Committed patchset #4 (id:60001) manually as 0337a74668a47cfecea42ddae5e1b7a2c0d70463 (presubmit successful).
4 years, 11 months ago (2016-01-21 20:59:29 UTC) #6
Lasse Reichstein Nielsen
4 years, 11 months ago (2016-01-22 12:49:27 UTC) #7
Message was sent while issue was closed.
https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_com...
File lib/src/stream_sink_completer.dart (right):

https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_com...
lib/src/stream_sink_completer.dart:19: class StreamSinkCompleter<T> {
Acknowledged. 
It doesn't fit my mental model of what "completing" means (putting in the
*result*), but I guess it's consistent in its own way.

https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_com...
lib/src/stream_sink_completer.dart:23: /// sink will be forwarded to the
destination.
On 2016/01/21 20:59:05, nweiz wrote:

> I don't think we can provide any stronger guarantees than [StreamController]
> does already. Since it's unspecified, I think we have to leave this
unspecified
> as well.

That's actually bad - leaving something unspecified implicitly means that users
can only depend on what it actually does. If we say explicitly that there are no
promises, then users won't be able to (reasonably) depend on the actual
behavior. 

> 
> > (I *really* want to make stream-controllers deliver their buffered events
> using
> > Timer(0) instead of scheduleMicrotask, but that's probably a breaking change
> at
> > this point).
> 
> Why, out of curiosity? That seems inconsistent with Futures.

The thing is that if a stream has a lot of buffered events, the code handling
them will become completely interleaved. If instead it waited until the
microtask queue is empty to release the next event, then the event handling code
will be nicely separated into chunks related to each event.

The total amount of work would be the same, I just like the ordering better when
the microtasks triggered by an event gets to complete before the next event is
fired.

https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_com...
lib/src/stream_sink_completer.dart:42: void setDestinationSink(StreamSink<T>
destinationSink) {
Argument accepted.

It is probably better as a method than a setter. Especially when it can only set
once.

https://codereview.chromium.org/1616543002/diff/40001/lib/src/stream_sink_com...
lib/src/stream_sink_completer.dart:46:
_sink._setDestinationSink(destinationSink);
The problem is that "set" isn't wrong. It just looks like it should have been a
setter. But I think you are right that this is better than the alternatives.

Powered by Google App Engine
This is Rietveld 408576698