| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 class IsolateSpawnException implements Exception { | 5 class IsolateSpawnException implements Exception { |
| 6 const IsolateSpawnException(String this._s); | 6 const IsolateSpawnException(String this._s); |
| 7 String toString() => "IsolateSpawnException: '$_s'"; | 7 String toString() => "IsolateSpawnException: '$_s'"; |
| 8 final String _s; | 8 final String _s; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * [ReceivePort]s, together with [SendPort]s, are the only means of | 100 * [ReceivePort]s, together with [SendPort]s, are the only means of |
| 101 * communication between isolates. [ReceivePort]s have a [:toSendPort:] method | 101 * communication between isolates. [ReceivePort]s have a [:toSendPort:] method |
| 102 * which returns a [SendPort]. Any message that is sent through this [SendPort] | 102 * which returns a [SendPort]. Any message that is sent through this [SendPort] |
| 103 * is delivered to the [ReceivePort] it has been created from. There, they are | 103 * is delivered to the [ReceivePort] it has been created from. There, they are |
| 104 * dispatched to the callback that has been registered on the receive port. | 104 * dispatched to the callback that has been registered on the receive port. |
| 105 * | 105 * |
| 106 * A [ReceivePort] may have many [SendPort]s. | 106 * A [ReceivePort] may have many [SendPort]s. |
| 107 */ | 107 */ |
| 108 interface ReceivePort default _ReceivePortFactory { | 108 abstract class ReceivePort { |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Opens a long-lived port for receiving messages. The returned port | 111 * Opens a long-lived port for receiving messages. The returned port |
| 112 * must be explicitly closed through [ReceivePort.close]. | 112 * must be explicitly closed through [ReceivePort.close]. |
| 113 */ | 113 */ |
| 114 ReceivePort(); | 114 external factory ReceivePort(); |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * Sets up a callback function for receiving pending or future | 117 * Sets up a callback function for receiving pending or future |
| 118 * messages on this receive port. | 118 * messages on this receive port. |
| 119 */ | 119 */ |
| 120 void receive(void callback(var message, SendPort replyTo)); | 120 void receive(void callback(var message, SendPort replyTo)); |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * Closes this receive port immediately. Pending messages will not | 123 * Closes this receive port immediately. Pending messages will not |
| 124 * be processed and it is impossible to re-open the port. Single-shot | 124 * be processed and it is impossible to re-open the port. Single-shot |
| (...skipping 10 matching lines...) Expand all Loading... |
| 135 SendPort toSendPort(); | 135 SendPort toSendPort(); |
| 136 | 136 |
| 137 } | 137 } |
| 138 | 138 |
| 139 // TODO(kasperl): Document this. | 139 // TODO(kasperl): Document this. |
| 140 abstract class SendPortSync { | 140 abstract class SendPortSync { |
| 141 | 141 |
| 142 callSync(var message); | 142 callSync(var message); |
| 143 | 143 |
| 144 } | 144 } |
| 145 | |
| 146 class _ReceivePortFactory { | |
| 147 external factory ReceivePort(); | |
| 148 } | |
| OLD | NEW |