OLD | NEW |
1 var _isolate_helper; | 1 var _isolate_helper; |
2 (function(exports) { | 2 (function(exports) { |
3 'use strict'; | 3 'use strict'; |
4 // Function _serializeMessage: (dynamic) → dynamic | 4 // Function _serializeMessage: (dynamic) → dynamic |
5 function _serializeMessage(message) { | 5 function _serializeMessage(message) { |
6 return new _Serializer().serialize(message); | 6 return new _Serializer().serialize(message); |
7 } | 7 } |
8 // Function _deserializeMessage: (dynamic) → dynamic | 8 // Function _deserializeMessage: (dynamic) → dynamic |
9 function _deserializeMessage(message) { | 9 function _deserializeMessage(message) { |
10 return new _Deserializer().deserialize(message); | 10 return new _Deserializer().deserialize(message); |
11 } | 11 } |
12 // Function _clone: (dynamic) → dynamic | 12 // Function _clone: (dynamic) → dynamic |
13 function _clone(message) { | 13 function _clone(message) { |
14 let serializer = new _Serializer({serializeSendPorts: false}); | 14 let serializer = new _Serializer({serializeSendPorts: false}); |
15 let deserializer = new _Deserializer(); | 15 let deserializer = new _Deserializer(); |
16 return deserializer.deserialize(serializer.serialize(message)); | 16 return deserializer.deserialize(serializer.serialize(message)); |
17 } | 17 } |
18 let _serializeSendPorts = Symbol('_serializeSendPorts'); | 18 let _serializeSendPorts = Symbol('_serializeSendPorts'); |
19 let _workerId = Symbol('_workerId'); | 19 let _workerId = Symbol('_workerId'); |
20 let _isolateId = Symbol('_isolateId'); | 20 let _isolateId = Symbol('_isolateId'); |
21 let _receivePortId = Symbol('_receivePortId'); | 21 let _receivePortId = Symbol('_receivePortId'); |
22 let _receivePort = Symbol('_receivePort'); | 22 let _receivePort = Symbol('_receivePort'); |
23 let _id = Symbol('_id'); | 23 let _id = Symbol('_id'); |
24 class _Serializer extends core.Object { | 24 class _Serializer extends core.Object { |
25 _Serializer(opt$) { | 25 _Serializer(opt$) { |
26 let serializeSendPorts = opt$.serializeSendPorts === void 0 ? true : opt$.
serializeSendPorts; | 26 let serializeSendPorts = opt$ && 'serializeSendPorts' in opt$ ? opt$.seria
lizeSendPorts : true; |
27 this.serializedObjectIds = new core.Map.identity(); | 27 this.serializedObjectIds = new core.Map.identity(); |
28 this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool); | 28 this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool); |
29 } | 29 } |
30 serialize(x) { | 30 serialize(x) { |
31 if (this.isPrimitive(x)) | 31 if (this.isPrimitive(x)) |
32 return this.serializePrimitive(x); | 32 return this.serializePrimitive(x); |
33 let serializationId = this.serializedObjectIds.get(x); | 33 let serializationId = this.serializedObjectIds.get(x); |
34 if (serializationId !== null) | 34 if (serializationId !== null) |
35 return this.makeRef(serializationId); | 35 return this.makeRef(serializationId); |
36 serializationId = this.serializedObjectIds.length; | 36 serializationId = this.serializedObjectIds.length; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 let classExtractor = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_n
ames.CLASS_ID_EXTRACTOR); | 151 let classExtractor = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_n
ames.CLASS_ID_EXTRACTOR); |
152 let fieldsExtractor = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_
names.CLASS_FIELDS_EXTRACTOR); | 152 let fieldsExtractor = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_
names.CLASS_FIELDS_EXTRACTOR); |
153 let classId = classExtractor(x); | 153 let classId = classExtractor(x); |
154 let fields = dart.as(fieldsExtractor(x), core.List); | 154 let fields = dart.as(fieldsExtractor(x), core.List); |
155 return new List.from(['dart', classId, this.serializeArrayInPlace(dart.as(
fields, _interceptors.JSArray))]); | 155 return new List.from(['dart', classId, this.serializeArrayInPlace(dart.as(
fields, _interceptors.JSArray))]); |
156 } | 156 } |
157 } | 157 } |
158 let _adjustSendPorts = Symbol('_adjustSendPorts'); | 158 let _adjustSendPorts = Symbol('_adjustSendPorts'); |
159 class _Deserializer extends core.Object { | 159 class _Deserializer extends core.Object { |
160 _Deserializer(opt$) { | 160 _Deserializer(opt$) { |
161 let adjustSendPorts = opt$.adjustSendPorts === void 0 ? true : opt$.adjust
SendPorts; | 161 let adjustSendPorts = opt$ && 'adjustSendPorts' in opt$ ? opt$.adjustSendP
orts : true; |
162 this.deserializedObjects = new core.List(); | 162 this.deserializedObjects = new core.List(); |
163 this[_adjustSendPorts] = dart.as(adjustSendPorts, core.bool); | 163 this[_adjustSendPorts] = dart.as(adjustSendPorts, core.bool); |
164 } | 164 } |
165 deserialize(x) { | 165 deserialize(x) { |
166 if (this.isPrimitive(x)) | 166 if (this.isPrimitive(x)) |
167 return this.deserializePrimitive(x); | 167 return this.deserializePrimitive(x); |
168 if (!dart.is(x, _interceptors.JSArray)) | 168 if (!dart.is(x, _interceptors.JSArray)) |
169 throw new core.ArgumentError(`Bad serialized message: ${x}`); | 169 throw new core.ArgumentError(`Bad serialized message: ${x}`); |
170 switch (dart.dload(x, 'first')) { | 170 switch (dart.dload(x, 'first')) { |
171 case "ref": | 171 case "ref": |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 this.ReceivePortImpl$fromRawReceivePort(new RawReceivePortImpl.weak(null))
; | 1174 this.ReceivePortImpl$fromRawReceivePort(new RawReceivePortImpl.weak(null))
; |
1175 } | 1175 } |
1176 ReceivePortImpl$fromRawReceivePort($_rawPort) { | 1176 ReceivePortImpl$fromRawReceivePort($_rawPort) { |
1177 this[_rawPort] = $_rawPort; | 1177 this[_rawPort] = $_rawPort; |
1178 this[_controller] = null; | 1178 this[_controller] = null; |
1179 super.Stream(); | 1179 super.Stream(); |
1180 this[_controller] = new async.StreamController({onCancel: this.close, sync
: true}); | 1180 this[_controller] = new async.StreamController({onCancel: this.close, sync
: true}); |
1181 this[_rawPort].handler = this[_controller].add; | 1181 this[_rawPort].handler = this[_controller].add; |
1182 } | 1182 } |
1183 listen(onData, opt$) { | 1183 listen(onData, opt$) { |
1184 let onError = opt$.onError === void 0 ? null : opt$.onError; | 1184 let onError = opt$ && 'onError' in opt$ ? opt$.onError : null; |
1185 let onDone = opt$.onDone === void 0 ? null : opt$.onDone; | 1185 let onDone = opt$ && 'onDone' in opt$ ? opt$.onDone : null; |
1186 let cancelOnError = opt$.cancelOnError === void 0 ? null : opt$.cancelOnEr
ror; | 1186 let cancelOnError = opt$ && 'cancelOnError' in opt$ ? opt$.cancelOnError :
null; |
1187 return this[_controller].stream.listen(onData, {onError: onError, onDone:
onDone, cancelOnError: cancelOnError}); | 1187 return this[_controller].stream.listen(onData, {onError: onError, onDone:
onDone, cancelOnError: cancelOnError}); |
1188 } | 1188 } |
1189 close() { | 1189 close() { |
1190 this[_rawPort].close(); | 1190 this[_rawPort].close(); |
1191 this[_controller].close(); | 1191 this[_controller].close(); |
1192 } | 1192 } |
1193 get sendPort() { | 1193 get sendPort() { |
1194 return this[_rawPort].sendPort; | 1194 return this[_rawPort].sendPort; |
1195 } | 1195 } |
1196 } | 1196 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 } | 1294 } |
1295 return false; | 1295 return false; |
1296 } | 1296 } |
1297 } | 1297 } |
1298 dart.defineNamedConstructor(CapabilityImpl, '_internal'); | 1298 dart.defineNamedConstructor(CapabilityImpl, '_internal'); |
1299 // Exports: | 1299 // Exports: |
1300 exports.enterJsAsync = enterJsAsync; | 1300 exports.enterJsAsync = enterJsAsync; |
1301 exports.leaveJsAsync = leaveJsAsync; | 1301 exports.leaveJsAsync = leaveJsAsync; |
1302 exports.isWorker = isWorker; | 1302 exports.isWorker = isWorker; |
1303 exports.startRootIsolate = startRootIsolate; | 1303 exports.startRootIsolate = startRootIsolate; |
1304 exports.globalWindow = globalWindow; | |
1305 exports.globalWorker = globalWorker; | |
1306 exports.globalPostMessageDefined = globalPostMessageDefined; | |
1307 exports.IsolateNatives = IsolateNatives; | 1304 exports.IsolateNatives = IsolateNatives; |
1308 exports.RawReceivePortImpl = RawReceivePortImpl; | 1305 exports.RawReceivePortImpl = RawReceivePortImpl; |
1309 exports.ReceivePortImpl = ReceivePortImpl; | 1306 exports.ReceivePortImpl = ReceivePortImpl; |
1310 exports.TimerImpl = TimerImpl; | 1307 exports.TimerImpl = TimerImpl; |
1311 exports.hasTimer = hasTimer; | 1308 exports.hasTimer = hasTimer; |
1312 exports.CapabilityImpl = CapabilityImpl; | 1309 exports.CapabilityImpl = CapabilityImpl; |
1313 })(_isolate_helper || (_isolate_helper = {})); | 1310 })(_isolate_helper || (_isolate_helper = {})); |
OLD | NEW |