| OLD | NEW |
| 1 library html; | 1 library html; |
| 2 | 2 |
| 3 import 'dart:async'; | 3 import 'dart:async'; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'dart:html_common'; | 5 import 'dart:html_common'; |
| 6 import 'dart:indexed_db'; | 6 import 'dart:indexed_db'; |
| 7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
| 8 import 'dart:json' as json; | 8 import 'dart:json' as json; |
| 9 import 'dart:math'; | 9 import 'dart:math'; |
| 10 import 'dart:svg' as svg; | 10 import 'dart:svg' as svg; |
| (...skipping 25719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 25730 | 25730 |
| 25731 num _id; | 25731 num _id; |
| 25732 _JsSendPortSync(this._id); | 25732 _JsSendPortSync(this._id); |
| 25733 | 25733 |
| 25734 callSync(var message) { | 25734 callSync(var message) { |
| 25735 var serialized = _serialize(message); | 25735 var serialized = _serialize(message); |
| 25736 var result = _callPortSync(_id, serialized); | 25736 var result = _callPortSync(_id, serialized); |
| 25737 return _deserialize(result); | 25737 return _deserialize(result); |
| 25738 } | 25738 } |
| 25739 | 25739 |
| 25740 bool operator==(var other) { |
| 25741 return (other is _JsSendPortSync) && (_id == other._id); |
| 25742 } |
| 25743 |
| 25744 int get hashCode => _id; |
| 25740 } | 25745 } |
| 25741 | 25746 |
| 25742 // TODO(vsm): Differentiate between Dart2Js and Dartium isolates. | 25747 // TODO(vsm): Differentiate between Dart2Js and Dartium isolates. |
| 25743 // The receiver is a different Dart isolate, compiled to JS. | 25748 // The receiver is a different Dart isolate, compiled to JS. |
| 25744 class _RemoteSendPortSync implements SendPortSync { | 25749 class _RemoteSendPortSync implements SendPortSync { |
| 25745 | 25750 |
| 25746 int _isolateId; | 25751 int _isolateId; |
| 25747 int _portId; | 25752 int _portId; |
| 25748 _RemoteSendPortSync(this._isolateId, this._portId); | 25753 _RemoteSendPortSync(this._isolateId, this._portId); |
| 25749 | 25754 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 25760 var source = '$target-result'; | 25765 var source = '$target-result'; |
| 25761 var result = null; | 25766 var result = null; |
| 25762 var listener = (Event e) { | 25767 var listener = (Event e) { |
| 25763 result = json.parse(_getPortSyncEventData(e)); | 25768 result = json.parse(_getPortSyncEventData(e)); |
| 25764 }; | 25769 }; |
| 25765 window.on[source].add(listener); | 25770 window.on[source].add(listener); |
| 25766 _dispatchEvent(target, [source, message]); | 25771 _dispatchEvent(target, [source, message]); |
| 25767 window.on[source].remove(listener); | 25772 window.on[source].remove(listener); |
| 25768 return result; | 25773 return result; |
| 25769 } | 25774 } |
| 25775 |
| 25776 bool operator==(var other) { |
| 25777 return (other is _RemoteSendPortSync) && (_isolateId == other._isolateId) |
| 25778 && (_portId == other._portId); |
| 25779 } |
| 25780 |
| 25781 int get hashCode => _isolateId >> 16 + _portId; |
| 25770 } | 25782 } |
| 25771 | 25783 |
| 25772 // The receiver is in the same Dart isolate, compiled to JS. | 25784 // The receiver is in the same Dart isolate, compiled to JS. |
| 25773 class _LocalSendPortSync implements SendPortSync { | 25785 class _LocalSendPortSync implements SendPortSync { |
| 25774 | 25786 |
| 25775 ReceivePortSync _receivePort; | 25787 ReceivePortSync _receivePort; |
| 25776 | 25788 |
| 25777 _LocalSendPortSync._internal(this._receivePort); | 25789 _LocalSendPortSync._internal(this._receivePort); |
| 25778 | 25790 |
| 25779 callSync(var message) { | 25791 callSync(var message) { |
| 25780 // TODO(vsm): Do a more efficient deep copy. | 25792 // TODO(vsm): Do a more efficient deep copy. |
| 25781 var copy = _deserialize(_serialize(message)); | 25793 var copy = _deserialize(_serialize(message)); |
| 25782 var result = _receivePort._callback(copy); | 25794 var result = _receivePort._callback(copy); |
| 25783 return _deserialize(_serialize(result)); | 25795 return _deserialize(_serialize(result)); |
| 25784 } | 25796 } |
| 25797 |
| 25798 bool operator==(var other) { |
| 25799 return (other is _LocalSendPortSync) |
| 25800 && (_receivePort == other._receivePort); |
| 25801 } |
| 25802 |
| 25803 int get hashCode => _receivePort.hashCode; |
| 25785 } | 25804 } |
| 25786 | 25805 |
| 25787 // TODO(vsm): Move this to dart:isolate. This will take some | 25806 // TODO(vsm): Move this to dart:isolate. This will take some |
| 25788 // refactoring as there are dependences here on the DOM. Users | 25807 // refactoring as there are dependences here on the DOM. Users |
| 25789 // interact with this class (or interface if we change it) directly - | 25808 // interact with this class (or interface if we change it) directly - |
| 25790 // new ReceivePortSync. I think most of the DOM logic could be | 25809 // new ReceivePortSync. I think most of the DOM logic could be |
| 25791 // delayed until the corresponding SendPort is registered on the | 25810 // delayed until the corresponding SendPort is registered on the |
| 25792 // window. | 25811 // window. |
| 25793 | 25812 |
| 25794 // A Dart ReceivePortSync (tagged 'dart' when serialized) is | 25813 // A Dart ReceivePortSync (tagged 'dart' when serialized) is |
| (...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 26937 _position = nextPosition; | 26956 _position = nextPosition; |
| 26938 return true; | 26957 return true; |
| 26939 } | 26958 } |
| 26940 _current = null; | 26959 _current = null; |
| 26941 _position = _array.length; | 26960 _position = _array.length; |
| 26942 return false; | 26961 return false; |
| 26943 } | 26962 } |
| 26944 | 26963 |
| 26945 T get current => _current; | 26964 T get current => _current; |
| 26946 } | 26965 } |
| OLD | NEW |