| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 _isClosed = true; | 88 _isClosed = true; |
| 89 _port.close(); | 89 _port.close(); |
| 90 _controller.close(); | 90 _controller.close(); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 StreamSubscription listen(void onData(event), | 94 StreamSubscription listen(void onData(event), |
| 95 { void onError(AsyncError error), | 95 { void onError(AsyncError error), |
| 96 void onDone(), | 96 void onDone(), |
| 97 bool unsubscribeOnError}) { | 97 bool unsubscribeOnError}) { |
| 98 return _controller.listen(onData, | 98 return _controller.stream.listen(onData, |
| 99 onError: onError, | 99 onError: onError, |
| 100 onDone: onDone, | 100 onDone: onDone, |
| 101 unsubscribeOnError: unsubscribeOnError); | 101 unsubscribeOnError: unsubscribeOnError); |
| 102 } | 102 } |
| 103 | 103 |
| 104 dynamic _unmangleMessage(var message) { | 104 dynamic _unmangleMessage(var message) { |
| 105 _IsolateDecoder decoder = new _IsolateDecoder( | 105 _IsolateDecoder decoder = new _IsolateDecoder( |
| 106 _ISOLATE_STREAM_TOKEN, | 106 _ISOLATE_STREAM_TOKEN, |
| 107 (data) { | 107 (data) { |
| 108 if (data is! List) return data; | 108 if (data is! List) return data; |
| 109 if (data.length == 2 && data[0] == "Sink" && data[1] is SendPort) { | 109 if (data.length == 2 && data[0] == "Sink" && data[1] is SendPort) { |
| 110 return new IsolateSink._fromPort(data[1]); | 110 return new IsolateSink._fromPort(data[1]); |
| 111 } | 111 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 * Creates and spawns an isolate whose code is available at [uri]. Like with | 206 * Creates and spawns an isolate whose code is available at [uri]. Like with |
| 207 * [streamSpawnFunction], the child isolate will have a default [IsolateStream], | 207 * [streamSpawnFunction], the child isolate will have a default [IsolateStream], |
| 208 * and a this function returns an [IsolateSink] feeding into it. | 208 * and a this function returns an [IsolateSink] feeding into it. |
| 209 * | 209 * |
| 210 * See comments at the top of this library for more details. | 210 * See comments at the top of this library for more details. |
| 211 */ | 211 */ |
| 212 IsolateSink streamSpawnUri(String uri) { | 212 IsolateSink streamSpawnUri(String uri) { |
| 213 SendPort sendPort = spawnUri(uri); | 213 SendPort sendPort = spawnUri(uri); |
| 214 return new IsolateSink._fromPort(sendPort); | 214 return new IsolateSink._fromPort(sendPort); |
| 215 } | 215 } |
| OLD | NEW |