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

Side by Side Diff: lib/core/future.dart

Issue 10905165: Fix some doc comments that didn't use Markdown syntax for code blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | no next file » | 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) 2011, 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 /** 5 /**
6 * A [Future] is used to obtain a value sometime in the future. Receivers of a 6 * A [Future] is used to obtain a value sometime in the future. Receivers of a
7 * [Future] can obtain the value by passing a callback to [then]. For example: 7 * [Future] can obtain the value by passing a callback to [then]. For example:
8 * 8 *
9 * Future<int> future = getFutureFromSomewhere(); 9 * Future<int> future = getFutureFromSomewhere();
10 * future.then((value) { 10 * future.then((value) {
11 * print("I received the number $value"); 11 * print("I received the number $value");
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 Future transformException(transformation(Object exception)); 138 Future transformException(transformation(Object exception));
139 } 139 }
140 140
141 /** 141 /**
142 * A [Completer] is used to produce [Future]s and supply their value when it 142 * A [Completer] is used to produce [Future]s and supply their value when it
143 * becomes available. 143 * becomes available.
144 * 144 *
145 * A service that provides values to callers, and wants to return [Future]s can 145 * A service that provides values to callers, and wants to return [Future]s can
146 * use a [Completer] as follows: 146 * use a [Completer] as follows:
147 * 147 *
148 * Completer completer = new Completer(); 148 * Completer completer = new Completer();
149 * // send future object back to client... 149 * // send future object back to client...
150 * return completer.future; 150 * return completer.future;
151 * ... 151 * ...
152 * 152 *
153 * // later when value is available, call: 153 * // later when value is available, call:
154 * completer.complete(value); 154 * completer.complete(value);
155 * 155 *
156 * // alternatively, if the service cannot produce the value, it 156 * // alternatively, if the service cannot produce the value, it
157 * // can provide an exception: 157 * // can provide an exception:
158 * completer.completeException(exception); 158 * completer.completeException(exception);
159 * 159 *
160 */ 160 */
161 interface Completer<T> default CompleterImpl<T> { 161 interface Completer<T> default CompleterImpl<T> {
162 162
163 Completer(); 163 Completer();
164 164
165 /** The future that will contain the value produced by this completer. */ 165 /** The future that will contain the value produced by this completer. */
166 Future get future; 166 Future get future;
167 167
168 /** Supply a value for [future]. */ 168 /** Supply a value for [future]. */
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 future.handleException((exception) { 231 future.handleException((exception) {
232 if (!result.isComplete) { 232 if (!result.isComplete) {
233 completer.completeException(exception, future.stackTrace); 233 completer.completeException(exception, future.stackTrace);
234 } 234 }
235 return true; 235 return true;
236 }); 236 });
237 } 237 }
238 return result; 238 return result;
239 } 239 }
240 } 240 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698