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

Issue 12082047: Remove transformEvents and make StreamEventTransformer extend StreamTransformer. (Closed)

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

Description

Remove transformEvents and make StreamEventTransformer extend StreamTransformer. Make a StreamEventTransformer the default for the StreamTransformer factory constructor, and remove the old implementation. Committed: https://code.google.com/p/dart/source/detail?r=17761

Patch Set 1 #

Total comments: 8

Patch Set 2 : Addressed review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+93 lines, -152 lines) Patch
M sdk/lib/async/stream.dart View 1 7 chunks +61 lines, -57 lines 0 comments Download
M sdk/lib/async/stream_pipe.dart View 2 chunks +21 lines, -85 lines 0 comments Download
M tests/lib/async/stream_controller_test.dart View 2 chunks +8 lines, -8 lines 0 comments Download
M tests/lib/async/stream_event_transform_test.dart View 3 chunks +3 lines, -2 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Lasse Reichstein Nielsen
7 years, 10 months ago (2013-01-29 13:14:50 UTC) #1
floitsch
LGTM. https://codereview.chromium.org/12082047/diff/1/sdk/lib/async/stream.dart File sdk/lib/async/stream.dart (right): https://codereview.chromium.org/12082047/diff/1/sdk/lib/async/stream.dart#newcode933 sdk/lib/async/stream.dart:933: * someTypeStream.transform(new StreamTransformer<Type, Type>( Make it a real ...
7 years, 10 months ago (2013-01-29 13:37:04 UTC) #2
Lasse Reichstein Nielsen
7 years, 10 months ago (2013-01-29 14:04:14 UTC) #3
https://codereview.chromium.org/12082047/diff/1/sdk/lib/async/stream.dart
File sdk/lib/async/stream.dart (right):

https://codereview.chromium.org/12082047/diff/1/sdk/lib/async/stream.dart#new...
sdk/lib/async/stream.dart:933: *     someTypeStream.transform(new
StreamTransformer<Type, Type>(
On 2013/01/29 13:37:04, floitsch wrote:
> Make it a real example.
> stringStream.transform(new StreamTransformer<String, String>(
>     handleData: (String value, StreamSink<String> sink) {
>       sink.add(value);
>       sink.add(value);  // Double the incoming events.
>     }));

Done.

https://codereview.chromium.org/12082047/diff/1/sdk/lib/async/stream.dart#new...
sdk/lib/async/stream.dart:962: * types of events for each incoming event. Pauses
on the returned
The latter. The returned stream can't buffer at all, it can just wrap a
subscription in another and transform events on the way. All pauses and
unsubscribes are forwarded.
Reworded slightly.

https://codereview.chromium.org/12082047/diff/1/sdk/lib/async/stream_pipe.dart
File sdk/lib/async/stream_pipe.dart (left):

https://codereview.chromium.org/12082047/diff/1/sdk/lib/async/stream_pipe.dar...
sdk/lib/async/stream_pipe.dart:576: try {
We don't need to remove them. Let's keep them for consistency.
It's different from what the methods on StreamEventTransformer do - if they
throw it will sent to the global event handler.
The same happens here.
I'll add try/catch around the call in the wrapping subscription, so both are
handled.

https://codereview.chromium.org/12082047/diff/1/tests/lib/async/stream_contro...
File tests/lib/async/stream_controller_test.dart (right):

https://codereview.chromium.org/12082047/diff/1/tests/lib/async/stream_contro...
tests/lib/async/stream_controller_test.dart:98: handleError: (e, s) {
s.add(e.error); },
In this case, I convert the thrown value to a data event, so this is what I
want. I don't want the AsyncError as the data event.

Powered by Google App Engine
This is Rietveld 408576698