| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 return serialized; | 104 return serialized; |
| 105 } | 105 } |
| 106 serializeArrayInPlace(x) { | 106 serializeArrayInPlace(x) { |
| 107 for (let i = 0; dart.notNull(i) < dart.notNull(x[core.$length]); i = dart.
notNull(i) + 1) { | 107 for (let i = 0; dart.notNull(i) < dart.notNull(x[core.$length]); i = dart.
notNull(i) + 1) { |
| 108 x[core.$set](i, this.serialize(x[core.$get](i))); | 108 x[core.$set](i, this.serialize(x[core.$get](i))); |
| 109 } | 109 } |
| 110 return x; | 110 return x; |
| 111 } | 111 } |
| 112 serializeMap(x) { | 112 serializeMap(x) { |
| 113 let serializeTearOff = this.serialize; | 113 let serializeTearOff = this.serialize; |
| 114 return new core.List.from(['map', x.keys[core.$map](dart.as(serializeTearO
ff, dart.functionType(dart.dynamic, [dart.dynamic])))[core.$toList](), x.values[
core.$map](dart.as(serializeTearOff, dart.functionType(dart.dynamic, [dart.dynam
ic])))[core.$toList]()]); | 114 return new core.List.from(['map', x.keys[core.$map](dart.as(serializeTearO
ff, __CastType0))[core.$toList](), x.values[core.$map](dart.as(serializeTearOff,
dart.functionType(dart.dynamic, [dart.dynamic])))[core.$toList]()]); |
| 115 } | 115 } |
| 116 serializeJSObject(x) { | 116 serializeJSObject(x) { |
| 117 if (!!x.constructor && x.constructor !== Object) { | 117 if (!!x.constructor && x.constructor !== Object) { |
| 118 this.unsupported(x, "Only plain JS Objects are supported:"); | 118 this.unsupported(x, "Only plain JS Objects are supported:"); |
| 119 } | 119 } |
| 120 let keys = dart.as(Object.keys(x), core.List); | 120 let keys = dart.as(Object.keys(x), core.List); |
| 121 let values = new core.List.from([]); | 121 let values = new core.List.from([]); |
| 122 values[core.$length] = keys[core.$length]; | 122 values[core.$length] = keys[core.$length]; |
| 123 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { | 123 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { |
| 124 values[core.$set](i, this.serialize(x[keys[core.$get](i)])); | 124 values[core.$set](i, this.serialize(x[keys[core.$get](i)])); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 let classId = dart.as(dart.dindex(x, 1), core.String); | 342 let classId = dart.as(dart.dindex(x, 1), core.String); |
| 343 let fields = dart.as(dart.dindex(x, 2), core.List); | 343 let fields = dart.as(dart.dindex(x, 2), core.List); |
| 344 let instanceFromClassId = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embed
ded_names.INSTANCE_FROM_CLASS_ID); | 344 let instanceFromClassId = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embed
ded_names.INSTANCE_FROM_CLASS_ID); |
| 345 let initializeObject = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded
_names.INITIALIZE_EMPTY_INSTANCE); | 345 let initializeObject = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded
_names.INITIALIZE_EMPTY_INSTANCE); |
| 346 let emptyInstance = instanceFromClassId(classId); | 346 let emptyInstance = instanceFromClassId(classId); |
| 347 this.deserializedObjects[core.$add](emptyInstance); | 347 this.deserializedObjects[core.$add](emptyInstance); |
| 348 this.deserializeArrayInPlace(dart.as(fields, _interceptors.JSArray)); | 348 this.deserializeArrayInPlace(dart.as(fields, _interceptors.JSArray)); |
| 349 return initializeObject(classId, emptyInstance, fields); | 349 return initializeObject(classId, emptyInstance, fields); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.dyn
amic, [dart.dynamic])); |
| 352 // Function _callInIsolate: (_IsolateContext, Function) → dynamic | 353 // Function _callInIsolate: (_IsolateContext, Function) → dynamic |
| 353 function _callInIsolate(isolate, func) { | 354 function _callInIsolate(isolate, func) { |
| 354 let result = isolate.eval(func); | 355 let result = isolate.eval(func); |
| 355 exports._globalState.topEventLoop.run(); | 356 exports._globalState.topEventLoop.run(); |
| 356 return result; | 357 return result; |
| 357 } | 358 } |
| 358 let _activeJsAsyncCount = Symbol('_activeJsAsyncCount'); | 359 let _activeJsAsyncCount = Symbol('_activeJsAsyncCount'); |
| 359 // Function enterJsAsync: () → dynamic | 360 // Function enterJsAsync: () → dynamic |
| 360 function enterJsAsync() { | 361 function enterJsAsync() { |
| 361 let o = exports._globalState.topEventLoop; | 362 let o = exports._globalState.topEventLoop; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 let o = exports._globalState, x = o.nextIsolateId; | 488 let o = exports._globalState, x = o.nextIsolateId; |
| 488 o.nextIsolateId = dart.notNull(x) + 1; | 489 o.nextIsolateId = dart.notNull(x) + 1; |
| 489 return x; | 490 return x; |
| 490 })(); | 491 })(); |
| 491 this.ports = new (core.Map$(core.int, RawReceivePortImpl))(); | 492 this.ports = new (core.Map$(core.int, RawReceivePortImpl))(); |
| 492 this.weakPorts = new (core.Set$(core.int))(); | 493 this.weakPorts = new (core.Set$(core.int))(); |
| 493 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); | 494 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); |
| 494 this.controlPort = new RawReceivePortImpl[_controlPort](); | 495 this.controlPort = new RawReceivePortImpl[_controlPort](); |
| 495 this.pauseCapability = new isolate.Capability(); | 496 this.pauseCapability = new isolate.Capability(); |
| 496 this.terminateCapability = new isolate.Capability(); | 497 this.terminateCapability = new isolate.Capability(); |
| 497 this.delayedEvents = dart.as(new core.List.from([]), core.List$(_IsolateEv
ent)); | 498 this.delayedEvents = new core.List$(_IsolateEvent).from([]); |
| 498 this.pauseTokens = dart.as(new core.Set(), core.Set$(isolate.Capability)); | 499 this.pauseTokens = new (core.Set$(isolate.Capability))(); |
| 499 this.errorPorts = dart.as(new core.Set(), core.Set$(isolate.SendPort)); | 500 this.errorPorts = new (core.Set$(isolate.SendPort))(); |
| 500 this.initialized = false; | 501 this.initialized = false; |
| 501 this.isPaused = false; | 502 this.isPaused = false; |
| 502 this.doneHandlers = null; | 503 this.doneHandlers = null; |
| 503 this[_scheduledControlEvents] = null; | 504 this[_scheduledControlEvents] = null; |
| 504 this[_isExecutingEvent] = false; | 505 this[_isExecutingEvent] = false; |
| 505 this.errorsAreFatal = true; | 506 this.errorsAreFatal = true; |
| 506 this.registerWeak(this.controlPort[_id], this.controlPort); | 507 this.registerWeak(this.controlPort[_id], this.controlPort); |
| 507 } | 508 } |
| 508 addPause(authentification, resume) { | 509 addPause(authentification, resume) { |
| 509 if (!dart.equals(this.pauseCapability, authentification)) | 510 if (!dart.equals(this.pauseCapability, authentification)) |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 break; | 953 break; |
| 953 } | 954 } |
| 954 case 'error': | 955 case 'error': |
| 955 { | 956 { |
| 956 throw dart.dindex(msg, 'msg'); | 957 throw dart.dindex(msg, 'msg'); |
| 957 } | 958 } |
| 958 } | 959 } |
| 959 } | 960 } |
| 960 static handleSpawnWorkerRequest(msg) { | 961 static handleSpawnWorkerRequest(msg) { |
| 961 let replyPort = dart.dindex(msg, 'replyPort'); | 962 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 => { | 963 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(msg => { |
| 963 dart.dsend(replyPort, 'send', msg); | 964 dart.dsend(replyPort, 'send', msg); |
| 964 }, dart.functionType(dart.dynamic, [core.List])), { | 965 }, { |
| 965 onError: errorMessage => { | 966 onError: errorMessage => { |
| 966 dart.dsend(replyPort, 'send', new core.List.from([_SPAWN_FAILED_SIGNAL
, errorMessage])); | 967 dart.dsend(replyPort, 'send', new core.List.from([_SPAWN_FAILED_SIGNAL
, errorMessage])); |
| 967 } | 968 } |
| 968 }); | 969 }); |
| 969 } | 970 } |
| 970 static [_log](msg) { | 971 static [_log](msg) { |
| 971 if (exports._globalState.isWorker) { | 972 if (exports._globalState.isWorker) { |
| 972 exports._globalState.mainManager.postMessage(_serializeMessage(dart.map(
{command: 'log', msg: msg}))); | 973 exports._globalState.mainManager.postMessage(_serializeMessage(dart.map(
{command: 'log', msg: msg}))); |
| 973 } else { | 974 } else { |
| 974 try { | 975 try { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 IsolateNatives.enableSpawnWorker = true; | 1009 IsolateNatives.enableSpawnWorker = true; |
| 1009 let isLight = false; | 1010 let isLight = false; |
| 1010 let isSpawnUri = true; | 1011 let isSpawnUri = true; |
| 1011 return IsolateNatives.spawn(null, uri.toString(), args, message, isLight,
isSpawnUri, startPaused); | 1012 return IsolateNatives.spawn(null, uri.toString(), args, message, isLight,
isSpawnUri, startPaused); |
| 1012 } | 1013 } |
| 1013 static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPau
sed) { | 1014 static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPau
sed) { |
| 1014 if (uri != null && dart.notNull(uri.endsWith(".dart"))) { | 1015 if (uri != null && dart.notNull(uri.endsWith(".dart"))) { |
| 1015 uri = dart.notNull(uri) + ".js"; | 1016 uri = dart.notNull(uri) + ".js"; |
| 1016 } | 1017 } |
| 1017 let port = new isolate.ReceivePort(); | 1018 let port = new isolate.ReceivePort(); |
| 1018 let completer = dart.as(new async.Completer(), async.Completer$(core.List)
); | 1019 let completer = new (async.Completer$(core.List))(); |
| 1019 port.first.then(msg => { | 1020 port.first.then(msg => { |
| 1020 if (dart.equals(dart.dindex(msg, 0), _SPAWNED_SIGNAL)) { | 1021 if (dart.equals(dart.dindex(msg, 0), _SPAWNED_SIGNAL)) { |
| 1021 completer.complete(msg); | 1022 completer.complete(msg); |
| 1022 } else { | 1023 } else { |
| 1023 dart.assert(dart.equals(dart.dindex(msg, 0), _SPAWN_FAILED_SIGNAL)); | 1024 dart.assert(dart.equals(dart.dindex(msg, 0), _SPAWN_FAILED_SIGNAL)); |
| 1024 completer.completeError(dart.dindex(msg, 1)); | 1025 completer.completeError(dart.dindex(msg, 1)); |
| 1025 } | 1026 } |
| 1026 }); | 1027 }); |
| 1027 let signalReply = port.sendPort; | 1028 let signalReply = port.sendPort; |
| 1028 if (dart.notNull(exports._globalState.useWorkers) && !dart.notNull(isLight
)) { | 1029 if (dart.notNull(exports._globalState.useWorkers) && !dart.notNull(isLight
)) { |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 exports.leaveJsAsync = leaveJsAsync; | 1393 exports.leaveJsAsync = leaveJsAsync; |
| 1393 exports.isWorker = isWorker; | 1394 exports.isWorker = isWorker; |
| 1394 exports.startRootIsolate = startRootIsolate; | 1395 exports.startRootIsolate = startRootIsolate; |
| 1395 exports.IsolateNatives = IsolateNatives; | 1396 exports.IsolateNatives = IsolateNatives; |
| 1396 exports.RawReceivePortImpl = RawReceivePortImpl; | 1397 exports.RawReceivePortImpl = RawReceivePortImpl; |
| 1397 exports.ReceivePortImpl = ReceivePortImpl; | 1398 exports.ReceivePortImpl = ReceivePortImpl; |
| 1398 exports.TimerImpl = TimerImpl; | 1399 exports.TimerImpl = TimerImpl; |
| 1399 exports.hasTimer = hasTimer; | 1400 exports.hasTimer = hasTimer; |
| 1400 exports.CapabilityImpl = CapabilityImpl; | 1401 exports.CapabilityImpl = CapabilityImpl; |
| 1401 })(_isolate_helper || (_isolate_helper = {})); | 1402 })(_isolate_helper || (_isolate_helper = {})); |
| OLD | NEW |