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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 442 } |
443 } | 443 } |
444 } | 444 } |
445 let _scheduledControlEvents = Symbol('_scheduledControlEvents'); | 445 let _scheduledControlEvents = Symbol('_scheduledControlEvents'); |
446 let _isExecutingEvent = Symbol('_isExecutingEvent'); | 446 let _isExecutingEvent = Symbol('_isExecutingEvent'); |
447 let _updateGlobalState = Symbol('_updateGlobalState'); | 447 let _updateGlobalState = Symbol('_updateGlobalState'); |
448 let _setGlobals = Symbol('_setGlobals'); | 448 let _setGlobals = Symbol('_setGlobals'); |
449 let _addRegistration = Symbol('_addRegistration'); | 449 let _addRegistration = Symbol('_addRegistration'); |
450 class _IsolateContext extends core.Object { | 450 class _IsolateContext extends core.Object { |
451 _IsolateContext() { | 451 _IsolateContext() { |
452 this.id = ((x) => exports._globalState.nextIsolateId = dart.notNull(x$) +
1, x$).bind(this)(exports._globalState.nextIsolateId); | 452 this.id = ((x$) => exports._globalState.nextIsolateId = dart.notNull(x$) +
1, x$).bind(this)(exports._globalState.nextIsolateId); |
453 this.ports = new core.Map(); | 453 this.ports = new core.Map(); |
454 this.weakPorts = new core.Set(); | 454 this.weakPorts = new core.Set(); |
455 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); | 455 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); |
456 this.controlPort = new RawReceivePortImpl._controlPort(); | 456 this.controlPort = new RawReceivePortImpl._controlPort(); |
457 this.pauseCapability = new isolate.Capability(); | 457 this.pauseCapability = new isolate.Capability(); |
458 this.terminateCapability = new isolate.Capability(); | 458 this.terminateCapability = new isolate.Capability(); |
459 this.delayedEvents = dart.as(new List.from([]), core.List$(_IsolateEvent))
; | 459 this.delayedEvents = dart.as(new List.from([]), core.List$(_IsolateEvent))
; |
460 this.pauseTokens = dart.as(new core.Set(), core.Set$(isolate.Capability)); | 460 this.pauseTokens = dart.as(new core.Set(), core.Set$(isolate.Capability)); |
461 this.errorPorts = dart.as(new core.Set(), core.Set$(isolate.SendPort)); | 461 this.errorPorts = dart.as(new core.Set(), core.Set$(isolate.SendPort)); |
462 this.initialized = false; | 462 this.initialized = false; |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 }; | 1018 }; |
1019 }(_foreign_helper.DART_CLOSURE_TO_JS(workerOnError), uri, onError); | 1019 }(_foreign_helper.DART_CLOSURE_TO_JS(workerOnError), uri, onError); |
1020 worker.onerror = onerrorTrampoline; | 1020 worker.onerror = onerrorTrampoline; |
1021 let processWorkerMessageTrampoline = function(f, a) { | 1021 let processWorkerMessageTrampoline = function(f, a) { |
1022 return function(e) { | 1022 return function(e) { |
1023 e.onerror = null; | 1023 e.onerror = null; |
1024 return f(a, e); | 1024 return f(a, e); |
1025 }; | 1025 }; |
1026 }(_foreign_helper.DART_CLOSURE_TO_JS(_processWorkerMessage), worker); | 1026 }(_foreign_helper.DART_CLOSURE_TO_JS(_processWorkerMessage), worker); |
1027 worker.onmessage = processWorkerMessageTrampoline; | 1027 worker.onmessage = processWorkerMessageTrampoline; |
1028 let workerId = ((x) => exports._globalState.nextManagerId = dart.notNull(x
$) + 1, x$).bind(this)(exports._globalState.nextManagerId); | 1028 let workerId = ((x$) => exports._globalState.nextManagerId = dart.notNull(
x$) + 1, x$).bind(this)(exports._globalState.nextManagerId); |
1029 workerIds.set(worker, workerId); | 1029 workerIds.set(worker, workerId); |
1030 exports._globalState.managers.set(workerId, worker); | 1030 exports._globalState.managers.set(workerId, worker); |
1031 worker.postMessage(_serializeMessage(dart.map({command: 'start', id: worke
rId, replyTo: _serializeMessage(replyPort), args: args, msg: _serializeMessage(m
essage), isSpawnUri: isSpawnUri, startPaused: startPaused, functionName: functio
nName}))); | 1031 worker.postMessage(_serializeMessage(dart.map({command: 'start', id: worke
rId, replyTo: _serializeMessage(replyPort), args: args, msg: _serializeMessage(m
essage), isSpawnUri: isSpawnUri, startPaused: startPaused, functionName: functio
nName}))); |
1032 } | 1032 } |
1033 static workerOnError(event, uri, onError) { | 1033 static workerOnError(event, uri, onError) { |
1034 event.preventDefault(); | 1034 event.preventDefault(); |
1035 let message = dart.as(event.message, core.String); | 1035 let message = dart.as(event.message, core.String); |
1036 if (message === null) { | 1036 if (message === null) { |
1037 message = `Error spawning worker for ${uri}`; | 1037 message = `Error spawning worker for ${uri}`; |
1038 } else { | 1038 } else { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 get hashCode() { | 1116 get hashCode() { |
1117 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]
) << 8 ^ dart.notNull(this[_receivePortId]); | 1117 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]
) << 8 ^ dart.notNull(this[_receivePortId]); |
1118 } | 1118 } |
1119 } | 1119 } |
1120 let _handler = Symbol('_handler'); | 1120 let _handler = Symbol('_handler'); |
1121 let _close = Symbol('_close'); | 1121 let _close = Symbol('_close'); |
1122 let _add = Symbol('_add'); | 1122 let _add = Symbol('_add'); |
1123 class RawReceivePortImpl extends core.Object { | 1123 class RawReceivePortImpl extends core.Object { |
1124 RawReceivePortImpl(handler) { | 1124 RawReceivePortImpl(handler) { |
1125 this[_handler] = handler; | 1125 this[_handler] = handler; |
1126 this[_id] = ((x) => _nextFreeId = dart.notNull(x$) + 1, x$)(_nextFreeId); | 1126 this[_id] = ((x$) => _nextFreeId = dart.notNull(x$) + 1, x$)(_nextFreeId); |
1127 this[_isClosed] = false; | 1127 this[_isClosed] = false; |
1128 exports._globalState.currentContext.register(this[_id], this); | 1128 exports._globalState.currentContext.register(this[_id], this); |
1129 } | 1129 } |
1130 RawReceivePortImpl$weak(handler) { | 1130 RawReceivePortImpl$weak(handler) { |
1131 this[_handler] = handler; | 1131 this[_handler] = handler; |
1132 this[_id] = ((x) => _nextFreeId = dart.notNull(x$) + 1, x$)(_nextFreeId); | 1132 this[_id] = ((x$) => _nextFreeId = dart.notNull(x$) + 1, x$)(_nextFreeId); |
1133 this[_isClosed] = false; | 1133 this[_isClosed] = false; |
1134 exports._globalState.currentContext.registerWeak(this[_id], this); | 1134 exports._globalState.currentContext.registerWeak(this[_id], this); |
1135 } | 1135 } |
1136 RawReceivePortImpl$_controlPort() { | 1136 RawReceivePortImpl$_controlPort() { |
1137 this[_handler] = null; | 1137 this[_handler] = null; |
1138 this[_id] = 0; | 1138 this[_id] = 0; |
1139 this[_isClosed] = false; | 1139 this[_isClosed] = false; |
1140 } | 1140 } |
1141 set handler(newHandler) { | 1141 set handler(newHandler) { |
1142 this[_handler] = newHandler; | 1142 this[_handler] = newHandler; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.IsolateNatives = IsolateNatives; | 1304 exports.IsolateNatives = IsolateNatives; |
1305 exports.RawReceivePortImpl = RawReceivePortImpl; | 1305 exports.RawReceivePortImpl = RawReceivePortImpl; |
1306 exports.ReceivePortImpl = ReceivePortImpl; | 1306 exports.ReceivePortImpl = ReceivePortImpl; |
1307 exports.TimerImpl = TimerImpl; | 1307 exports.TimerImpl = TimerImpl; |
1308 exports.hasTimer = hasTimer; | 1308 exports.hasTimer = hasTimer; |
1309 exports.CapabilityImpl = CapabilityImpl; | 1309 exports.CapabilityImpl = CapabilityImpl; |
1310 })(_isolate_helper || (_isolate_helper = {})); | 1310 })(_isolate_helper || (_isolate_helper = {})); |
OLD | NEW |