| 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 _ReceivePortFactory { | 5 class _ReceivePortFactory { |
| 6 /* patch */ factory ReceivePort() { | 6 factory ReceivePort() { |
| 7 return new _ReceivePortImpl(); | 7 return new _ReceivePortImpl(); |
| 8 } | 8 } |
| 9 } | 9 } |
| 10 | 10 |
| 11 |
| 11 class _ReceivePortImpl implements ReceivePort { | 12 class _ReceivePortImpl implements ReceivePort { |
| 13 /*--- public interface ---*/ |
| 12 factory _ReceivePortImpl() native "ReceivePortImpl_factory"; | 14 factory _ReceivePortImpl() native "ReceivePortImpl_factory"; |
| 13 | 15 |
| 14 receive(void onMessage(var message, SendPort replyTo)) { | 16 receive(void onMessage(var message, SendPort replyTo)) { |
| 15 _onMessage = onMessage; | 17 _onMessage = onMessage; |
| 16 } | 18 } |
| 17 | 19 |
| 18 close() { | 20 close() { |
| 19 _portMap.remove(_id); | 21 _portMap.remove(_id); |
| 20 _closeInternal(_id); | 22 _closeInternal(_id); |
| 21 } | 23 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 static _sendInternal(int sendId, int replyId, var message) | 111 static _sendInternal(int sendId, int replyId, var message) |
| 110 native "SendPortImpl_sendInternal_"; | 112 native "SendPortImpl_sendInternal_"; |
| 111 | 113 |
| 112 final int _id; | 114 final int _id; |
| 113 } | 115 } |
| 114 | 116 |
| 115 _getPortInternal() native "isolate_getPortInternal"; | 117 _getPortInternal() native "isolate_getPortInternal"; |
| 116 | 118 |
| 117 ReceivePort _portInternal; | 119 ReceivePort _portInternal; |
| 118 | 120 |
| 119 patch ReceivePort get port() { | 121 ReceivePort get _port() { |
| 120 if (_portInternal === null) { | 122 if (_portInternal === null) { |
| 121 _portInternal = _getPortInternal(); | 123 _portInternal = _getPortInternal(); |
| 122 } | 124 } |
| 123 return _portInternal; | 125 return _portInternal; |
| 124 } | 126 } |
| 125 | 127 |
| 126 patch spawnFunction(void topLevelFunction()) native "isolate_spawnFunction"; | 128 _spawnFunction(void topLevelFunction()) native "isolate_spawnFunction"; |
| 127 | 129 |
| 128 patch spawnUri(String uri) native "isolate_spawnUri"; | 130 _spawnUri(String uri) native "isolate_spawnUri"; |
| 129 | |
| OLD | NEW |