| 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 /** | 5 /** |
| 6 * Concurrent programming using _isolates_: | 6 * Concurrent programming using _isolates_: |
| 7 * independent workers that are similar to threads | 7 * independent workers that are similar to threads |
| 8 * but don't share memory, | 8 * but don't share memory, |
| 9 * communicating only via messages. | 9 * communicating only via messages. |
| 10 * | 10 * |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 /** | 200 /** |
| 201 * Closes the port. | 201 * Closes the port. |
| 202 * | 202 * |
| 203 * After a call to this method any incoming message is silently dropped. | 203 * After a call to this method any incoming message is silently dropped. |
| 204 */ | 204 */ |
| 205 void close(); | 205 void close(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * [SendPortSync]s are created from [ReceivePortSync]s. Any message sent through | |
| 210 * a [SendPortSync] is delivered to its respective [ReceivePortSync]. There | |
| 211 * might be many [SendPortSync]s for the same [ReceivePortSync]. | |
| 212 * | |
| 213 * [SendPortSync]s can be transmitted to other isolates. | |
| 214 * | |
| 215 * *DEPRECATED*. | |
| 216 */ | |
| 217 @deprecated | |
| 218 abstract class SendPortSync { | |
| 219 /** | |
| 220 * Sends a synchronous message to this send port and returns the result. | |
| 221 */ | |
| 222 callSync(var message); | |
| 223 | |
| 224 /** | |
| 225 * Tests whether [other] is a [SendPortSync] pointing to the same | |
| 226 * [ReceivePortSync] as this one. | |
| 227 */ | |
| 228 bool operator==(var other); | |
| 229 | |
| 230 /** | |
| 231 * Returns an immutable hash code for this send port that is | |
| 232 * consistent with the == operator. | |
| 233 */ | |
| 234 int get hashCode; | |
| 235 } | |
| 236 | |
| 237 /** | |
| 238 * Wraps unhandled exceptions thrown during isolate execution. It is | 209 * Wraps unhandled exceptions thrown during isolate execution. It is |
| 239 * used to show both the error message and the stack trace for unhandled | 210 * used to show both the error message and the stack trace for unhandled |
| 240 * exceptions. | 211 * exceptions. |
| 241 */ | 212 */ |
| 242 // TODO(floitsch): probably going to remove and replace with something else. | 213 // TODO(floitsch): probably going to remove and replace with something else. |
| 243 class _IsolateUnhandledException implements Exception { | 214 class _IsolateUnhandledException implements Exception { |
| 244 /** Message being handled when exception occurred. */ | 215 /** Message being handled when exception occurred. */ |
| 245 final message; | 216 final message; |
| 246 | 217 |
| 247 /** Wrapped exception. */ | 218 /** Wrapped exception. */ |
| 248 final source; | 219 final source; |
| 249 | 220 |
| 250 /** Trace for the wrapped exception. */ | 221 /** Trace for the wrapped exception. */ |
| 251 final StackTrace stackTrace; | 222 final StackTrace stackTrace; |
| 252 | 223 |
| 253 const _IsolateUnhandledException(this.message, this.source, this.stackTrace); | 224 const _IsolateUnhandledException(this.message, this.source, this.stackTrace); |
| 254 | 225 |
| 255 String toString() { | 226 String toString() { |
| 256 return 'IsolateUnhandledException: exception while handling message: ' | 227 return 'IsolateUnhandledException: exception while handling message: ' |
| 257 '${message} \n ' | 228 '${message} \n ' |
| 258 '${source.toString().replaceAll("\n", "\n ")}\n' | 229 '${source.toString().replaceAll("\n", "\n ")}\n' |
| 259 'original stack trace:\n ' | 230 'original stack trace:\n ' |
| 260 '${stackTrace.toString().replaceAll("\n","\n ")}'; | 231 '${stackTrace.toString().replaceAll("\n","\n ")}'; |
| 261 } | 232 } |
| 262 } | 233 } |
| OLD | NEW |