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

Unified Diff: lib/isolate/isolate_api.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 | « lib/isolate/frog/ports.dart ('k') | lib/isolate/isolate_compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/isolate/isolate_api.dart
diff --git a/lib/isolate/isolate_api.dart b/lib/isolate/isolate_api.dart
index dbe600db8f52eb9e4ccca51a09b550ee86718044..a98a339023c617638729f42e894e7555b64b387e 100644
--- a/lib/isolate/isolate_api.dart
+++ b/lib/isolate/isolate_api.dart
@@ -51,21 +51,34 @@ SendPort spawnUri(String uri) {
interface SendPort extends Hashable {
/**
- * Sends an asynchronous [message] to this send port. The message is
- * copied to the receiving isolate. If the message contains any
- * receive ports, they are translated to the corresponding send port
- * before being transmitted. If specified, the [replyTo] port will be
- * provided to the receiver to facilitate exchanging sequences of
- * messages.
+ * Sends an asynchronous [message] to this send port. The message is copied to
+ * the receiving isolate. If specified, the [replyTo] port will be provided to
+ * the receiver to facilitate exchanging sequences of messages.
+ *
+ * The content of [message] can be: primitive values (null, num, bool, double,
+ * String), instances of [SendPort], and lists and maps whose elements are any
+ * of these. List and maps are also allowed to be cyclic.
+ *
+ * In the special circumstances when two isolates share the same code and are
+ * running in the same process (e.g. isolates created via [spawnFunction]), it
+ * is also possible to send object instances (which would be copied in the
+ * process). This is currently only supported by the dartvm. For now, the
+ * frog compiler only supports the restricted messages described above.
+ *
+ * Deprecation note: it is no longer valid to transmit a [ReceivePort] in a
+ * message. Previously they were translated to the corresponding send port
+ * before being transmitted.
*/
void send(var message, [SendPort replyTo]);
/**
- * Creates a new single-shot receive port, sends a message to this
- * send port with replyTo set to the opened port, and returns the
- * receive port.
+ * Sends a message to this send port and returns a [Future] of the reply.
+ * Basically, this internally creates a new receive port, sends a
+ * message to this send port with replyTo set to such receive port, and, when
+ * a reply is received, it closes the receive port and completes the returned
+ * future.
*/
- ReceivePort call(var message);
+ Future call(var message);
/**
* Tests whether [other] is a [SendPort] pointing to the same
@@ -99,14 +112,6 @@ interface ReceivePort default _ReceivePortFactory {
ReceivePort();
/**
- * Opens a single-shot reply port. Once a message has been received
- * on this port, it is automatically closed -- obviously without
- * throwing the message away before it can be processed. This
- * constructor is used indirectly through [SendPort.call].
- */
- ReceivePort.singleShot();
-
- /**
* Sets up a callback function for receiving pending or future
* messages on this receive port.
*/
« no previous file with comments | « lib/isolate/frog/ports.dart ('k') | lib/isolate/isolate_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698