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

Side by Side Diff: sdk/lib/async/future.dart

Issue 11953103: Add public-facing method and class that allows intercepting stream events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/async/merge_stream.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.async; 5 part of dart.async;
6 6
7 /** 7 /**
8 * A [Future] represents a delayed computation. It is used to obtain a not-yet 8 * A [Future] represents a delayed computation. It is used to obtain a not-yet
9 * available value, or error, sometime in the future. Receivers of a 9 * available value, or error, sometime in the future. Receivers of a
10 * [Future] can register callbacks that handle the value or error once it is 10 * [Future] can register callbacks that handle the value or error once it is
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 * The future will be completed after [milliseconds] have passed with 106 * The future will be completed after [milliseconds] have passed with
107 * the result of calling [value]. If [milliseconds] is 0, it completes at the 107 * the result of calling [value]. If [milliseconds] is 0, it completes at the
108 * earliest in the next event-loop iteration. 108 * earliest in the next event-loop iteration.
109 * 109 *
110 * If calling [value] throws, the created future will complete with the 110 * If calling [value] throws, the created future will complete with the
111 * error. 111 * error.
112 * 112 *
113 * See [Completer]s, for futures with values that are computed asynchronously. 113 * See [Completer]s, for futures with values that are computed asynchronously.
114 */ 114 */
115 factory Future.delayed(int milliseconds, T value()) { 115 factory Future.delayed(int milliseconds, T value()) {
116 _FutureImpl<T> future = new _ThenFuture<dynamic, T>((_) => value()); 116 _ThenFuture<dynamic, T> future = new _ThenFuture<dynamic, T>((_) => value()) ;
117 new Timer(milliseconds, (_) => future._sendValue(null)); 117 new Timer(milliseconds, (_) => future._sendValue(null));
118 return future; 118 return future;
119 } 119 }
120 120
121 /** 121 /**
122 * Wait for all the given futures to complete and collect their values. 122 * Wait for all the given futures to complete and collect their values.
123 * 123 *
124 * Returns a future which will complete once all the futures in a list are 124 * Returns a future which will complete once all the futures in a list are
125 * complete. If any of the futures in the list completes with an error, 125 * complete. If any of the futures in the list completes with an error,
126 * the resulting future also completes with an error. Otherwise the value 126 * the resulting future also completes with an error. Otherwise the value
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 * The argument [exception] should not be `null`. 308 * The argument [exception] should not be `null`.
309 * 309 *
310 * If [exception] is an [AsyncError], it is used directly as the error 310 * If [exception] is an [AsyncError], it is used directly as the error
311 * message sent to the future's listeners, and [stackTrace] is ignored. 311 * message sent to the future's listeners, and [stackTrace] is ignored.
312 * 312 *
313 * Otherwise the [exception] and an optional [stackTrace] is combined into an 313 * Otherwise the [exception] and an optional [stackTrace] is combined into an
314 * [AsyncError] and sent to this future's listeners. 314 * [AsyncError] and sent to this future's listeners.
315 */ 315 */
316 void completeError(Object exception, [Object stackTrace]); 316 void completeError(Object exception, [Object stackTrace]);
317 } 317 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/merge_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698