Commit Graph

109 Commits

Author SHA1 Message Date
floitsch@google.com 60e5ca3727 Add runAsync interceptor.
BUG= http://dartbug.com/11279
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24470 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-26 14:41:03 +00:00
floitsch@google.com 48b1656690 Allow Object when doing lookups.
According to our typing rules a Set<Apple> is a Set<Fruit>. However, before this change, we couldn't use it as a Set<Fruit>:

===
bool foo(Set<Fruit> fruits) {
  // Would yield a type-error since we actually got a Set<Apple>.
  return fruits.contains(new Banana());
}

foo(new Set<Apple>());
===

R=ajohnsen@google.com, blois@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24326 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-24 12:45:10 +00:00
floitsch@google.com 2ae198d527 Reapply "Zone support for Futures, Timer, Streams."
This reapplies commit r24034.
This reapplies commit r24035.
This reapplies commit r24036.
This reapplies commit r24037.

+ some status file updates and fixes.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24064 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-15 11:28:38 +00:00
floitsch@google.com bcba9d5c8c Revert "Zone support for Futures."
Revert "Add Zone support for Timers."
Revert "Add zone support to streams."
Revert "catchErrors and waitForCompletion now based on runZonedExperimental."

This reverts commit r24034.
This reverts commit r24035.
This reverts commit r24036.
This reverts commit r24037.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24042 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 17:17:16 +00:00
floitsch@google.com 9485a093ae catchErrors and waitForCompletion now based on runZonedExperimental.
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24037 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 16:29:32 +00:00
floitsch@google.com 496f6dca97 Add zone support to streams.
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24036 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 16:28:32 +00:00
floitsch@google.com 96c6330215 Add Zone support for Timers.
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24035 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 16:27:35 +00:00
floitsch@google.com 40216008f2 Zone support for Futures.
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24034 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 16:26:45 +00:00
lrn@google.com df6b4b13f8 Make _FutureImpl._chain do path shortening on listeners.
A chained future is one that will give exactly the same result as another
future. It is used to handle, e.g., futures returned by .then handlers.

Currently we chaing futures by simply making the future itself a listener
on the future it is chained to.

This change makes the future move all its listeners to the future it is
chained to, and forward future listeners as well. It avoids long chains of
futures depending on each other.

Effectively, chained futures form equivalence classes. This makes the
equivalence classess all be represented by the future that every other element
depends on, and it applies path shortening to make the dependency graph as
flat as possible.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23807 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-10 12:27:46 +00:00
antonm@google.com ae1393fcdc Revert "Try out 15 ms safety margin."
TBR=floitsch@google.com, iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23732 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-07 08:38:09 +00:00
antonm@google.com 5d90793a87 Try out 15 ms safety margin.
If tests start to pass on Windows, it might be a notable clue
that Stopwatch implementation on this platform is not precise
enough.

R=floitsch@google.com
BUG=10982

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23696 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-06 16:43:16 +00:00
lrn@google.com 662c2a8262 Rename RuntimeError to CyclicIntializationError, as per spec.
The RuntimeError has been used to report cyclic initialization errors in
dart2js.
It has also been used for other, unrelated, uses, where it makes
little to no sense.

The RuntimeError type has been removed, but added in js_helper.dart,
where dart2js uses it.

Uses of new RuntimeError("some message") have been converted to
other errors (Argument/State/Unsupported). In some cases, just
throwing a String might have been just as good.

BUG=http://dartbug.com/11040
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23584 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-04 10:33:11 +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
podivilov@google.com 5adef4e9bd Fix bug in VM timer implementation.
Timers stop working after exception in callback.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23271 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-28 13:54:10 +00:00
floitsch@google.com 5982226109 Revert "Mark periodic4-test as flaky and add debug information."
This reverts commit 20868.

BUG= http://dartbug.com/9619
R=lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23262 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-28 13:01:13 +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
floitsch@google.com 968ebcff5a Make Completers asynchronous.
BUG= http://dartbug.com/9990
R=ajohnsen@google.com, lrn@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22417 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-06 15:15:15 +00:00
floitsch@google.com 80aad7930f Fix skipWhile.
BUG= http://dartbug.com/9480

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21623 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-17 15:39: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 466d6670c1 Refactor Future constructors.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21517 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 21:24:27 +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
floitsch@google.com f553392322 Change StreamController constructor.
Review URL: https://codereview.chromium.org//14196003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21472 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 16:34:26 +00:00
floitsch@google.com e2ee353940 Rename unsubscribeOnError to cancelOnError.
Review URL: https://codereview.chromium.org//14251013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21469 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 16:07:36 +00:00
floitsch@google.com 457dffa030 Add StreamSubscription.asFuture.
Review URL: https://codereview.chromium.org//14237002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21441 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 12:17:07 +00:00
floitsch@google.com 285849c801 Change hasSubscribers to hasListener.
Review URL: https://codereview.chromium.org//14103010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21337 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-12 09:30:05 +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
lrn@google.com 864b4472bc Fix stream_controller_test failure.
Review URL: https://codereview.chromium.org//13814010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21145 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-09 10:54:07 +00:00
lrn@google.com 7e9e78d159 Make EventTransformerStream's subscription not send events after cancel.
Also make Stream.firstm, Stream.single and Stream.elementAt cancel
their subscription before completing the future, instead of after.

BUG=http://dartbug.com/7964

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21140 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-09 09:26:43 +00:00
floitsch@google.com 343fa26d65 Remove deprecated Expect from the libraries.
Review URL: https://codereview.chromium.org//13724021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21079 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-08 16:07:34 +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 e72250e49b StreamConsumer has an addStream and a close functions.
The 'consume' function will be removed.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20979 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 16:22:11 +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 34d86168b4 Mark periodic4-test as flaky and add debug information.
Review URL: https://codereview.chromium.org//13541002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20868 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-03 15:33:29 +00:00
floitsch@google.com 8c4cb66a14 Make stream_periodic4_test more resilient against computer loads.
BUG= http://dartbug.com/9367

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20849 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-03 12:06:48 +00:00
floitsch@google.com a104ba2d4b Give VM a millisecond safety margin for the test.
Review URL: https://codereview.chromium.org//13008020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20384 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 15:46:07 +00:00
ager@google.com e3b397457f Increase the allowed heap size for slow consumer test. We hit the limit in dartium x64 checked mode.
R=lrn@google.com
BUG=dartbug.com/9345

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20369 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 09:18:39 +00:00
floitsch@google.com ab09c261fe Add safetymargin.
Review URL: https://codereview.chromium.org//12617013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20225 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 18:04:19 +00:00
floitsch@google.com 789a144672 Add margin to browser tests and not VM...
Review URL: https://codereview.chromium.org//12516012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20212 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 15:57:27 +00:00
floitsch@google.com 88dc9f5d8c Add safetymargin for timer tests in browsers.
Review URL: https://codereview.chromium.org//12855003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20209 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 15:13:30 +00:00
floitsch@google.com 61b307fb6a Move timer tests to async tests.
Review URL: https://codereview.chromium.org//12812014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20203 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-19 13:20:35 +00:00
ricow@google.com 10ba4e37fb Remove time dependent part of test
This is flaking
Review URL: https://codereview.chromium.org//12706014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20158 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-18 13:55:55 +00:00
floitsch@google.com 05905fd4b6 Add Stream.periodic.
BUG= http://dartbug.com/8477

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20021 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-14 13:43:35 +00:00