| 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); |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 } | 722 } |
| 723 this.doneHandlers = null; | 723 this.doneHandlers = null; |
| 724 } | 724 } |
| 725 } | 725 } |
| 726 unregister(portId) { | 726 unregister(portId) { |
| 727 this.ports.remove(portId); | 727 this.ports.remove(portId); |
| 728 this.weakPorts.remove(portId); | 728 this.weakPorts.remove(portId); |
| 729 this[_updateGlobalState](); | 729 this[_updateGlobalState](); |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 _IsolateContext[dart.implements] = [_foreign_helper.IsolateContext]; |
| 732 let _runHelper = Symbol('_runHelper'); | 733 let _runHelper = Symbol('_runHelper'); |
| 733 class _EventLoop extends core.Object { | 734 class _EventLoop extends core.Object { |
| 734 _EventLoop() { | 735 _EventLoop() { |
| 735 this.events = new collection.Queue(); | 736 this.events = new collection.Queue(); |
| 736 this[_activeJsAsyncCount] = 0; | 737 this[_activeJsAsyncCount] = 0; |
| 737 } | 738 } |
| 738 enqueue(isolate, fn, msg) { | 739 enqueue(isolate, fn, msg) { |
| 739 this.events.addLast(new _IsolateEvent(dart.as(isolate, _IsolateContext), d
art.as(fn, core.Function), dart.as(msg, core.String))); | 740 this.events.addLast(new _IsolateEvent(dart.as(isolate, _IsolateContext), d
art.as(fn, core.Function), dart.as(msg, core.String))); |
| 740 } | 741 } |
| 741 prequeue(event) { | 742 prequeue(event) { |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 class _BaseSendPort extends core.Object { | 1118 class _BaseSendPort extends core.Object { |
| 1118 _BaseSendPort(isolateId$) { | 1119 _BaseSendPort(isolateId$) { |
| 1119 this[_isolateId] = isolateId$; | 1120 this[_isolateId] = isolateId$; |
| 1120 } | 1121 } |
| 1121 [_checkReplyTo](replyTo) { | 1122 [_checkReplyTo](replyTo) { |
| 1122 if (dart.notNull(replyTo !== null) && dart.notNull(!dart.is(replyTo, _Nati
veJsSendPort)) && dart.notNull(!dart.is(replyTo, _WorkerSendPort))) { | 1123 if (dart.notNull(replyTo !== null) && dart.notNull(!dart.is(replyTo, _Nati
veJsSendPort)) && dart.notNull(!dart.is(replyTo, _WorkerSendPort))) { |
| 1123 throw new core.Exception("SendPort.send: Illegal replyTo port type"); | 1124 throw new core.Exception("SendPort.send: Illegal replyTo port type"); |
| 1124 } | 1125 } |
| 1125 } | 1126 } |
| 1126 } | 1127 } |
| 1128 _BaseSendPort[dart.implements] = [isolate.SendPort]; |
| 1127 let _isClosed = Symbol('_isClosed'); | 1129 let _isClosed = Symbol('_isClosed'); |
| 1128 class _NativeJsSendPort extends _BaseSendPort { | 1130 class _NativeJsSendPort extends _BaseSendPort { |
| 1129 _NativeJsSendPort(receivePort$, isolateId) { | 1131 _NativeJsSendPort(receivePort$, isolateId) { |
| 1130 this[_receivePort] = receivePort$; | 1132 this[_receivePort] = receivePort$; |
| 1131 super._BaseSendPort(isolateId); | 1133 super._BaseSendPort(isolateId); |
| 1132 } | 1134 } |
| 1133 send(message) { | 1135 send(message) { |
| 1134 let isolate = exports._globalState.isolates.get(this[_isolateId]); | 1136 let isolate = exports._globalState.isolates.get(this[_isolateId]); |
| 1135 if (isolate === null) | 1137 if (isolate === null) |
| 1136 return; | 1138 return; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1147 } | 1149 } |
| 1148 }).bind(this), `receive ${message}`); | 1150 }).bind(this), `receive ${message}`); |
| 1149 } | 1151 } |
| 1150 ['=='](other) { | 1152 ['=='](other) { |
| 1151 return dart.notNull(dart.is(other, _NativeJsSendPort)) && dart.notNull(dar
t.equals(this[_receivePort], dart.dload(other, '_receivePort'))); | 1153 return dart.notNull(dart.is(other, _NativeJsSendPort)) && dart.notNull(dar
t.equals(this[_receivePort], dart.dload(other, '_receivePort'))); |
| 1152 } | 1154 } |
| 1153 get hashCode() { | 1155 get hashCode() { |
| 1154 return this[_receivePort][_id]; | 1156 return this[_receivePort][_id]; |
| 1155 } | 1157 } |
| 1156 } | 1158 } |
| 1159 _NativeJsSendPort[dart.implements] = [isolate.SendPort]; |
| 1157 class _WorkerSendPort extends _BaseSendPort { | 1160 class _WorkerSendPort extends _BaseSendPort { |
| 1158 _WorkerSendPort(workerId$, isolateId, receivePortId$) { | 1161 _WorkerSendPort(workerId$, isolateId, receivePortId$) { |
| 1159 this[_workerId] = workerId$; | 1162 this[_workerId] = workerId$; |
| 1160 this[_receivePortId] = receivePortId$; | 1163 this[_receivePortId] = receivePortId$; |
| 1161 super._BaseSendPort(isolateId); | 1164 super._BaseSendPort(isolateId); |
| 1162 } | 1165 } |
| 1163 send(message) { | 1166 send(message) { |
| 1164 let workerMessage = _serializeMessage(dart.map({command: 'message', port:
this, msg: message})); | 1167 let workerMessage = _serializeMessage(dart.map({command: 'message', port:
this, msg: message})); |
| 1165 if (exports._globalState.isWorker) { | 1168 if (exports._globalState.isWorker) { |
| 1166 exports._globalState.mainManager.postMessage(workerMessage); | 1169 exports._globalState.mainManager.postMessage(workerMessage); |
| 1167 } else { | 1170 } else { |
| 1168 let manager = exports._globalState.managers.get(this[_workerId]); | 1171 let manager = exports._globalState.managers.get(this[_workerId]); |
| 1169 if (manager !== null) { | 1172 if (manager !== null) { |
| 1170 manager.postMessage(workerMessage); | 1173 manager.postMessage(workerMessage); |
| 1171 } | 1174 } |
| 1172 } | 1175 } |
| 1173 } | 1176 } |
| 1174 ['=='](other) { | 1177 ['=='](other) { |
| 1175 return dart.notNull(dart.is(other, _WorkerSendPort)) && this[_workerId] ==
= dart.dload(other, '_workerId') && this[_isolateId] === dart.dload(other, '_iso
lateId') && this[_receivePortId] === dart.dload(other, '_receivePortId'); | 1178 return dart.notNull(dart.is(other, _WorkerSendPort)) && this[_workerId] ==
= dart.dload(other, '_workerId') && this[_isolateId] === dart.dload(other, '_iso
lateId') && this[_receivePortId] === dart.dload(other, '_receivePortId'); |
| 1176 } | 1179 } |
| 1177 get hashCode() { | 1180 get hashCode() { |
| 1178 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]
) << 8 ^ dart.notNull(this[_receivePortId]); | 1181 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]
) << 8 ^ dart.notNull(this[_receivePortId]); |
| 1179 } | 1182 } |
| 1180 } | 1183 } |
| 1184 _WorkerSendPort[dart.implements] = [isolate.SendPort]; |
| 1181 let _handler = Symbol('_handler'); | 1185 let _handler = Symbol('_handler'); |
| 1182 let _nextFreeId = Symbol('_nextFreeId'); | 1186 let _nextFreeId = Symbol('_nextFreeId'); |
| 1183 let _close = Symbol('_close'); | 1187 let _close = Symbol('_close'); |
| 1184 let _add = Symbol('_add'); | 1188 let _add = Symbol('_add'); |
| 1185 class RawReceivePortImpl extends core.Object { | 1189 class RawReceivePortImpl extends core.Object { |
| 1186 RawReceivePortImpl(handler) { | 1190 RawReceivePortImpl(handler) { |
| 1187 this[_handler] = handler; | 1191 this[_handler] = handler; |
| 1188 this[_id] = ((x$) => RawReceivePortImpl[_nextFreeId] = dart.notNull(x$) +
1, x$)(RawReceivePortImpl[_nextFreeId]); | 1192 this[_id] = ((x$) => RawReceivePortImpl[_nextFreeId] = dart.notNull(x$) +
1, x$)(RawReceivePortImpl[_nextFreeId]); |
| 1189 this[_isClosed] = false; | 1193 this[_isClosed] = false; |
| 1190 exports._globalState.currentContext.register(this[_id], this); | 1194 exports._globalState.currentContext.register(this[_id], this); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1216 } | 1220 } |
| 1217 [_add](dataEvent) { | 1221 [_add](dataEvent) { |
| 1218 if (this[_isClosed]) | 1222 if (this[_isClosed]) |
| 1219 return; | 1223 return; |
| 1220 dart.dinvokef(this[_handler], dataEvent); | 1224 dart.dinvokef(this[_handler], dataEvent); |
| 1221 } | 1225 } |
| 1222 get sendPort() { | 1226 get sendPort() { |
| 1223 return new _NativeJsSendPort(this, exports._globalState.currentContext.id)
; | 1227 return new _NativeJsSendPort(this, exports._globalState.currentContext.id)
; |
| 1224 } | 1228 } |
| 1225 } | 1229 } |
| 1230 RawReceivePortImpl[dart.implements] = [isolate.RawReceivePort]; |
| 1226 dart.defineNamedConstructor(RawReceivePortImpl, 'weak'); | 1231 dart.defineNamedConstructor(RawReceivePortImpl, 'weak'); |
| 1227 dart.defineNamedConstructor(RawReceivePortImpl, _controlPort); | 1232 dart.defineNamedConstructor(RawReceivePortImpl, _controlPort); |
| 1228 RawReceivePortImpl._nextFreeId = 1; | 1233 RawReceivePortImpl._nextFreeId = 1; |
| 1229 let _rawPort = Symbol('_rawPort'); | 1234 let _rawPort = Symbol('_rawPort'); |
| 1230 let _controller = Symbol('_controller'); | 1235 let _controller = Symbol('_controller'); |
| 1231 class ReceivePortImpl extends async.Stream { | 1236 class ReceivePortImpl extends async.Stream { |
| 1232 ReceivePortImpl() { | 1237 ReceivePortImpl() { |
| 1233 this.fromRawReceivePort(new RawReceivePortImpl(null)); | 1238 this.fromRawReceivePort(new RawReceivePortImpl(null)); |
| 1234 } | 1239 } |
| 1235 weak() { | 1240 weak() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1249 return this[_controller].stream.listen(onData, {onError: onError, onDone:
onDone, cancelOnError: cancelOnError}); | 1254 return this[_controller].stream.listen(onData, {onError: onError, onDone:
onDone, cancelOnError: cancelOnError}); |
| 1250 } | 1255 } |
| 1251 close() { | 1256 close() { |
| 1252 this[_rawPort].close(); | 1257 this[_rawPort].close(); |
| 1253 this[_controller].close(); | 1258 this[_controller].close(); |
| 1254 } | 1259 } |
| 1255 get sendPort() { | 1260 get sendPort() { |
| 1256 return this[_rawPort].sendPort; | 1261 return this[_rawPort].sendPort; |
| 1257 } | 1262 } |
| 1258 } | 1263 } |
| 1264 ReceivePortImpl[dart.implements] = [isolate.ReceivePort]; |
| 1259 dart.defineNamedConstructor(ReceivePortImpl, 'weak'); | 1265 dart.defineNamedConstructor(ReceivePortImpl, 'weak'); |
| 1260 dart.defineNamedConstructor(ReceivePortImpl, 'fromRawReceivePort'); | 1266 dart.defineNamedConstructor(ReceivePortImpl, 'fromRawReceivePort'); |
| 1261 let _once = Symbol('_once'); | 1267 let _once = Symbol('_once'); |
| 1262 let _inEventLoop = Symbol('_inEventLoop'); | 1268 let _inEventLoop = Symbol('_inEventLoop'); |
| 1263 let _handle = Symbol('_handle'); | 1269 let _handle = Symbol('_handle'); |
| 1264 class TimerImpl extends core.Object { | 1270 class TimerImpl extends core.Object { |
| 1265 TimerImpl(milliseconds, callback) { | 1271 TimerImpl(milliseconds, callback) { |
| 1266 this[_once] = true; | 1272 this[_once] = true; |
| 1267 this[_inEventLoop] = false; | 1273 this[_inEventLoop] = false; |
| 1268 this[_handle] = null; | 1274 this[_handle] = null; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 } | 1323 } |
| 1318 this[_handle] = null; | 1324 this[_handle] = null; |
| 1319 } else { | 1325 } else { |
| 1320 throw new core.UnsupportedError("Canceling a timer."); | 1326 throw new core.UnsupportedError("Canceling a timer."); |
| 1321 } | 1327 } |
| 1322 } | 1328 } |
| 1323 get isActive() { | 1329 get isActive() { |
| 1324 return this[_handle] !== null; | 1330 return this[_handle] !== null; |
| 1325 } | 1331 } |
| 1326 } | 1332 } |
| 1333 TimerImpl[dart.implements] = [async.Timer]; |
| 1327 dart.defineNamedConstructor(TimerImpl, 'periodic'); | 1334 dart.defineNamedConstructor(TimerImpl, 'periodic'); |
| 1328 // Function hasTimer: () → bool | 1335 // Function hasTimer: () → bool |
| 1329 function hasTimer() { | 1336 function hasTimer() { |
| 1330 _js_helper.requiresPreamble(); | 1337 _js_helper.requiresPreamble(); |
| 1331 return self.setTimeout !== null; | 1338 return self.setTimeout !== null; |
| 1332 } | 1339 } |
| 1333 let _internal = Symbol('_internal'); | 1340 let _internal = Symbol('_internal'); |
| 1334 class CapabilityImpl extends core.Object { | 1341 class CapabilityImpl extends core.Object { |
| 1335 CapabilityImpl() { | 1342 CapabilityImpl() { |
| 1336 this[_internal](_js_helper.random64()); | 1343 this[_internal](_js_helper.random64()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1351 } | 1358 } |
| 1352 ['=='](other) { | 1359 ['=='](other) { |
| 1353 if (core.identical(other, this)) | 1360 if (core.identical(other, this)) |
| 1354 return true; | 1361 return true; |
| 1355 if (dart.is(other, CapabilityImpl)) { | 1362 if (dart.is(other, CapabilityImpl)) { |
| 1356 return core.identical(this[_id], other[_id]); | 1363 return core.identical(this[_id], other[_id]); |
| 1357 } | 1364 } |
| 1358 return false; | 1365 return false; |
| 1359 } | 1366 } |
| 1360 } | 1367 } |
| 1368 CapabilityImpl[dart.implements] = [isolate.Capability]; |
| 1361 dart.defineNamedConstructor(CapabilityImpl, _internal); | 1369 dart.defineNamedConstructor(CapabilityImpl, _internal); |
| 1362 // Exports: | 1370 // Exports: |
| 1363 exports.enterJsAsync = enterJsAsync; | 1371 exports.enterJsAsync = enterJsAsync; |
| 1364 exports.leaveJsAsync = leaveJsAsync; | 1372 exports.leaveJsAsync = leaveJsAsync; |
| 1365 exports.isWorker = isWorker; | 1373 exports.isWorker = isWorker; |
| 1366 exports.startRootIsolate = startRootIsolate; | 1374 exports.startRootIsolate = startRootIsolate; |
| 1367 exports.IsolateNatives = IsolateNatives; | 1375 exports.IsolateNatives = IsolateNatives; |
| 1368 exports.RawReceivePortImpl = RawReceivePortImpl; | 1376 exports.RawReceivePortImpl = RawReceivePortImpl; |
| 1369 exports.ReceivePortImpl = ReceivePortImpl; | 1377 exports.ReceivePortImpl = ReceivePortImpl; |
| 1370 exports.TimerImpl = TimerImpl; | 1378 exports.TimerImpl = TimerImpl; |
| 1371 exports.hasTimer = hasTimer; | 1379 exports.hasTimer = hasTimer; |
| 1372 exports.CapabilityImpl = CapabilityImpl; | 1380 exports.CapabilityImpl = CapabilityImpl; |
| 1373 })(_isolate_helper || (_isolate_helper = {})); | 1381 })(_isolate_helper || (_isolate_helper = {})); |
| OLD | NEW |