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

Side by Side Diff: tool/input_sdk/private/isolate_serialization.dart

Issue 1152333009: Delete dart2js specific private library code (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 _isolate_helper; 5 part of _isolate_helper;
6 6
7 /// Serialize [message]. 7 /// Serialize [message].
8 _serializeMessage(message) { 8 _serializeMessage(message) {
9 return new _Serializer().serialize(message); 9 return new _Serializer().serialize(message);
10 } 10 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 if (x is RawReceivePort) { 54 if (x is RawReceivePort) {
55 unsupported(x, "RawReceivePorts can't be transmitted:"); 55 unsupported(x, "RawReceivePorts can't be transmitted:");
56 } 56 }
57 57
58 // SendPorts need their workerIds adjusted (either during serialization or 58 // SendPorts need their workerIds adjusted (either during serialization or
59 // deserialization). 59 // deserialization).
60 if (x is _NativeJsSendPort) return serializeJsSendPort(x); 60 if (x is _NativeJsSendPort) return serializeJsSendPort(x);
61 if (x is _WorkerSendPort) return serializeWorkerSendPort(x); 61 if (x is _WorkerSendPort) return serializeWorkerSendPort(x);
62 62
63 if (x is Closure) return serializeClosure(x); 63 if (x is Function) return serializeClosure(x);
64 64
65 return serializeDartObject(x); 65 return serializeDartObject(x);
66 } 66 }
67 67
68 void unsupported(x, [String message]) { 68 void unsupported(x, [String message]) {
69 if (message == null) message = "Can't transmit:"; 69 if (message == null) message = "Can't transmit:";
70 throw new UnsupportedError("$message $x"); 70 throw new UnsupportedError("$message $x");
71 } 71 }
72 72
73 makeRef(int serializationId) => ["ref", serializationId]; 73 makeRef(int serializationId) => ["ref", serializationId];
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 serializeJsSendPort(_NativeJsSendPort x) { 149 serializeJsSendPort(_NativeJsSendPort x) {
150 if (_serializeSendPorts) { 150 if (_serializeSendPorts) {
151 int workerId = _globalState.currentManagerId; 151 int workerId = _globalState.currentManagerId;
152 return ['sendport', workerId, x._isolateId, x._receivePort._id]; 152 return ['sendport', workerId, x._isolateId, x._receivePort._id];
153 } 153 }
154 return ['raw sendport', x]; 154 return ['raw sendport', x];
155 } 155 }
156 156
157 serializeCapability(CapabilityImpl x) => ['capability', x._id]; 157 serializeCapability(CapabilityImpl x) => ['capability', x._id];
158 158
159 serializeClosure(Closure x) { 159 serializeClosure(Function x) {
160 final name = IsolateNatives._getJSFunctionName(x); 160 final name = IsolateNatives._getJSFunctionName(x);
161 if (name == null) { 161 if (name == null) {
162 unsupported(x, "Closures can't be transmitted:"); 162 unsupported(x, "Closures can't be transmitted:");
163 } 163 }
164 return ['function', name]; 164 return ['function', name];
165 } 165 }
166 166
167 serializeDartObject(x) { 167 serializeDartObject(x) {
168 var classExtractor = JS_EMBEDDED_GLOBAL('', CLASS_ID_EXTRACTOR); 168 var classExtractor = JS_EMBEDDED_GLOBAL('', CLASS_ID_EXTRACTOR);
169 var fieldsExtractor = JS_EMBEDDED_GLOBAL('', CLASS_FIELDS_EXTRACTOR); 169 var fieldsExtractor = JS_EMBEDDED_GLOBAL('', CLASS_FIELDS_EXTRACTOR);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 var instanceFromClassId = JS_EMBEDDED_GLOBAL('', INSTANCE_FROM_CLASS_ID); 352 var instanceFromClassId = JS_EMBEDDED_GLOBAL('', INSTANCE_FROM_CLASS_ID);
353 var initializeObject = JS_EMBEDDED_GLOBAL('', INITIALIZE_EMPTY_INSTANCE); 353 var initializeObject = JS_EMBEDDED_GLOBAL('', INITIALIZE_EMPTY_INSTANCE);
354 354
355 var emptyInstance = JS('', '#(#)', instanceFromClassId, classId); 355 var emptyInstance = JS('', '#(#)', instanceFromClassId, classId);
356 deserializedObjects.add(emptyInstance); 356 deserializedObjects.add(emptyInstance);
357 deserializeArrayInPlace(fields); 357 deserializeArrayInPlace(fields);
358 return JS('', '#(#, #, #)', 358 return JS('', '#(#, #, #)',
359 initializeObject, classId, emptyInstance, fields); 359 initializeObject, classId, emptyInstance, fields);
360 } 360 }
361 } 361 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698