| 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 html; | 5 part of html; |
| 6 | 6 |
| 7 _serialize(var message) { | 7 _serialize(var message) { |
| 8 return new _JsSerializer().traverse(message); | 8 return new _JsSerializer().traverse(message); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return ReceivePortSync._lookup(isolateId, portId); | 56 return ReceivePortSync._lookup(isolateId, portId); |
| 57 default: | 57 default: |
| 58 throw 'Illegal SendPortSync type: $tag'; | 58 throw 'Illegal SendPortSync type: $tag'; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 // The receiver is JS. | 63 // The receiver is JS. |
| 64 class _JsSendPortSync implements SendPortSync { | 64 class _JsSendPortSync implements SendPortSync { |
| 65 | 65 |
| 66 num _id; | 66 final num _id; |
| 67 _JsSendPortSync(this._id); | 67 _JsSendPortSync(this._id); |
| 68 | 68 |
| 69 callSync(var message) { | 69 callSync(var message) { |
| 70 var serialized = _serialize(message); | 70 var serialized = _serialize(message); |
| 71 var result = _callPortSync(_id, serialized); | 71 var result = _callPortSync(_id, serialized); |
| 72 return _deserialize(result); | 72 return _deserialize(result); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool operator==(var other) { | 75 bool operator==(var other) { |
| 76 return (other is _JsSendPortSync) && (_id == other._id); | 76 return (other is _JsSendPortSync) && (_id == other._id); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 get _isolateId => ReceivePortSync._isolateId; | 214 get _isolateId => ReceivePortSync._isolateId; |
| 215 | 215 |
| 216 void _dispatchEvent(String receiver, var message) { | 216 void _dispatchEvent(String receiver, var message) { |
| 217 var event = new CustomEvent(receiver, canBubble: false, cancelable:false, | 217 var event = new CustomEvent(receiver, canBubble: false, cancelable:false, |
| 218 detail: json.stringify(message)); | 218 detail: json.stringify(message)); |
| 219 window.dispatchEvent(event); | 219 window.dispatchEvent(event); |
| 220 } | 220 } |
| 221 | 221 |
| 222 String _getPortSyncEventData(CustomEvent event) => event.detail; | 222 String _getPortSyncEventData(CustomEvent event) => event.detail; |
| OLD | NEW |