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

Issue 11953103: Add public-facing method and class that allows intercepting stream events. (Closed)

Created:
7 years, 11 months ago by Lasse Reichstein Nielsen
Modified:
7 years, 10 months ago
Reviewers:
floitsch
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add public-facing method and class that allows intercepting stream events. This allows intercepting events at the subscription level instead of creating a new full stream and adding the events to that. Also fix a number of typos and bugs detected by analyzer. Committed: https://code.google.com/p/dart/source/detail?r=17746

Patch Set 1 #

Patch Set 2 : Added more documentation #

Total comments: 22

Patch Set 3 : Address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+461 lines, -62 lines) Patch
M sdk/lib/async/future.dart View 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/async/merge_stream.dart View 1 2 1 chunk +8 lines, -3 lines 0 comments Download
M sdk/lib/async/stream.dart View 1 2 6 chunks +202 lines, -8 lines 0 comments Download
M sdk/lib/async/stream_impl.dart View 3 chunks +9 lines, -7 lines 0 comments Download
M sdk/lib/async/stream_pipe.dart View 1 2 9 chunks +128 lines, -43 lines 0 comments Download
M tests/lib/async/stream_controller_test.dart View 1 2 1 chunk +36 lines, -0 lines 0 comments Download
A tests/lib/async/stream_event_transform_test.dart View 1 chunk +77 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Lasse Reichstein Nielsen
7 years, 11 months ago (2013-01-25 11:46:55 UTC) #1
floitsch
LGTM. https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart File sdk/lib/async/stream.dart (right): https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#newcode45 sdk/lib/async/stream.dart:45: * The default implementation of [isBroadcast] is assuming ...
7 years, 10 months ago (2013-01-28 14:45:09 UTC) #2
Lasse Reichstein Nielsen
7 years, 10 months ago (2013-01-29 08:42:54 UTC) #3
https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart
File sdk/lib/async/stream.dart (right):

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:45: * The default implementation of [isBroadcast] is
assuming this is a
On 2013/01/28 14:45:09, floitsch wrote:
> The default implementation of [isBroadcast] returns `false`.

Done.

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:219: * types of events for each incoming event.
On 2013/01/28 14:45:09, floitsch wrote:
> Mention how pauses are handled.

Done.

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:221: * An example that adds one to each of a stream of
integers:
On 2013/01/28 14:45:09, floitsch wrote:
> Example is bad, since it could be implemented with "mappedBy".

Done.

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:222: *     intStream.transformEvents(new
StreamEventTransformer.from(
On 2013/01/28 14:45:09, floitsch wrote:
> new line before the code.

Done.

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:227: Stream transformEvents(StreamEventTransformer<T,
dynamic> transformer) {
On 2013/01/28 14:45:09, floitsch wrote:
> As discussed. We should consider making this the default ".transform", and
> rename the current transform to "chain".
> But for backwards-compatibility we need to start this way anyways.

Done.

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:937: * the events unmodified. This will not work for
data events if the types
On 2013/01/28 14:45:09, floitsch wrote:
> ... unmodified. In that case the generic type T needs to be assignable to S.

Done.

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:952: factory StreamEventTransformer.from({
Not possible. That would conflict with the constructor above, which is needed
for classes extending StreamEventTransformer.

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:956: }) => new _StreamEventTransformerImpl<S,
T>(handleData,
On 2013/01/28 14:45:09, floitsch wrote:
> too weird.
> make it a "return".

Done. It's still weird :)

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream.dart#...
sdk/lib/async/stream.dart:964: * not throw.
We don't catch it. It'll be an uncaught error in the event firing of the
underlying stream, so it will be sent to the global error handler.
I've changed "should" to "must".

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream_pipe....
File sdk/lib/async/stream_pipe.dart (right):

https://codereview.chromium.org/11953103/diff/3001/sdk/lib/async/stream_pipe....
sdk/lib/async/stream_pipe.dart:92: * Basic implemnetation of the handler
features of a [StreamSubscription].
Rewritten.

Powered by Google App Engine
This is Rietveld 408576698