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

Side by Side Diff: corelib/unified/core/implementation/future.dart

Issue 10830117: Port the remaining of dart:core to the unified corelib. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
OLDNEW
1 // Copyright 2012 Google Inc. All Rights Reserved. 1 // Copyright 2012 Google Inc. All Rights Reserved.
2 // Dart core library. 2 // Dart core library.
3 3
4 class FutureImpl<T> implements Future<T> { 4 class FutureImpl<T> implements Future<T> {
5 5
6 bool _isComplete = false; 6 bool _isComplete = false;
7 7
8 /** 8 /**
9 * Value that was provided to this Future by the Completer 9 * Value that was provided to this Future by the Completer
10 */ 10 */
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 future.handleException((e) { 205 future.handleException((e) {
206 completer.completeException(e, future.stackTrace); 206 completer.completeException(e, future.stackTrace);
207 return true; 207 return true;
208 }); 208 });
209 future.then((b) => completer.complete(b)); 209 future.then((b) => completer.complete(b));
210 }); 210 });
211 return completer.future; 211 return completer.future;
212 } 212 }
213 } 213 }
214
215 class CompleterImpl<T> implements Completer<T> {
Mads Ager (google) 2012/08/01 13:48:34 Why move this to a separate file? I would leave fu
Anders Johnsen 2012/08/01 14:21:09 Reverting, see other comment.
216
217 final FutureImpl<T> _futureImpl;
218
219 CompleterImpl() : _futureImpl = new FutureImpl() {}
220
221 Future<T> get future() {
222 return _futureImpl;
223 }
224
225 void complete(T value) {
226 _futureImpl._setValue(value);
227 }
228
229 void completeException(Object exception, [Object stackTrace]) {
230 _futureImpl._setException(exception, stackTrace);
231 }
232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698