| 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 part of dart.isolate; | 5 part of dart.isolate; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The initial [IsolateStream] available by default for this isolate. This | 8 * The initial [IsolateStream] available by default for this isolate. This |
| 9 * [IsolateStream] is created automatically and it is commonly used to establish | 9 * [IsolateStream] is created automatically and it is commonly used to establish |
| 10 * the first communication between isolates (see [streamSpawnFunction] and | 10 * the first communication between isolates (see [streamSpawnFunction] and |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 */ | 70 */ |
| 71 void close() { | 71 void close() { |
| 72 if (!_isClosed) { | 72 if (!_isClosed) { |
| 73 _isClosed = true; | 73 _isClosed = true; |
| 74 _port.close(); | 74 _port.close(); |
| 75 _controller.close(); | 75 _controller.close(); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 StreamSubscription listen(void onData(event), | 79 StreamSubscription listen(void onData(event), |
| 80 { void onError(AsyncError error), | 80 { void onError(error), |
| 81 void onDone(), | 81 void onDone(), |
| 82 bool cancelOnError}) { | 82 bool cancelOnError}) { |
| 83 return _controller.stream.listen(onData, | 83 return _controller.stream.listen(onData, |
| 84 onError: onError, | 84 onError: onError, |
| 85 onDone: onDone, | 85 onDone: onDone, |
| 86 cancelOnError: cancelOnError); | 86 cancelOnError: cancelOnError); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 /** | 90 /** |
| (...skipping 16 matching lines...) Expand all Loading... |
| 107 * any of these. List and maps are also allowed to be cyclic. | 107 * any of these. List and maps are also allowed to be cyclic. |
| 108 * | 108 * |
| 109 * In the special circumstances when two isolates share the same code and are | 109 * In the special circumstances when two isolates share the same code and are |
| 110 * running in the same process (e.g. isolates created via [spawnFunction]), it | 110 * running in the same process (e.g. isolates created via [spawnFunction]), it |
| 111 * is also possible to send object instances (which would be copied in the | 111 * is also possible to send object instances (which would be copied in the |
| 112 * process). This is currently only supported by the dartvm. For now, the | 112 * process). This is currently only supported by the dartvm. For now, the |
| 113 * dart2js compiler only supports the restricted messages described above. | 113 * dart2js compiler only supports the restricted messages described above. |
| 114 */ | 114 */ |
| 115 void add(dynamic message); | 115 void add(dynamic message); |
| 116 | 116 |
| 117 void addError(AsyncError errorEvent); | 117 void addError(errorEvent); |
| 118 | 118 |
| 119 /** Closing multiple times is allowed. */ | 119 /** Closing multiple times is allowed. */ |
| 120 void close(); | 120 void close(); |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * Tests whether [other] is an [IsolateSink] feeding into the same | 123 * Tests whether [other] is an [IsolateSink] feeding into the same |
| 124 * [IsolateStream] as this one. | 124 * [IsolateStream] as this one. |
| 125 */ | 125 */ |
| 126 bool operator==(var other); | 126 bool operator==(var other); |
| 127 } | 127 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 141 * default stream. | 141 * default stream. |
| 142 * | 142 * |
| 143 * The optional [unhandledExceptionCallback] argument is invoked whenever an | 143 * The optional [unhandledExceptionCallback] argument is invoked whenever an |
| 144 * exception inside the isolate is unhandled. It can be seen as a big | 144 * exception inside the isolate is unhandled. It can be seen as a big |
| 145 * `try/catch` around everything that is executed inside the isolate. The | 145 * `try/catch` around everything that is executed inside the isolate. The |
| 146 * callback should return `true` when it was able to handled the exception. | 146 * callback should return `true` when it was able to handled the exception. |
| 147 */ | 147 */ |
| 148 external IsolateSink streamSpawnFunction( | 148 external IsolateSink streamSpawnFunction( |
| 149 void topLevelFunction(), | 149 void topLevelFunction(), |
| 150 [bool unhandledExceptionCallback(IsolateUnhandledException e)]); | 150 [bool unhandledExceptionCallback(IsolateUnhandledException e)]); |
| OLD | NEW |