| 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 _id = Symbol('_id'); |
| 22 let _receivePort = Symbol('_receivePort'); | 23 let _receivePort = Symbol('_receivePort'); |
| 23 let _id = Symbol('_id'); | |
| 24 let _getJSFunctionName = Symbol('_getJSFunctionName'); | 24 let _getJSFunctionName = Symbol('_getJSFunctionName'); |
| 25 class _Serializer extends core.Object { | 25 class _Serializer extends core.Object { |
| 26 _Serializer(opts) { | 26 _Serializer(opts) { |
| 27 let serializeSendPorts = opts && 'serializeSendPorts' in opts ? opts.seria
lizeSendPorts : true; | 27 let serializeSendPorts = opts && 'serializeSendPorts' in opts ? opts.seria
lizeSendPorts : true; |
| 28 this.serializedObjectIds = new core.Map$(dart.dynamic, core.int).identity(
); | 28 this.serializedObjectIds = new core.Map$(dart.dynamic, core.int).identity(
); |
| 29 this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool); | 29 this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool); |
| 30 } | 30 } |
| 31 serialize(x) { | 31 serialize(x) { |
| 32 if (this.isPrimitive(x)) | 32 if (this.isPrimitive(x)) |
| 33 return this.serializePrimitive(x); | 33 return this.serializePrimitive(x); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 63 if (message === void 0) | 63 if (message === void 0) |
| 64 message = null; | 64 message = null; |
| 65 if (message == null) | 65 if (message == null) |
| 66 message = "Can't transmit:"; | 66 message = "Can't transmit:"; |
| 67 throw new core.UnsupportedError(`${message} ${x}`); | 67 throw new core.UnsupportedError(`${message} ${x}`); |
| 68 } | 68 } |
| 69 makeRef(serializationId) { | 69 makeRef(serializationId) { |
| 70 return new core.List.from(["ref", serializationId]); | 70 return new core.List.from(["ref", serializationId]); |
| 71 } | 71 } |
| 72 isPrimitive(x) { | 72 isPrimitive(x) { |
| 73 return dart.notNull(x == null) || dart.notNull(typeof x == 'string') || da
rt.notNull(dart.is(x, core.num)) || dart.notNull(typeof x == 'boolean'); | 73 return dart.notNull(x == null) || typeof x == 'string' || dart.is(x, core.
num) || typeof x == 'boolean'; |
| 74 } | 74 } |
| 75 serializePrimitive(primitive) { | 75 serializePrimitive(primitive) { |
| 76 return primitive; | 76 return primitive; |
| 77 } | 77 } |
| 78 serializeByteBuffer(buffer) { | 78 serializeByteBuffer(buffer) { |
| 79 return new core.List.from(["buffer", buffer]); | 79 return new core.List.from(["buffer", buffer]); |
| 80 } | 80 } |
| 81 serializeTypedData(data) { | 81 serializeTypedData(data) { |
| 82 return new core.List.from(["typed", data]); | 82 return new core.List.from(["typed", data]); |
| 83 } | 83 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 { | 222 { |
| 223 return this.deserializeDartObject(x); | 223 return this.deserializeDartObject(x); |
| 224 } | 224 } |
| 225 default: | 225 default: |
| 226 { | 226 { |
| 227 throw `couldn't deserialize: ${x}`; | 227 throw `couldn't deserialize: ${x}`; |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 isPrimitive(x) { | 231 isPrimitive(x) { |
| 232 return dart.notNull(x == null) || dart.notNull(typeof x == 'string') || da
rt.notNull(dart.is(x, core.num)) || dart.notNull(typeof x == 'boolean'); | 232 return dart.notNull(x == null) || typeof x == 'string' || dart.is(x, core.
num) || typeof x == 'boolean'; |
| 233 } | 233 } |
| 234 deserializePrimitive(x) { | 234 deserializePrimitive(x) { |
| 235 return x; | 235 return x; |
| 236 } | 236 } |
| 237 deserializeRef(x) { | 237 deserializeRef(x) { |
| 238 dart.assert(dart.equals(dart.dindex(x, 0), 'ref')); | 238 dart.assert(dart.equals(dart.dindex(x, 0), 'ref')); |
| 239 let serializationId = dart.as(dart.dindex(x, 1), core.int); | 239 let serializationId = dart.as(dart.dindex(x, 1), core.int); |
| 240 return this.deserializedObjects[core.$get](serializationId); | 240 return this.deserializedObjects[core.$get](serializationId); |
| 241 } | 241 } |
| 242 deserializeByteBuffer(x) { | 242 deserializeByteBuffer(x) { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 exports._globalState.topEventLoop.prequeue(event); | 523 exports._globalState.topEventLoop.prequeue(event); |
| 524 } | 524 } |
| 525 this.isPaused = false; | 525 this.isPaused = false; |
| 526 } | 526 } |
| 527 this[_updateGlobalState](); | 527 this[_updateGlobalState](); |
| 528 } | 528 } |
| 529 addDoneListener(responsePort) { | 529 addDoneListener(responsePort) { |
| 530 if (this.doneHandlers == null) { | 530 if (this.doneHandlers == null) { |
| 531 this.doneHandlers = new core.List.from([]); | 531 this.doneHandlers = new core.List.from([]); |
| 532 } | 532 } |
| 533 if (dart.dinvoke(this.doneHandlers, 'contains', responsePort)) | 533 if (dart.dsend(this.doneHandlers, 'contains', responsePort)) |
| 534 return; | 534 return; |
| 535 dart.dinvoke(this.doneHandlers, 'add', responsePort); | 535 dart.dsend(this.doneHandlers, 'add', responsePort); |
| 536 } | 536 } |
| 537 removeDoneListener(responsePort) { | 537 removeDoneListener(responsePort) { |
| 538 if (this.doneHandlers == null) | 538 if (this.doneHandlers == null) |
| 539 return; | 539 return; |
| 540 dart.dinvoke(this.doneHandlers, 'remove', responsePort); | 540 dart.dsend(this.doneHandlers, 'remove', responsePort); |
| 541 } | 541 } |
| 542 setErrorsFatal(authentification, errorsAreFatal) { | 542 setErrorsFatal(authentification, errorsAreFatal) { |
| 543 if (!dart.equals(this.terminateCapability, authentification)) | 543 if (!dart.equals(this.terminateCapability, authentification)) |
| 544 return; | 544 return; |
| 545 this.errorsAreFatal = errorsAreFatal; | 545 this.errorsAreFatal = errorsAreFatal; |
| 546 } | 546 } |
| 547 handlePing(responsePort, pingType) { | 547 handlePing(responsePort, pingType) { |
| 548 if (pingType == isolate.Isolate.IMMEDIATE || pingType == isolate.Isolate.B
EFORE_NEXT_EVENT && !dart.notNull(this[_isExecutingEvent])) { | 548 if (pingType == isolate.Isolate.IMMEDIATE || pingType == isolate.Isolate.B
EFORE_NEXT_EVENT && !dart.notNull(this[_isExecutingEvent])) { |
| 549 responsePort.send(null); | 549 responsePort.send(null); |
| 550 return; | 550 return; |
| 551 } | 551 } |
| 552 // Function respond: () → void | 552 // Function respond: () → void |
| 553 function respond() { | 553 function respond() { |
| 554 responsePort.send(null); | 554 responsePort.send(null); |
| 555 } | 555 } |
| 556 if (pingType == isolate.Isolate.AS_EVENT) { | 556 if (pingType == isolate.Isolate.AS_EVENT) { |
| 557 exports._globalState.topEventLoop.enqueue(this, respond, "ping"); | 557 exports._globalState.topEventLoop.enqueue(this, respond, "ping"); |
| 558 return; | 558 return; |
| 559 } | 559 } |
| 560 dart.assert(pingType == isolate.Isolate.BEFORE_NEXT_EVENT); | 560 dart.assert(pingType == isolate.Isolate.BEFORE_NEXT_EVENT); |
| 561 if (this[_scheduledControlEvents] == null) { | 561 if (this[_scheduledControlEvents] == null) { |
| 562 this[_scheduledControlEvents] = new collection.Queue(); | 562 this[_scheduledControlEvents] = new collection.Queue(); |
| 563 } | 563 } |
| 564 dart.dinvoke(this[_scheduledControlEvents], 'addLast', respond); | 564 dart.dsend(this[_scheduledControlEvents], 'addLast', respond); |
| 565 } | 565 } |
| 566 handleKill(authentification, priority) { | 566 handleKill(authentification, priority) { |
| 567 if (!dart.equals(this.terminateCapability, authentification)) | 567 if (!dart.equals(this.terminateCapability, authentification)) |
| 568 return; | 568 return; |
| 569 if (priority == isolate.Isolate.IMMEDIATE || priority == isolate.Isolate.B
EFORE_NEXT_EVENT && !dart.notNull(this[_isExecutingEvent])) { | 569 if (priority == isolate.Isolate.IMMEDIATE || priority == isolate.Isolate.B
EFORE_NEXT_EVENT && !dart.notNull(this[_isExecutingEvent])) { |
| 570 this.kill(); | 570 this.kill(); |
| 571 return; | 571 return; |
| 572 } | 572 } |
| 573 if (priority == isolate.Isolate.AS_EVENT) { | 573 if (priority == isolate.Isolate.AS_EVENT) { |
| 574 exports._globalState.topEventLoop.enqueue(this, this.kill, "kill"); | 574 exports._globalState.topEventLoop.enqueue(this, this.kill, "kill"); |
| 575 return; | 575 return; |
| 576 } | 576 } |
| 577 dart.assert(priority == isolate.Isolate.BEFORE_NEXT_EVENT); | 577 dart.assert(priority == isolate.Isolate.BEFORE_NEXT_EVENT); |
| 578 if (this[_scheduledControlEvents] == null) { | 578 if (this[_scheduledControlEvents] == null) { |
| 579 this[_scheduledControlEvents] = new collection.Queue(); | 579 this[_scheduledControlEvents] = new collection.Queue(); |
| 580 } | 580 } |
| 581 dart.dinvoke(this[_scheduledControlEvents], 'addLast', this.kill); | 581 dart.dsend(this[_scheduledControlEvents], 'addLast', this.kill); |
| 582 } | 582 } |
| 583 addErrorListener(port) { | 583 addErrorListener(port) { |
| 584 this.errorPorts.add(port); | 584 this.errorPorts.add(port); |
| 585 } | 585 } |
| 586 removeErrorListener(port) { | 586 removeErrorListener(port) { |
| 587 this.errorPorts.remove(port); | 587 this.errorPorts.remove(port); |
| 588 } | 588 } |
| 589 handleUncaughtError(error, stackTrace) { | 589 handleUncaughtError(error, stackTrace) { |
| 590 if (this.errorPorts[core.$isEmpty]) { | 590 if (this.errorPorts[core.$isEmpty]) { |
| 591 if (dart.notNull(this.errorsAreFatal) && dart.notNull(core.identical(thi
s, exports._globalState.rootContext))) { | 591 if (dart.notNull(this.errorsAreFatal) && dart.notNull(core.identical(thi
s, exports._globalState.rootContext))) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 } | 624 } |
| 625 } | 625 } |
| 626 } | 626 } |
| 627 finally { | 627 finally { |
| 628 this[_isExecutingEvent] = false; | 628 this[_isExecutingEvent] = false; |
| 629 exports._globalState.currentContext = old; | 629 exports._globalState.currentContext = old; |
| 630 if (old != null) | 630 if (old != null) |
| 631 old[_setGlobals](); | 631 old[_setGlobals](); |
| 632 if (this[_scheduledControlEvents] != null) { | 632 if (this[_scheduledControlEvents] != null) { |
| 633 while (dart.dload(this[_scheduledControlEvents], 'isNotEmpty')) { | 633 while (dart.dload(this[_scheduledControlEvents], 'isNotEmpty')) { |
| 634 dart.dinvokef(dart.dinvoke(this[_scheduledControlEvents], 'removeFir
st')); | 634 dart.dinvokef(dart.dsend(this[_scheduledControlEvents], 'removeFirst
')); |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 return result; | 638 return result; |
| 639 } | 639 } |
| 640 [_setGlobals]() { | 640 [_setGlobals]() { |
| 641 _foreign_helper.JS_SET_CURRENT_ISOLATE(this.isolateStatics); | 641 _foreign_helper.JS_SET_CURRENT_ISOLATE(this.isolateStatics); |
| 642 } | 642 } |
| 643 handleControlMessage(message) { | 643 handleControlMessage(message) { |
| 644 switch (dart.dindex(message, 0)) { | 644 switch (dart.dindex(message, 0)) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 } | 709 } |
| 710 [_updateGlobalState]() { | 710 [_updateGlobalState]() { |
| 711 if (dart.notNull(this.ports.length) - dart.notNull(this.weakPorts[core.$le
ngth]) > 0 || dart.notNull(this.isPaused) || !dart.notNull(this.initialized)) { | 711 if (dart.notNull(this.ports.length) - dart.notNull(this.weakPorts[core.$le
ngth]) > 0 || dart.notNull(this.isPaused) || !dart.notNull(this.initialized)) { |
| 712 exports._globalState.isolates.set(this.id, this); | 712 exports._globalState.isolates.set(this.id, this); |
| 713 } else { | 713 } else { |
| 714 this.kill(); | 714 this.kill(); |
| 715 } | 715 } |
| 716 } | 716 } |
| 717 kill() { | 717 kill() { |
| 718 if (this[_scheduledControlEvents] != null) { | 718 if (this[_scheduledControlEvents] != null) { |
| 719 dart.dinvoke(this[_scheduledControlEvents], 'clear'); | 719 dart.dsend(this[_scheduledControlEvents], 'clear'); |
| 720 } | 720 } |
| 721 for (let port of this.ports.values) { | 721 for (let port of this.ports.values) { |
| 722 port[_close](); | 722 port[_close](); |
| 723 } | 723 } |
| 724 this.ports.clear(); | 724 this.ports.clear(); |
| 725 this.weakPorts.clear(); | 725 this.weakPorts.clear(); |
| 726 exports._globalState.isolates.remove(this.id); | 726 exports._globalState.isolates.remove(this.id); |
| 727 this.errorPorts.clear(); | 727 this.errorPorts.clear(); |
| 728 if (this.doneHandlers != null) { | 728 if (this.doneHandlers != null) { |
| 729 for (let port of dart.as(this.doneHandlers, core.Iterable$(isolate.SendP
ort))) { | 729 for (let port of dart.as(this.doneHandlers, core.Iterable$(isolate.SendP
ort))) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 case 'spawn-worker': | 918 case 'spawn-worker': |
| 919 { | 919 { |
| 920 if (IsolateNatives.enableSpawnWorker != null) | 920 if (IsolateNatives.enableSpawnWorker != null) |
| 921 IsolateNatives.handleSpawnWorkerRequest(msg); | 921 IsolateNatives.handleSpawnWorkerRequest(msg); |
| 922 break; | 922 break; |
| 923 } | 923 } |
| 924 case 'message': | 924 case 'message': |
| 925 { | 925 { |
| 926 let port = dart.as(dart.dindex(msg, 'port'), isolate.SendPort); | 926 let port = dart.as(dart.dindex(msg, 'port'), isolate.SendPort); |
| 927 if (port != null) { | 927 if (port != null) { |
| 928 dart.dinvoke(dart.dindex(msg, 'port'), 'send', dart.dindex(msg, 'msg
')); | 928 dart.dsend(dart.dindex(msg, 'port'), 'send', dart.dindex(msg, 'msg')
); |
| 929 } | 929 } |
| 930 exports._globalState.topEventLoop.run(); | 930 exports._globalState.topEventLoop.run(); |
| 931 break; | 931 break; |
| 932 } | 932 } |
| 933 case 'close': | 933 case 'close': |
| 934 { | 934 { |
| 935 exports._globalState.managers.remove(IsolateNatives.workerIds.get(send
er)); | 935 exports._globalState.managers.remove(IsolateNatives.workerIds.get(send
er)); |
| 936 sender.terminate(); | 936 sender.terminate(); |
| 937 exports._globalState.topEventLoop.run(); | 937 exports._globalState.topEventLoop.run(); |
| 938 break; | 938 break; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 953 } | 953 } |
| 954 case 'error': | 954 case 'error': |
| 955 { | 955 { |
| 956 throw dart.dindex(msg, 'msg'); | 956 throw dart.dindex(msg, 'msg'); |
| 957 } | 957 } |
| 958 } | 958 } |
| 959 } | 959 } |
| 960 static handleSpawnWorkerRequest(msg) { | 960 static handleSpawnWorkerRequest(msg) { |
| 961 let replyPort = dart.dindex(msg, 'replyPort'); | 961 let replyPort = dart.dindex(msg, 'replyPort'); |
| 962 IsolateNatives.spawn(dart.as(dart.dindex(msg, 'functionName'), core.String
), dart.as(dart.dindex(msg, 'uri'), core.String), dart.as(dart.dindex(msg, 'args
'), core.List$(core.String)), dart.dindex(msg, 'msg'), false, dart.as(dart.dinde
x(msg, 'isSpawnUri'), core.bool), dart.as(dart.dindex(msg, 'startPaused'), core.
bool)).then(dart.as(msg => { | 962 IsolateNatives.spawn(dart.as(dart.dindex(msg, 'functionName'), core.String
), dart.as(dart.dindex(msg, 'uri'), core.String), dart.as(dart.dindex(msg, 'args
'), core.List$(core.String)), dart.dindex(msg, 'msg'), false, dart.as(dart.dinde
x(msg, 'isSpawnUri'), core.bool), dart.as(dart.dindex(msg, 'startPaused'), core.
bool)).then(dart.as(msg => { |
| 963 dart.dinvoke(replyPort, 'send', msg); | 963 dart.dsend(replyPort, 'send', msg); |
| 964 }, dart.functionType(dart.dynamic, [core.List])), { | 964 }, dart.functionType(dart.dynamic, [core.List])), { |
| 965 onError: errorMessage => { | 965 onError: errorMessage => { |
| 966 dart.dinvoke(replyPort, 'send', new core.List.from([_SPAWN_FAILED_SIGN
AL, errorMessage])); | 966 dart.dsend(replyPort, 'send', new core.List.from([_SPAWN_FAILED_SIGNAL
, errorMessage])); |
| 967 } | 967 } |
| 968 }); | 968 }); |
| 969 } | 969 } |
| 970 static [_log](msg) { | 970 static [_log](msg) { |
| 971 if (exports._globalState.isWorker) { | 971 if (exports._globalState.isWorker) { |
| 972 exports._globalState.mainManager.postMessage(_serializeMessage(dart.map(
{command: 'log', msg: msg}))); | 972 exports._globalState.mainManager.postMessage(_serializeMessage(dart.map(
{command: 'log', msg: msg}))); |
| 973 } else { | 973 } else { |
| 974 try { | 974 try { |
| 975 IsolateNatives[_consoleLog](msg); | 975 IsolateNatives[_consoleLog](msg); |
| 976 } catch (e) { | 976 } catch (e) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 get workerIds() { | 1126 get workerIds() { |
| 1127 return new (core.Expando$(core.int))(); | 1127 return new (core.Expando$(core.int))(); |
| 1128 } | 1128 } |
| 1129 }); | 1129 }); |
| 1130 let _checkReplyTo = Symbol('_checkReplyTo'); | 1130 let _checkReplyTo = Symbol('_checkReplyTo'); |
| 1131 class _BaseSendPort extends core.Object { | 1131 class _BaseSendPort extends core.Object { |
| 1132 _BaseSendPort(isolateId$) { | 1132 _BaseSendPort(isolateId$) { |
| 1133 this[_isolateId] = isolateId$; | 1133 this[_isolateId] = isolateId$; |
| 1134 } | 1134 } |
| 1135 [_checkReplyTo](replyTo) { | 1135 [_checkReplyTo](replyTo) { |
| 1136 if (dart.notNull(replyTo != null) && dart.notNull(!dart.is(replyTo, _Nativ
eJsSendPort)) && dart.notNull(!dart.is(replyTo, _WorkerSendPort))) { | 1136 if (dart.notNull(replyTo != null) && !dart.is(replyTo, _NativeJsSendPort)
&& !dart.is(replyTo, _WorkerSendPort)) { |
| 1137 throw new core.Exception("SendPort.send: Illegal replyTo port type"); | 1137 throw new core.Exception("SendPort.send: Illegal replyTo port type"); |
| 1138 } | 1138 } |
| 1139 } | 1139 } |
| 1140 } | 1140 } |
| 1141 _BaseSendPort[dart.implements] = () => [isolate.SendPort]; | 1141 _BaseSendPort[dart.implements] = () => [isolate.SendPort]; |
| 1142 let _isClosed = Symbol('_isClosed'); | 1142 let _isClosed = Symbol('_isClosed'); |
| 1143 let _add = Symbol('_add'); | 1143 let _add = Symbol('_add'); |
| 1144 class _NativeJsSendPort extends _BaseSendPort { | 1144 class _NativeJsSendPort extends _BaseSendPort { |
| 1145 _NativeJsSendPort(receivePort$, isolateId) { | 1145 _NativeJsSendPort(receivePort$, isolateId) { |
| 1146 this[_receivePort] = receivePort$; | 1146 this[_receivePort] = receivePort$; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1157 isolate.handleControlMessage(msg); | 1157 isolate.handleControlMessage(msg); |
| 1158 return; | 1158 return; |
| 1159 } | 1159 } |
| 1160 exports._globalState.topEventLoop.enqueue(isolate, (() => { | 1160 exports._globalState.topEventLoop.enqueue(isolate, (() => { |
| 1161 if (!dart.notNull(this[_receivePort][_isClosed])) { | 1161 if (!dart.notNull(this[_receivePort][_isClosed])) { |
| 1162 this[_receivePort][_add](msg); | 1162 this[_receivePort][_add](msg); |
| 1163 } | 1163 } |
| 1164 }).bind(this), `receive ${message}`); | 1164 }).bind(this), `receive ${message}`); |
| 1165 } | 1165 } |
| 1166 ['=='](other) { | 1166 ['=='](other) { |
| 1167 return dart.notNull(dart.is(other, _NativeJsSendPort)) && dart.notNull(dar
t.equals(this[_receivePort], dart.dload(other, '_receivePort'))); | 1167 return dart.is(other, _NativeJsSendPort) && dart.notNull(dart.equals(this[
_receivePort], dart.dload(other, _receivePort))); |
| 1168 } | 1168 } |
| 1169 get hashCode() { | 1169 get hashCode() { |
| 1170 return this[_receivePort][_id]; | 1170 return this[_receivePort][_id]; |
| 1171 } | 1171 } |
| 1172 } | 1172 } |
| 1173 _NativeJsSendPort[dart.implements] = () => [isolate.SendPort]; | 1173 _NativeJsSendPort[dart.implements] = () => [isolate.SendPort]; |
| 1174 class _WorkerSendPort extends _BaseSendPort { | 1174 class _WorkerSendPort extends _BaseSendPort { |
| 1175 _WorkerSendPort(workerId$, isolateId, receivePortId$) { | 1175 _WorkerSendPort(workerId$, isolateId, receivePortId$) { |
| 1176 this[_workerId] = workerId$; | 1176 this[_workerId] = workerId$; |
| 1177 this[_receivePortId] = receivePortId$; | 1177 this[_receivePortId] = receivePortId$; |
| 1178 super._BaseSendPort(isolateId); | 1178 super._BaseSendPort(isolateId); |
| 1179 } | 1179 } |
| 1180 send(message) { | 1180 send(message) { |
| 1181 let workerMessage = _serializeMessage(dart.map({command: 'message', port:
this, msg: message})); | 1181 let workerMessage = _serializeMessage(dart.map({command: 'message', port:
this, msg: message})); |
| 1182 if (exports._globalState.isWorker) { | 1182 if (exports._globalState.isWorker) { |
| 1183 exports._globalState.mainManager.postMessage(workerMessage); | 1183 exports._globalState.mainManager.postMessage(workerMessage); |
| 1184 } else { | 1184 } else { |
| 1185 let manager = exports._globalState.managers.get(this[_workerId]); | 1185 let manager = exports._globalState.managers.get(this[_workerId]); |
| 1186 if (manager != null) { | 1186 if (manager != null) { |
| 1187 manager.postMessage(workerMessage); | 1187 manager.postMessage(workerMessage); |
| 1188 } | 1188 } |
| 1189 } | 1189 } |
| 1190 } | 1190 } |
| 1191 ['=='](other) { | 1191 ['=='](other) { |
| 1192 return dart.notNull(dart.is(other, _WorkerSendPort)) && dart.equals(this[_
workerId], dart.dload(other, '_workerId')) && dart.equals(this[_isolateId], dart
.dload(other, '_isolateId')) && dart.equals(this[_receivePortId], dart.dload(oth
er, '_receivePortId')); | 1192 return dart.is(other, _WorkerSendPort) && dart.equals(this[_workerId], dar
t.dload(other, _workerId)) && dart.equals(this[_isolateId], dart.dload(other, _i
solateId)) && dart.equals(this[_receivePortId], dart.dload(other, _receivePortId
)); |
| 1193 } | 1193 } |
| 1194 get hashCode() { | 1194 get hashCode() { |
| 1195 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]
) << 8 ^ dart.notNull(this[_receivePortId]); | 1195 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId]
) << 8 ^ dart.notNull(this[_receivePortId]); |
| 1196 } | 1196 } |
| 1197 } | 1197 } |
| 1198 _WorkerSendPort[dart.implements] = () => [isolate.SendPort]; | 1198 _WorkerSendPort[dart.implements] = () => [isolate.SendPort]; |
| 1199 let _handler = Symbol('_handler'); | 1199 let _handler = Symbol('_handler'); |
| 1200 let _nextFreeId = Symbol('_nextFreeId'); | 1200 let _nextFreeId = Symbol('_nextFreeId'); |
| 1201 class RawReceivePortImpl extends core.Object { | 1201 class RawReceivePortImpl extends core.Object { |
| 1202 RawReceivePortImpl(handler) { | 1202 RawReceivePortImpl(handler) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 exports.leaveJsAsync = leaveJsAsync; | 1392 exports.leaveJsAsync = leaveJsAsync; |
| 1393 exports.isWorker = isWorker; | 1393 exports.isWorker = isWorker; |
| 1394 exports.startRootIsolate = startRootIsolate; | 1394 exports.startRootIsolate = startRootIsolate; |
| 1395 exports.IsolateNatives = IsolateNatives; | 1395 exports.IsolateNatives = IsolateNatives; |
| 1396 exports.RawReceivePortImpl = RawReceivePortImpl; | 1396 exports.RawReceivePortImpl = RawReceivePortImpl; |
| 1397 exports.ReceivePortImpl = ReceivePortImpl; | 1397 exports.ReceivePortImpl = ReceivePortImpl; |
| 1398 exports.TimerImpl = TimerImpl; | 1398 exports.TimerImpl = TimerImpl; |
| 1399 exports.hasTimer = hasTimer; | 1399 exports.hasTimer = hasTimer; |
| 1400 exports.CapabilityImpl = CapabilityImpl; | 1400 exports.CapabilityImpl = CapabilityImpl; |
| 1401 })(_isolate_helper || (_isolate_helper = {})); | 1401 })(_isolate_helper || (_isolate_helper = {})); |
| OLD | NEW |