| 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 /** Common functionality to all send ports. */ | 5 /** Common functionality to all send ports. */ |
| 6 class _BaseSendPort implements SendPort { | 6 class _BaseSendPort implements SendPort { |
| 7 /** Id for the destination isolate. */ | 7 /** Id for the destination isolate. */ |
| 8 final int _isolateId; | 8 final int _isolateId; |
| 9 | 9 |
| 10 const _BaseSendPort(this._isolateId); | 10 const _BaseSendPort(this._isolateId); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 reply = _serializeMessage(reply); | 68 reply = _serializeMessage(reply); |
| 69 } | 69 } |
| 70 _globalState.topEventLoop.enqueue(isolate, () { | 70 _globalState.topEventLoop.enqueue(isolate, () { |
| 71 if (_receivePort._callback != null) { | 71 if (_receivePort._callback != null) { |
| 72 if (shouldSerialize) { | 72 if (shouldSerialize) { |
| 73 msg = _deserializeMessage(msg); | 73 msg = _deserializeMessage(msg); |
| 74 reply = _deserializeMessage(reply); | 74 reply = _deserializeMessage(reply); |
| 75 } | 75 } |
| 76 _receivePort._callback(msg, reply); | 76 _receivePort._callback(msg, reply); |
| 77 } | 77 } |
| 78 }, 'receive ' + message); | 78 }, 'receive $message'); |
| 79 }); | 79 }); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool operator ==(var other) => (other is _NativeJsSendPort) && | 82 bool operator ==(var other) => (other is _NativeJsSendPort) && |
| 83 (_receivePort == other._receivePort); | 83 (_receivePort == other._receivePort); |
| 84 | 84 |
| 85 int hashCode() => _receivePort._id; | 85 int hashCode() => _receivePort._id; |
| 86 } | 86 } |
| 87 | 87 |
| 88 /** A send port that delivers messages via worker.postMessage. */ | 88 /** A send port that delivers messages via worker.postMessage. */ |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // map.getValues().forEach(_dispatch); | 244 // map.getValues().forEach(_dispatch); |
| 245 map.getValues().forEach((e) => _dispatch(e)); | 245 map.getValues().forEach((e) => _dispatch(e)); |
| 246 } | 246 } |
| 247 | 247 |
| 248 visitBufferingSendPort(_BufferingSendPort port) { | 248 visitBufferingSendPort(_BufferingSendPort port) { |
| 249 if (port._port == null) { | 249 if (port._port == null) { |
| 250 ports.add(port._futurePort); | 250 ports.add(port._futurePort); |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 } | 253 } |
| OLD | NEW |