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

Unified Diff: samples/proxy/promise.dart

Issue 9652001: SendPort + ReceivePort changes: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/leap/leap_leg.dart ('k') | samples/proxy/proxy.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/proxy/promise.dart
diff --git a/samples/proxy/promise.dart b/samples/proxy/promise.dart
index 492339d21c6832d6b5318fb14faecfc866ead123..06c622f4804af5d2ea68b03244cb7720c3448751 100644
--- a/samples/proxy/promise.dart
+++ b/samples/proxy/promise.dart
@@ -171,8 +171,9 @@ class Dispatcher<T> {
class PromiseProxy<T> extends PromiseImpl<T> {
PromiseProxy(Promise<SendPort> sendCompleter) {
- ReceivePort completer = new ReceivePort.singleShot();
- completer.receive((var msg, SendPort _) {
+ ReceivePort completer = new ReceivePort();
+ completer.receive((var msg, _) {
+ completer.close();
complete(msg[0]);
});
sendCompleter.addCompleteHandler((SendPort port) {
@@ -497,8 +498,7 @@ class ProxyBase extends PromiseImpl<bool> {
// The promise queue implementation guarantees that promise is
// resolved at this point.
SendPort outgoing = _promise.value;
- ReceivePort incoming = outgoing.call(marshalled);
- incoming.receive((List receiveMessage, replyTo) {
+ outgoing.call(marshalled).then((List receiveMessage) {
result.complete(receiveMessage[0]);
});
return result;
@@ -527,10 +527,11 @@ class ProxyBase extends PromiseImpl<bool> {
// This port will receive a SendPort that can be used to
// signal completion of this promise to the corresponding
// promise that the other end has created.
- ReceivePort receiveCompleter = new ReceivePort.singleShot();
+ ReceivePort receiveCompleter = new ReceivePort();
marshalled[i] = receiveCompleter.toSendPort();
Promise<SendPort> completer = new Promise<SendPort>();
receiveCompleter.receive((var msg, SendPort replyPort) {
+ receiveCompleter.close();
completer.complete(msg[0]);
});
entry.addCompleteHandler((value) {
« no previous file with comments | « samples/leap/leap_leg.dart ('k') | samples/proxy/proxy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698