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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 this.managers = new (core.Map$(core.int, dart.dynamic))(); | 438 this.managers = new (core.Map$(core.int, dart.dynamic))(); |
439 if (this.isWorker) { | 439 if (this.isWorker) { |
440 this.mainManager = new _MainManagerStub(); | 440 this.mainManager = new _MainManagerStub(); |
441 this[_nativeInitWorkerMessageHandler](); | 441 this[_nativeInitWorkerMessageHandler](); |
442 } | 442 } |
443 } | 443 } |
444 [_nativeDetectEnvironment]() { | 444 [_nativeDetectEnvironment]() { |
445 let isWindowDefined = exports.globalWindow != null; | 445 let isWindowDefined = exports.globalWindow != null; |
446 let isWorkerDefined = exports.globalWorker != null; | 446 let isWorkerDefined = exports.globalWorker != null; |
447 this.isWorker = !dart.notNull(isWindowDefined) && dart.notNull(exports.glo
balPostMessageDefined); | 447 this.isWorker = !dart.notNull(isWindowDefined) && dart.notNull(exports.glo
balPostMessageDefined); |
448 this.supportsWorkers = dart.notNull(this.isWorker) || dart.notNull(isWorke
rDefined) && dart.notNull(IsolateNatives.thisScript != null); | 448 this.supportsWorkers = dart.notNull(this.isWorker) || dart.notNull(isWorke
rDefined) && IsolateNatives.thisScript != null; |
449 this.fromCommandLine = !dart.notNull(isWindowDefined) && !dart.notNull(thi
s.isWorker); | 449 this.fromCommandLine = !dart.notNull(isWindowDefined) && !dart.notNull(thi
s.isWorker); |
450 } | 450 } |
451 [_nativeInitWorkerMessageHandler]() { | 451 [_nativeInitWorkerMessageHandler]() { |
452 let function$0 = function(f, a) { | 452 let function$0 = function(f, a) { |
453 return function(e) { | 453 return function(e) { |
454 f(a, e); | 454 f(a, e); |
455 }; | 455 }; |
456 }(_foreign_helper.DART_CLOSURE_TO_JS(IsolateNatives[_processWorkerMessage]
), this.mainManager); | 456 }(_foreign_helper.DART_CLOSURE_TO_JS(IsolateNatives[_processWorkerMessage]
), this.mainManager); |
457 self.onmessage = function$0; | 457 self.onmessage = function$0; |
458 self.dartPrint = self.dartPrint || function(serialize) { | 458 self.dartPrint = self.dartPrint || function(serialize) { |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 let isSpawnUri = false; | 1004 let isSpawnUri = false; |
1005 return IsolateNatives.spawn(name, null, null, message, isLight, isSpawnUri
, startPaused); | 1005 return IsolateNatives.spawn(name, null, null, message, isLight, isSpawnUri
, startPaused); |
1006 } | 1006 } |
1007 static spawnUri(uri, args, message, startPaused) { | 1007 static spawnUri(uri, args, message, startPaused) { |
1008 IsolateNatives.enableSpawnWorker = true; | 1008 IsolateNatives.enableSpawnWorker = true; |
1009 let isLight = false; | 1009 let isLight = false; |
1010 let isSpawnUri = true; | 1010 let isSpawnUri = true; |
1011 return IsolateNatives.spawn(null, uri.toString(), args, message, isLight,
isSpawnUri, startPaused); | 1011 return IsolateNatives.spawn(null, uri.toString(), args, message, isLight,
isSpawnUri, startPaused); |
1012 } | 1012 } |
1013 static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPau
sed) { | 1013 static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPau
sed) { |
1014 if (dart.notNull(uri != null) && dart.notNull(uri.endsWith(".dart"))) { | 1014 if (uri != null && dart.notNull(uri.endsWith(".dart"))) { |
1015 uri = core.String['+'](uri, ".js"); | 1015 uri = dart.notNull(uri) + ".js"; |
1016 } | 1016 } |
1017 let port = new isolate.ReceivePort(); | 1017 let port = new isolate.ReceivePort(); |
1018 let completer = dart.as(new async.Completer(), async.Completer$(core.List)
); | 1018 let completer = dart.as(new async.Completer(), async.Completer$(core.List)
); |
1019 port.first.then(msg => { | 1019 port.first.then(msg => { |
1020 if (dart.equals(dart.dindex(msg, 0), _SPAWNED_SIGNAL)) { | 1020 if (dart.equals(dart.dindex(msg, 0), _SPAWNED_SIGNAL)) { |
1021 completer.complete(msg); | 1021 completer.complete(msg); |
1022 } else { | 1022 } else { |
1023 dart.assert(dart.equals(dart.dindex(msg, 0), _SPAWN_FAILED_SIGNAL)); | 1023 dart.assert(dart.equals(dart.dindex(msg, 0), _SPAWN_FAILED_SIGNAL)); |
1024 completer.completeError(dart.dindex(msg, 1)); | 1024 completer.completeError(dart.dindex(msg, 1)); |
1025 } | 1025 } |
(...skipping 366 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 |