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

Side by Side Diff: corelib/src/promise.dart

Issue 8931011: Update corelib to revised factory syntax. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years 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 | « corelib/src/options.dart ('k') | corelib/src/queue.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Dart core library. 5 // Dart core library.
6 6
7 /** A promise to value of type [T] that may be computed asynchronously. */ 7 /** A promise to value of type [T] that may be computed asynchronously. */
8 interface Promise<T> factory PromiseImpl<T> { 8 interface Promise<T> default PromiseImpl<T> {
9 9
10 Promise(); 10 Promise();
11 11
12 /** A promise that already has a computed value. */ 12 /** A promise that already has a computed value. */
13 Promise.fromValue(T value); 13 Promise.fromValue(T value);
14 14
15 /** 15 /**
16 * The value once it is computed. It will be null when the promise is in 16 * The value once it is computed. It will be null when the promise is in
17 * progress ([:!isDone():]), when it was cancelled ([:isCancelled():]), or 17 * progress ([:!isDone():]), when it was cancelled ([:isCancelled():]), or
18 * when the computed value is actually null. 18 * when the computed value is actually null.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void join(Collection<Promise> arr, bool joinDone(Promise completed)); 83 void join(Collection<Promise> arr, bool joinDone(Promise completed));
84 84
85 /** 85 /**
86 * Mark this promise as complete when [n] promises in [arr] complete, then 86 * Mark this promise as complete when [n] promises in [arr] complete, then
87 * cancel the rest of the promises in [arr] that didn't complete. 87 * cancel the rest of the promises in [arr] that didn't complete.
88 */ 88 */
89 void waitFor(Collection<Promise> arr, int n); 89 void waitFor(Collection<Promise> arr, int n);
90 } 90 }
91 91
92 92
93 interface Proxy extends Promise<bool> factory ProxyImpl { 93 interface Proxy extends Promise<bool> default ProxyImpl {
94 94
95 Proxy.forPort(SendPort port); 95 Proxy.forPort(SendPort port);
96 Proxy.forIsolate(Isolate isolate); 96 Proxy.forIsolate(Isolate isolate);
97 Proxy._forIsolateWithPromise(Isolate isolate, Promise<SendPort> promise); 97 Proxy._forIsolateWithPromise(Isolate isolate, Promise<SendPort> promise);
98 /* 98 /*
99 * The [Proxy.forReply] constructor is used to create a proxy for 99 * The [Proxy.forReply] constructor is used to create a proxy for
100 * the object that will be the reply to a message send. 100 * the object that will be the reply to a message send.
101 */ 101 */
102 Proxy.forReply(Promise<SendPort> port); 102 Proxy.forReply(Promise<SendPort> port);
103 103
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 PromiseProxy(Promise<SendPort> sendCompleter) { 170 PromiseProxy(Promise<SendPort> sendCompleter) {
171 ReceivePort completer = new ReceivePort.singleShot(); 171 ReceivePort completer = new ReceivePort.singleShot();
172 completer.receive((var msg, SendPort _) { 172 completer.receive((var msg, SendPort _) {
173 complete(msg[0]); 173 complete(msg[0]);
174 }); 174 });
175 sendCompleter.addCompleteHandler((SendPort port) { 175 sendCompleter.addCompleteHandler((SendPort port) {
176 port.send([completer.toSendPort()], null); 176 port.send([completer.toSendPort()], null);
177 }); 177 });
178 } 178 }
179 } 179 }
OLDNEW
« no previous file with comments | « corelib/src/options.dart ('k') | corelib/src/queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698