| 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 } | 463 } |
| 464 static [_serializePrintMessage](object) { | 464 static [_serializePrintMessage](object) { |
| 465 return _serializeMessage(dart.map({command: "print", msg: object})); | 465 return _serializeMessage(dart.map({command: "print", msg: object})); |
| 466 } | 466 } |
| 467 maybeCloseWorker() { | 467 maybeCloseWorker() { |
| 468 if (dart.notNull(this.isWorker) && dart.notNull(this.isolates.isEmpty) &&
this.topEventLoop[_activeJsAsyncCount] === 0) { | 468 if (dart.notNull(this.isWorker) && dart.notNull(this.isolates.isEmpty) &&
this.topEventLoop[_activeJsAsyncCount] === 0) { |
| 469 this.mainManager.postMessage(_serializeMessage(dart.map({command: 'close
'}))); | 469 this.mainManager.postMessage(_serializeMessage(dart.map({command: 'close
'}))); |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 let _controlPort = Symbol('_controlPort'); |
| 473 let _scheduledControlEvents = Symbol('_scheduledControlEvents'); | 474 let _scheduledControlEvents = Symbol('_scheduledControlEvents'); |
| 474 let _isExecutingEvent = Symbol('_isExecutingEvent'); | 475 let _isExecutingEvent = Symbol('_isExecutingEvent'); |
| 475 let _updateGlobalState = Symbol('_updateGlobalState'); | 476 let _updateGlobalState = Symbol('_updateGlobalState'); |
| 476 let _setGlobals = Symbol('_setGlobals'); | 477 let _setGlobals = Symbol('_setGlobals'); |
| 477 let _addRegistration = Symbol('_addRegistration'); | 478 let _addRegistration = Symbol('_addRegistration'); |
| 478 class _IsolateContext extends core.Object { | 479 class _IsolateContext extends core.Object { |
| 479 _IsolateContext() { | 480 _IsolateContext() { |
| 480 this.id = ((x$) => exports._globalState.nextIsolateId = dart.notNull(x$) +
1, x$).bind(this)(exports._globalState.nextIsolateId); | 481 this.id = ((x$) => exports._globalState.nextIsolateId = dart.notNull(x$) +
1, x$).bind(this)(exports._globalState.nextIsolateId); |
| 481 this.ports = new core.Map(); | 482 this.ports = new core.Map(); |
| 482 this.weakPorts = new core.Set(); | 483 this.weakPorts = new core.Set(); |
| 483 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); | 484 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); |
| 484 this.controlPort = new RawReceivePortImpl._controlPort(); | 485 this.controlPort = new RawReceivePortImpl[_controlPort](); |
| 485 this.pauseCapability = new isolate.Capability(); | 486 this.pauseCapability = new isolate.Capability(); |
| 486 this.terminateCapability = new isolate.Capability(); | 487 this.terminateCapability = new isolate.Capability(); |
| 487 this.delayedEvents = dart.as(new core.List.from([]), core.List$(_IsolateEv
ent)); | 488 this.delayedEvents = dart.as(new core.List.from([]), core.List$(_IsolateEv
ent)); |
| 488 this.pauseTokens = dart.as(new core.Set(), core.Set$(isolate.Capability)); | 489 this.pauseTokens = dart.as(new core.Set(), core.Set$(isolate.Capability)); |
| 489 this.errorPorts = dart.as(new core.Set(), core.Set$(isolate.SendPort)); | 490 this.errorPorts = dart.as(new core.Set(), core.Set$(isolate.SendPort)); |
| 490 this.initialized = false; | 491 this.initialized = false; |
| 491 this.isPaused = false; | 492 this.isPaused = false; |
| 492 this.doneHandlers = null; | 493 this.doneHandlers = null; |
| 493 this[_scheduledControlEvents] = null; | 494 this[_scheduledControlEvents] = null; |
| 494 this[_isExecutingEvent] = false; | 495 this[_isExecutingEvent] = false; |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 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'); | 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'); |
| 1175 } | 1176 } |
| 1176 get hashCode() { | 1177 get hashCode() { |
| 1177 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]
) << 8 ^ dart.notNull(this[_receivePortId]); | 1178 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]
) << 8 ^ dart.notNull(this[_receivePortId]); |
| 1178 } | 1179 } |
| 1179 } | 1180 } |
| 1180 let _handler = Symbol('_handler'); | 1181 let _handler = Symbol('_handler'); |
| 1181 let _nextFreeId = Symbol('_nextFreeId'); | 1182 let _nextFreeId = Symbol('_nextFreeId'); |
| 1182 let _close = Symbol('_close'); | 1183 let _close = Symbol('_close'); |
| 1183 let _add = Symbol('_add'); | 1184 let _add = Symbol('_add'); |
| 1184 let _controlPort = Symbol('_controlPort'); | |
| 1185 class RawReceivePortImpl extends core.Object { | 1185 class RawReceivePortImpl extends core.Object { |
| 1186 RawReceivePortImpl(handler) { | 1186 RawReceivePortImpl(handler) { |
| 1187 this[_handler] = handler; | 1187 this[_handler] = handler; |
| 1188 this[_id] = ((x$) => RawReceivePortImpl[_nextFreeId] = dart.notNull(x$) +
1, x$)(RawReceivePortImpl[_nextFreeId]); | 1188 this[_id] = ((x$) => RawReceivePortImpl[_nextFreeId] = dart.notNull(x$) +
1, x$)(RawReceivePortImpl[_nextFreeId]); |
| 1189 this[_isClosed] = false; | 1189 this[_isClosed] = false; |
| 1190 exports._globalState.currentContext.register(this[_id], this); | 1190 exports._globalState.currentContext.register(this[_id], this); |
| 1191 } | 1191 } |
| 1192 RawReceivePortImpl$weak(handler) { | 1192 weak(handler) { |
| 1193 this[_handler] = handler; | 1193 this[_handler] = handler; |
| 1194 this[_id] = ((x$) => RawReceivePortImpl[_nextFreeId] = dart.notNull(x$) +
1, x$)(RawReceivePortImpl[_nextFreeId]); | 1194 this[_id] = ((x$) => RawReceivePortImpl[_nextFreeId] = dart.notNull(x$) +
1, x$)(RawReceivePortImpl[_nextFreeId]); |
| 1195 this[_isClosed] = false; | 1195 this[_isClosed] = false; |
| 1196 exports._globalState.currentContext.registerWeak(this[_id], this); | 1196 exports._globalState.currentContext.registerWeak(this[_id], this); |
| 1197 } | 1197 } |
| 1198 RawReceivePortImpl$_controlPort() { | 1198 [_controlPort]() { |
| 1199 this[_handler] = null; | 1199 this[_handler] = null; |
| 1200 this[_id] = 0; | 1200 this[_id] = 0; |
| 1201 this[_isClosed] = false; | 1201 this[_isClosed] = false; |
| 1202 } | 1202 } |
| 1203 set handler(newHandler) { | 1203 set handler(newHandler) { |
| 1204 this[_handler] = newHandler; | 1204 this[_handler] = newHandler; |
| 1205 } | 1205 } |
| 1206 [_close]() { | 1206 [_close]() { |
| 1207 this[_isClosed] = true; | 1207 this[_isClosed] = true; |
| 1208 this[_handler] = null; | 1208 this[_handler] = null; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1223 return new _NativeJsSendPort(this, exports._globalState.currentContext.id)
; | 1223 return new _NativeJsSendPort(this, exports._globalState.currentContext.id)
; |
| 1224 } | 1224 } |
| 1225 } | 1225 } |
| 1226 dart.defineNamedConstructor(RawReceivePortImpl, 'weak'); | 1226 dart.defineNamedConstructor(RawReceivePortImpl, 'weak'); |
| 1227 dart.defineNamedConstructor(RawReceivePortImpl, _controlPort); | 1227 dart.defineNamedConstructor(RawReceivePortImpl, _controlPort); |
| 1228 RawReceivePortImpl._nextFreeId = 1; | 1228 RawReceivePortImpl._nextFreeId = 1; |
| 1229 let _rawPort = Symbol('_rawPort'); | 1229 let _rawPort = Symbol('_rawPort'); |
| 1230 let _controller = Symbol('_controller'); | 1230 let _controller = Symbol('_controller'); |
| 1231 class ReceivePortImpl extends async.Stream { | 1231 class ReceivePortImpl extends async.Stream { |
| 1232 ReceivePortImpl() { | 1232 ReceivePortImpl() { |
| 1233 this.ReceivePortImpl$fromRawReceivePort(new RawReceivePortImpl(null)); | 1233 this.fromRawReceivePort(new RawReceivePortImpl(null)); |
| 1234 } | 1234 } |
| 1235 ReceivePortImpl$weak() { | 1235 weak() { |
| 1236 this.ReceivePortImpl$fromRawReceivePort(new RawReceivePortImpl.weak(null))
; | 1236 this.fromRawReceivePort(new RawReceivePortImpl.weak(null)); |
| 1237 } | 1237 } |
| 1238 ReceivePortImpl$fromRawReceivePort(rawPort) { | 1238 fromRawReceivePort(rawPort) { |
| 1239 this[_rawPort] = rawPort; | 1239 this[_rawPort] = rawPort; |
| 1240 this[_controller] = null; | 1240 this[_controller] = null; |
| 1241 super.Stream(); | 1241 super.Stream(); |
| 1242 this[_controller] = new async.StreamController({onCancel: this.close, sync
: true}); | 1242 this[_controller] = new async.StreamController({onCancel: this.close, sync
: true}); |
| 1243 this[_rawPort].handler = this[_controller].add; | 1243 this[_rawPort].handler = this[_controller].add; |
| 1244 } | 1244 } |
| 1245 listen(onData, opts) { | 1245 listen(onData, opts) { |
| 1246 let onError = opts && 'onError' in opts ? opts.onError : null; | 1246 let onError = opts && 'onError' in opts ? opts.onError : null; |
| 1247 let onDone = opts && 'onDone' in opts ? opts.onDone : null; | 1247 let onDone = opts && 'onDone' in opts ? opts.onDone : null; |
| 1248 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError :
null; | 1248 let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError :
null; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 leaveJsAsync(); | 1282 leaveJsAsync(); |
| 1283 callback(); | 1283 callback(); |
| 1284 } | 1284 } |
| 1285 enterJsAsync(); | 1285 enterJsAsync(); |
| 1286 this[_handle] = self.setTimeout(_js_helper.convertDartClosureToJS(intern
alCallback, 0), milliseconds); | 1286 this[_handle] = self.setTimeout(_js_helper.convertDartClosureToJS(intern
alCallback, 0), milliseconds); |
| 1287 } else { | 1287 } else { |
| 1288 dart.assert(dart.notNull(milliseconds) > 0); | 1288 dart.assert(dart.notNull(milliseconds) > 0); |
| 1289 throw new core.UnsupportedError("Timer greater than 0."); | 1289 throw new core.UnsupportedError("Timer greater than 0."); |
| 1290 } | 1290 } |
| 1291 } | 1291 } |
| 1292 TimerImpl$periodic(milliseconds, callback) { | 1292 periodic(milliseconds, callback) { |
| 1293 this[_once] = false; | 1293 this[_once] = false; |
| 1294 this[_inEventLoop] = false; | 1294 this[_inEventLoop] = false; |
| 1295 this[_handle] = null; | 1295 this[_handle] = null; |
| 1296 if (hasTimer()) { | 1296 if (hasTimer()) { |
| 1297 enterJsAsync(); | 1297 enterJsAsync(); |
| 1298 this[_handle] = self.setInterval(_js_helper.convertDartClosureToJS((() =
> { | 1298 this[_handle] = self.setInterval(_js_helper.convertDartClosureToJS((() =
> { |
| 1299 callback(this); | 1299 callback(this); |
| 1300 }).bind(this), 0), milliseconds); | 1300 }).bind(this), 0), milliseconds); |
| 1301 } else { | 1301 } else { |
| 1302 throw new core.UnsupportedError("Periodic timer."); | 1302 throw new core.UnsupportedError("Periodic timer."); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1326 } | 1326 } |
| 1327 dart.defineNamedConstructor(TimerImpl, 'periodic'); | 1327 dart.defineNamedConstructor(TimerImpl, 'periodic'); |
| 1328 // Function hasTimer: () → bool | 1328 // Function hasTimer: () → bool |
| 1329 function hasTimer() { | 1329 function hasTimer() { |
| 1330 _js_helper.requiresPreamble(); | 1330 _js_helper.requiresPreamble(); |
| 1331 return self.setTimeout !== null; | 1331 return self.setTimeout !== null; |
| 1332 } | 1332 } |
| 1333 let _internal = Symbol('_internal'); | 1333 let _internal = Symbol('_internal'); |
| 1334 class CapabilityImpl extends core.Object { | 1334 class CapabilityImpl extends core.Object { |
| 1335 CapabilityImpl() { | 1335 CapabilityImpl() { |
| 1336 this.CapabilityImpl$_internal(_js_helper.random64()); | 1336 this[_internal](_js_helper.random64()); |
| 1337 } | 1337 } |
| 1338 CapabilityImpl$_internal(id) { | 1338 [_internal](id) { |
| 1339 this[_id] = id; | 1339 this[_id] = id; |
| 1340 } | 1340 } |
| 1341 get hashCode() { | 1341 get hashCode() { |
| 1342 let hash = this[_id]; | 1342 let hash = this[_id]; |
| 1343 hash = dart.notNull(hash) >> 0 ^ (dart.notNull(hash) / 4294967296).truncat
e(); | 1343 hash = dart.notNull(hash) >> 0 ^ (dart.notNull(hash) / 4294967296).truncat
e(); |
| 1344 hash = ~dart.notNull(hash) + (dart.notNull(hash) << 15) & 4294967295; | 1344 hash = ~dart.notNull(hash) + (dart.notNull(hash) << 15) & 4294967295; |
| 1345 hash = dart.notNull(hash) >> 12; | 1345 hash = dart.notNull(hash) >> 12; |
| 1346 hash = dart.notNull(hash) * 5 & 4294967295; | 1346 hash = dart.notNull(hash) * 5 & 4294967295; |
| 1347 hash = dart.notNull(hash) >> 4; | 1347 hash = dart.notNull(hash) >> 4; |
| 1348 hash = dart.notNull(hash) * 2057 & 4294967295; | 1348 hash = dart.notNull(hash) * 2057 & 4294967295; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1364 exports.leaveJsAsync = leaveJsAsync; | 1364 exports.leaveJsAsync = leaveJsAsync; |
| 1365 exports.isWorker = isWorker; | 1365 exports.isWorker = isWorker; |
| 1366 exports.startRootIsolate = startRootIsolate; | 1366 exports.startRootIsolate = startRootIsolate; |
| 1367 exports.IsolateNatives = IsolateNatives; | 1367 exports.IsolateNatives = IsolateNatives; |
| 1368 exports.RawReceivePortImpl = RawReceivePortImpl; | 1368 exports.RawReceivePortImpl = RawReceivePortImpl; |
| 1369 exports.ReceivePortImpl = ReceivePortImpl; | 1369 exports.ReceivePortImpl = ReceivePortImpl; |
| 1370 exports.TimerImpl = TimerImpl; | 1370 exports.TimerImpl = TimerImpl; |
| 1371 exports.hasTimer = hasTimer; | 1371 exports.hasTimer = hasTimer; |
| 1372 exports.CapabilityImpl = CapabilityImpl; | 1372 exports.CapabilityImpl = CapabilityImpl; |
| 1373 })(_isolate_helper || (_isolate_helper = {})); | 1373 })(_isolate_helper || (_isolate_helper = {})); |
| OLD | NEW |