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

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
Index: samples/proxy/promise.dart
diff --git a/samples/proxy/promise.dart b/samples/proxy/promise.dart
index 492339d21c6832d6b5318fb14faecfc866ead123..f3845d64f4cafec9bd724e16915800b9f9ed2246 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.then((var msg) {
+ completer.close();
complete(msg[0]);
});
sendCompleter.addCompleteHandler((SendPort port) {
@@ -527,10 +528,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) {
+ port.close();
completer.complete(msg[0]);
});
entry.addCompleteHandler((value) {

Powered by Google App Engine
This is Rietveld 408576698