Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: lib/isolate/frog/messages.dart

Issue 10700101: First experimental steps towards a better story for JS interop. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/html/frog/html_frog.dart ('k') | lib/isolate/isolate_api.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Defines message visitors, serialization, and deserialization. 5 // Defines message visitors, serialization, and deserialization.
6 6
7 /** Serialize [message] (or simulate serialization). */ 7 /** Serialize [message] (or simulate serialization). */
8 _serializeMessage(message) { 8 _serializeMessage(message) {
9 if (_globalState.needSerialization) { 9 if (_globalState.needSerialization) {
10 return new _JsSerializer().traverse(message); 10 return new _JsSerializer().traverse(message);
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 class _JsSerializer extends _Serializer { 26 class _JsSerializer extends _Serializer {
27 27
28 _JsSerializer() : super() { _visited = new _JsVisitedMap(); } 28 _JsSerializer() : super() { _visited = new _JsVisitedMap(); }
29 29
30 visitSendPort(SendPort x) { 30 visitSendPort(SendPort x) {
31 if (x is _NativeJsSendPort) return visitNativeJsSendPort(x); 31 if (x is _NativeJsSendPort) return visitNativeJsSendPort(x);
32 if (x is _WorkerSendPort) return visitWorkerSendPort(x); 32 if (x is _WorkerSendPort) return visitWorkerSendPort(x);
33 if (x is _BufferingSendPort) return visitBufferingSendPort(x); 33 if (x is _BufferingSendPort) return visitBufferingSendPort(x);
34 throw "Illegal underlying port $p"; 34 throw "Illegal underlying port $x";
35 } 35 }
36 36
37 visitNativeJsSendPort(_NativeJsSendPort port) { 37 visitNativeJsSendPort(_NativeJsSendPort port) {
38 return ['sendport', _globalState.currentManagerId, 38 return ['sendport', _globalState.currentManagerId,
39 port._isolateId, port._receivePort._id]; 39 port._isolateId, port._receivePort._id];
40 } 40 }
41 41
42 visitWorkerSendPort(_WorkerSendPort port) { 42 visitWorkerSendPort(_WorkerSendPort port) {
43 return ['sendport', port._workerId, port._isolateId, port._receivePortId]; 43 return ['sendport', port._workerId, port._isolateId, port._receivePortId];
44 } 44 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return new _JsCopier().traverse(x); 155 return new _JsCopier().traverse(x);
156 } 156 }
157 157
158 // only visible for testing purposes 158 // only visible for testing purposes
159 static serialize(x) { 159 static serialize(x) {
160 _Serializer serializer = new _JsSerializer(); 160 _Serializer serializer = new _JsSerializer();
161 _Deserializer deserializer = new _JsDeserializer(); 161 _Deserializer deserializer = new _JsDeserializer();
162 return deserializer.deserialize(serializer.traverse(x)); 162 return deserializer.deserialize(serializer.traverse(x));
163 } 163 }
164 } 164 }
OLDNEW
« no previous file with comments | « lib/html/frog/html_frog.dart ('k') | lib/isolate/isolate_api.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698