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 patch class ReceivePort { | 5 patch class ReceivePort { |
6 /* patch */ factory ReceivePort() = _ReceivePortImpl; | 6 /* patch */ factory ReceivePort() = _ReceivePortImpl; |
7 | 7 |
8 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = | 8 /* patch */ factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) = |
9 _ReceivePortImpl.fromRawReceivePort; | 9 _ReceivePortImpl.fromRawReceivePort; |
10 } | 10 } |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 SendPort get sendPort { | 35 SendPort get sendPort { |
36 return _rawPort.sendPort; | 36 return _rawPort.sendPort; |
37 } | 37 } |
38 | 38 |
39 StreamSubscription listen(void onData(var message), | 39 StreamSubscription listen(void onData(var message), |
40 { Function onError, | 40 { Function onError, |
41 void onDone(), | 41 void onDone(), |
42 bool cancelOnError }) { | 42 bool cancelOnError }) { |
43 return _controller.stream.listen(onData); | 43 return _controller.stream.listen(onData, |
| 44 onError: onError, |
| 45 onDone: onDone, |
| 46 cancelOnError: cancelOnError); |
44 } | 47 } |
45 | 48 |
46 close() { | 49 close() { |
47 _rawPort.close(); | 50 _rawPort.close(); |
48 _controller.close(); | 51 _controller.close(); |
49 } | 52 } |
50 | 53 |
51 final RawReceivePort _rawPort; | 54 final RawReceivePort _rawPort; |
52 StreamController _controller; | 55 StreamController _controller; |
53 } | 56 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 230 } |
228 | 231 |
229 static final ReceivePort _port = | 232 static final ReceivePort _port = |
230 new ReceivePort.fromRawReceivePort(_getPortInternal()); | 233 new ReceivePort.fromRawReceivePort(_getPortInternal()); |
231 | 234 |
232 static SendPort _spawnFunction(Function topLevelFunction) | 235 static SendPort _spawnFunction(Function topLevelFunction) |
233 native "isolate_spawnFunction"; | 236 native "isolate_spawnFunction"; |
234 | 237 |
235 static SendPort _spawnUri(String uri) native "isolate_spawnUri"; | 238 static SendPort _spawnUri(String uri) native "isolate_spawnUri"; |
236 } | 239 } |
OLD | NEW |