Commit Graph

46 Commits

Author SHA1 Message Date
lrn@google.com c0bbe6e388 Expose the cancelOnError in the StreamController.addStream.
Type tests, so this would have been caught.

R=ajohnsen@google.com

Review URL: https://codereview.chromium.org//50373003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29434 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-29 11:28:29 +00:00
lrn@google.com 5b0ac43e80 Fix bugs in StreamController.addStream.
Add optional 'cancelOnError' to addStream method. It still defaults
to true.
Resume the added stream when adding a listener (14332).
Handle cancel-on-error correctly, so the future completes as well (14334).

BUG= http://dartbug.com/14332 http://dartbug.com/14334
R=ajohnsen@google.com

Review URL: https://codereview.chromium.org//48733002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29419 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-29 08:59:52 +00:00
ajohnsen@google.com eb64b2486f Let StreamSubscription.cancel return a Future.
This gives the ability mark a subscription cancel as asynchrouns. Thiw
now means that StreamController's onCancel takes either a value (null in
    most cases) and a Future, just like 'new Future(() => value)'.

BUG=
R=floitsch@google.com, lrn@google.com

Review URL: https://codereview.chromium.org//18915008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28925 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-21 12:09:41 +00:00
lrn@google.com a2e03e5463 Fix flaky stream_controller_async_test.
BUG= http://dartbug.com/163608
R=floitsch@google.com

Review URL: https://codereview.chromium.org//27499002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28719 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-16 11:29:13 +00:00
floitsch@google.com 146150ac51 Wait for the pause-event to have finished.
BUG= http://dartbug.com/13608
R=lrn@google.com

Review URL: https://codereview.chromium.org//24457003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27943 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-26 12:12:42 +00:00
floitsch@google.com 89373813f9 Make async stream test less flaky.
R=kustermann@google.com

Review URL: https://codereview.chromium.org//23444026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26923 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-30 15:53:23 +00:00
floitsch@google.com a9cefff022 elementAt throws a RangeError not StateError.
Review URL: https://codereview.chromium.org//23429002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26651 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 14:56:26 +00:00
lrn@google.com 0f8d8f3028 Don't assume that I can use package:-url in test.
Review URL: https://codereview.chromium.org//18271016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24839 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-09 11:25:22 +00:00
lrn@google.com 91aa700848 Add Stream.join
BUG= http://dartbug.com/11652
R=floitsch@google.com

Review URL: https://codereview.chromium.org//18271015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24838 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-09 10:55:13 +00:00
lrn@google.com d02d106430 Make StreamController be a StreamSink, not just an EventSink.
Reverts r24590

Review URL: https://codereview.chromium.org//18080019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24791 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-08 08:27:27 +00:00
lrn@google.com 1315656027 Make asBroadcastStream take two callbacks.
These callbacks will be called when the broadcast stream no longer
has any listeners, or when it gets a listener after having none.

The callback is provided with a StreamSubscription-like object where
it can pause/resume/cancel the underlying subscription on the original
stream.

BUG=http://dartbug.com/11289
R=floitsch@google.com

Review URL: https://codereview.chromium.org//17490002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24776 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-04 13:02:02 +00:00
floitsch@google.com df2bcb893f Revert "Make StreamController be a StreamSink, not just an EventSink."
Revert "Remove type variable to work around dart2js bug."

This reverts commit r24587.
This reverts commit r24588.

Review URL: https://codereview.chromium.org//18080015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24590 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 15:07:09 +00:00
lrn@google.com a15e02cc6a Make StreamController be a StreamSink, not just an EventSink.
BUG=http://dartbug.com/10677
R=floitsch@google.com

Review URL: https://codereview.chromium.org//16240008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24587 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 12:56:29 +00:00
lrn@google.com faa7227cec Make new StreamController be async by default.
Change all instances, except some tests, to be sync still.
Rename Multiplex to Broadcast everywhere.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//16125005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23453 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-31 06:07:39 +00:00
lrn@google.com 79a0a652d0 Implement asBroadcast using a _MultiplexStreamController.
R=floitsch@google.com

Review URL: https://codereview.chromium.org//15673006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23342 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-29 10:39:35 +00:00
lrn@google.com 37b1cd3b3f Optimize internals of multiplex-streams.
Make the multiplex streams broadcast streams.
This allows you to listen twice on the same stream, instead of having to get
a new stream each time.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//16007003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23256 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-28 12:06:34 +00:00
lrn@google.com 781e84284f Reapply "Active stream subscriptions".
Makes subscriptions the active part of a stream, with the stream
itself being just an inert creator of subscriptions.

This changes the behavior of a "single subscription" stream to match
the documentation: After the subscription is canceled, you can't
resubscribe to the stream. Previously, you could do that, but it was
never documented or intended.
This also makes the stream of a StreamController not be paused while
before it's subscribed - it is always the subscription that is paused
or not, and while there is no subscription, the stream cannot be
paused. Previously the stream was set to paused until the first
subscription in order to prevent events from being lost. That is
handled independently of pauses now.

Adds StreamController.multiplex constructor. This name is tentative,
and likely to change. Its behavior may change as well. It currently
provides a new single-subscription stream each time its "stream"
getter is read, and you can subscribe to these.

Adds StreamIterator class that allows iterating over a stream's data
events using (async) "moveNext()" and "current", like a direct style
Iterator (sorry, it won't work in a for-in loop).

Review URL: https://codereview.chromium.org//16131003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23237 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-28 07:28:36 +00:00
lrn@google.com cc0d9d57af Revert until Windows crash is debugged.
Reverts r23218, r23217, r23208, r23207, r23206, r23205, r23204.

r23218 | Path observer is listened more than once, so make it multiplex.
r23217 | Add StreamController.multiplex constructor.
r23208 | Fix bug in streamimpl
r23207 | Fix bug in stream iterator.
r23206 | Change expectations for http_parser_test.
r23205 | Fix bug in stream-impl.
r23204 | Make StreamSubscription be the active part of a string.

Review URL: https://codereview.chromium.org//15989006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23221 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-27 13:03:03 +00:00
lrn@google.com 23162a3847 Add StreamController.multiplex constructor.
The "multiplex" stream controller will generate a new stream every
time .stream is read on the controller, and it will send events to
any stream that currently has a listener.
The streams handle their own buffering. Events added before the listen
are ignored.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//16003002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23217 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-27 12:27:20 +00:00
lrn@google.com ee1c11a2a6 Make StreamSubscription be the active part of a string.
It is the one keeping the buffer of events, not the stream.

R=ajohnsen@google.com, floitsch@google.com, jmesserly@google.com

Review URL: https://codereview.chromium.org//14753009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23204 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-27 08:34:20 +00:00
ajohnsen@google.com f2f0261bf5 Add Stream.drain() method.
This method will discard all data on the stream and return a Future to
mark the end of the stream.

BUG=
R=floitsch@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//15999002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23140 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-24 12:45:42 +00:00
lrn@google.com 084cc64ce1 Add Stream.forEach
Review URL: https://codereview.chromium.org//14312010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21608 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-17 09:13:16 +00:00
floitsch@google.com 62d413ec91 Remove StreamController.broadcast.
Review URL: https://codereview.chromium.org//14136004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21499 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 19:08:17 +00:00
floitsch@google.com 5431a5af54 Remove AsyncError with Expando.
Review URL: https://codereview.chromium.org//14251006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21498 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 18:58:32 +00:00
ajohnsen@google.com 57161d6e59 Remove deprecated CollectionSink and Stream.pipeInto.
BUG=

Review URL: https://codereview.chromium.org//14051005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21261 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-11 09:31:50 +00:00
lrn@google.com f41508d33b Added new version of reduce.
Removed min/max and uses of min/max.

Review URL: https://codereview.chromium.org//14071002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21258 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-11 08:32:31 +00:00
floitsch@google.com 8fd6d0aafd Remove Expect from core library.
Committed: https://code.google.com/p/dart/source/detail?r=19755
Reverted: http://code.google.com/p/dart/source/detail?r=19756

Review URL: https://codereview.chromium.org//12212016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20996 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 19:43:16 +00:00
floitsch@google.com bef8ebb5f6 Add Iterable.fold (and Stream.fold) which replace reduce.
For now this is just a copy. In a next step we will change the behavior of
`reduce`.

BUG= http://dartbug.com/9536

Review URL: https://codereview.chromium.org//13548002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20978 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 16:12:40 +00:00
floitsch@google.com 65718c56df Rename XMatching to XWhere.
For example firstMatching -> firstWhere.

BUG= http://dartbug.com/8664
BUG= http://dartbug.com/8337

Review URL: https://codereview.chromium.org//12537009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19880 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-12 17:34:49 +00:00
floitsch@google.com 5dc8107c53 Revert "Remove Expect from core library."
This reverts commit 19755.

Review URL: https://codereview.chromium.org//12743005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19756 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-09 03:19:07 +00:00
floitsch@google.com 12dbd2fd70 Remove Expect from core library.
Review URL: https://codereview.chromium.org//12212016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19755 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-09 02:40:37 +00:00
lrn@google.com bead146749 Renamed StreamSink to EventSink. Renamed signalError to addError.
Review URL: https://codereview.chromium.org//12610006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19683 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-08 11:31:19 +00:00
lrn@google.com 03f5a66836 Recommit changing List.skip/take/revert returns Iterable and remove mappedBy.
This reverts r18591.

Review URL: https://codereview.chromium.org//12295009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18615 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-18 10:35:51 +00:00
rnystrom@google.com 0e0473d33a Unbreak pub:
Revert "Make List.skip, List.take and List.reversed return Iterables, not Lists."

This reverts commit 44c3745a76acfad3d1d5bfc7a8b8c8e2def30e09.

Revert "Remove deprecated mappedBy."

This reverts commit 779ab69eab73e5e349245e99560b18955908e0cc.

BUG=dartbug.com/8560

Review URL: https://codereview.chromium.org//12286004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18591 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-15 18:38:42 +00:00
floitsch@google.com 0672317bec Remove deprecated mappedBy.
Committed: https://code.google.com/p/dart/source/detail?r=18575
Reverted: http://code.google.com/p/dart/source/detail?r=18576

Review URL: https://codereview.chromium.org//12212213

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18579 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-15 13:57:18 +00:00
floitsch@google.com ad839e6957 Revert "Remove deprecated mappedBy."
This reverts commit 18575.

Review URL: https://codereview.chromium.org//12207205

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18576 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-15 13:23:22 +00:00
floitsch@google.com b37100770b Remove deprecated mappedBy.
Review URL: https://codereview.chromium.org//12212213

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18575 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-15 13:18:17 +00:00
lrn@google.com 9b23dff467 Reapply "Rename mappedBy to map."
This reverts commit r17907.

TBR.

Review URL: https://codereview.chromium.org//12090093

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17918 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 15:12:56 +00:00
floitsch@google.com b1a118d5ce Revert "Rename mappedBy to map."
This reverts commit 17899.

Review URL: https://codereview.chromium.org//12087103

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17907 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 14:02:27 +00:00
lrn@google.com 0dc2f4b1ba Rename mappedBy to map.
Retain a deprecated mappedBy for now.
Change return type of mappedBy, skip and take on List to Iterable.

BUG= http://dartbug.com/8063
BUG= http://dartbug.com/8064
BUG= http://dartbug.com/6739
BUG= http://dartbug.com/7982

Review URL: https://codereview.chromium.org//12086062

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17899 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 12:37:13 +00:00
lrn@google.com 1f05296600 Change singleSubscription/multiSubscription to normal/broadcast.
Also make StreamController not a Stream.

Review URL: https://codereview.chromium.org//12049013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17563 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-24 13:30:27 +00:00
lrn@google.com ef13a0822b Make StreamController's unnamed constructor create a single-sub stream.
R=floitsch@google.com

Review URL: https://codereview.chromium.org//11887016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17049 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-15 09:09:47 +00:00
lrn@google.com 9e95844154 Make Streams also cosider a thrown AsyncError a rethrow.
Also change handleError to be based on throws for errors.

Review URL: https://codereview.chromium.org//11862008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16973 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-11 14:08:23 +00:00
lrn@google.com aa7cbb2b41 Remove Signal class and use Future/.whenComplete instead.
Review URL: https://codereview.chromium.org//11794043

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16792 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-08 12:59:00 +00:00
vsm@google.com 52f5c2ff22 Test fixes for dartium
Review URL: https://codereview.chromium.org//11778030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16769 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-07 23:47:37 +00:00
floitsch@google.com 4a7dfd2da3 Big merge from experimental to bleeding edge.
Review URL: https://codereview.chromium.org//11783009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16687 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-07 11:23:16 +00:00