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

Issue 1662773003: Add StreamChannel.withGuarantees and StreamChannelController. (Closed)

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

Description

Add StreamChannel.withGuarantees and StreamChannelController. These APIs make it easier for users to create their own stream channels that follow the StreamChannel guarantees. R=tjblasi@google.com Committed: https://github.com/dart-lang/stream_channel/commit/66a45ffe55f8e5e59232a7484db0befe30c98c13

Patch Set 1 #

Total comments: 8

Patch Set 2 : Code review changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+439 lines, -2 lines) Patch
M CHANGELOG.md View 1 chunk +8 lines, -0 lines 0 comments Download
A lib/src/guarantee_channel.dart View 1 chunk +163 lines, -0 lines 0 comments Download
A lib/src/stream_channel_controller.dart View 1 1 chunk +58 lines, -0 lines 0 comments Download
M lib/stream_channel.dart View 3 chunks +13 lines, -1 line 0 comments Download
M pubspec.yaml View 1 chunk +1 line, -1 line 0 comments Download
A test/stream_channel_controller_test.dart View 1 chunk +86 lines, -0 lines 0 comments Download
A test/with_guarantees_test.dart View 1 chunk +110 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (3 generated)
nweiz
4 years, 10 months ago (2016-02-04 00:01:10 UTC) #1
nweiz
https://codereview.chromium.org/1662773003/diff/1/lib/src/stream_channel_controller.dart File lib/src/stream_channel_controller.dart (right): https://codereview.chromium.org/1662773003/diff/1/lib/src/stream_channel_controller.dart#newcode17 lib/src/stream_channel_controller.dart:17: /// StreamChannel isolateChannel(ReceivePort receivePort, SendPort sendPort) { I do ...
4 years, 10 months ago (2016-02-04 00:03:07 UTC) #2
nweiz
4 years, 10 months ago (2016-02-04 00:21:18 UTC) #4
tjblasi
lgtm https://codereview.chromium.org/1662773003/diff/1/lib/src/guarantee_channel.dart File lib/src/guarantee_channel.dart (right): https://codereview.chromium.org/1662773003/diff/1/lib/src/guarantee_channel.dart#newcode11 lib/src/guarantee_channel.dart:11: /// A [StreamChannel] that enforces the stream channel ...
4 years, 10 months ago (2016-02-04 00:33:47 UTC) #6
nweiz
Code review changes
4 years, 10 months ago (2016-02-04 01:33:42 UTC) #7
nweiz
Committed patchset #2 (id:20001) manually as 66a45ffe55f8e5e59232a7484db0befe30c98c13 (presubmit successful).
4 years, 10 months ago (2016-02-04 01:33:51 UTC) #9
nweiz
4 years, 10 months ago (2016-02-04 01:35:04 UTC) #10
Message was sent while issue was closed.
https://codereview.chromium.org/1662773003/diff/1/lib/src/guarantee_channel.dart
File lib/src/guarantee_channel.dart (right):

https://codereview.chromium.org/1662773003/diff/1/lib/src/guarantee_channel.d...
lib/src/guarantee_channel.dart:11: /// A [StreamChannel] that enforces the
stream channel guarantees.
On 2016/02/04 00:33:47, tjblasi wrote:
> Consider adding a pointer to docs explaining what the stream channel
guarantees
> are, unless this would be obvious to anyone who cares to read this code.

The guarantees are explained in the StreamChannel class documentation, which is
linked. It's not as obvious as I'd like, but I'm not sure how to do it better
without being weirdly repetitive.

https://codereview.chromium.org/1662773003/diff/1/lib/src/guarantee_channel.d...
lib/src/guarantee_channel.dart:18: _GuaranteeSink<T> _sink;
On 2016/02/04 00:33:47, tjblasi wrote:
> `_sink`, `_streamController`, and `_subscription` can all be `final`.

Unfortunately not :(. _sink's constructor needs to reference [this],
_streamController's needs to take a callback that refers to instance variables,
and _subscription is only assigned once the stream gets a listener.

https://codereview.chromium.org/1662773003/diff/1/lib/src/stream_channel_cont...
File lib/src/stream_channel_controller.dart (right):

https://codereview.chromium.org/1662773003/diff/1/lib/src/stream_channel_cont...
lib/src/stream_channel_controller.dart:36: StreamChannel<T> _local;
On 2016/02/04 00:33:47, tjblasi wrote:
> Consider making these `final` & avoiding the need for getters.

I could do it here, but both channels' constructors refer to the same two
controllers, so I'd have to add an extra dummy constructor just to make those
controllers accessible to initializers. I think this way is less gross.

Powered by Google App Engine
This is Rietveld 408576698