OLD | NEW |
1 dart_library.library('dart/_isolate_helper', null, /* Imports */[ | 1 dart_library.library('dart/_isolate_helper', null, /* Imports */[ |
2 "dart/_runtime", | 2 "dart/_runtime", |
3 'dart/core', | 3 'dart/core', |
4 'dart/_interceptors', | 4 'dart/_interceptors', |
5 'dart/_js_helper', | 5 'dart/_js_helper', |
6 'dart/isolate', | 6 'dart/isolate', |
7 'dart/_foreign_helper', | 7 'dart/_foreign_helper', |
8 'dart/collection', | 8 'dart/collection', |
9 'dart/async' | 9 'dart/async' |
10 ], /* Lazy imports */[ | 10 ], /* Lazy imports */[ |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 static _getEventData(e) { | 952 static _getEventData(e) { |
953 return e.data; | 953 return e.data; |
954 } | 954 } |
955 static _processWorkerMessage(sender, e) { | 955 static _processWorkerMessage(sender, e) { |
956 let msg = _deserializeMessage(IsolateNatives._getEventData(e)); | 956 let msg = _deserializeMessage(IsolateNatives._getEventData(e)); |
957 switch (dart.dindex(msg, 'command')) { | 957 switch (dart.dindex(msg, 'command')) { |
958 case 'start': | 958 case 'start': |
959 { | 959 { |
960 exports._globalState.currentManagerId = dart.as(dart.dindex(msg, 'id')
, core.int); | 960 exports._globalState.currentManagerId = dart.as(dart.dindex(msg, 'id')
, core.int); |
961 let functionName = dart.as(dart.dindex(msg, 'functionName'), core.Stri
ng); | 961 let functionName = dart.as(dart.dindex(msg, 'functionName'), core.Stri
ng); |
962 let entryPoint = functionName == null ? exports._globalState.entry : d
art.as(IsolateNatives._getJSFunctionFromName(functionName), core.Function); | 962 let entryPoint = dart.as(functionName == null ? exports._globalState.e
ntry : IsolateNatives._getJSFunctionFromName(functionName), core.Function); |
963 let args = dart.dindex(msg, 'args'); | 963 let args = dart.dindex(msg, 'args'); |
964 let message = _deserializeMessage(dart.dindex(msg, 'msg')); | 964 let message = _deserializeMessage(dart.dindex(msg, 'msg')); |
965 let isSpawnUri = dart.dindex(msg, 'isSpawnUri'); | 965 let isSpawnUri = dart.dindex(msg, 'isSpawnUri'); |
966 let startPaused = dart.dindex(msg, 'startPaused'); | 966 let startPaused = dart.dindex(msg, 'startPaused'); |
967 let replyTo = _deserializeMessage(dart.dindex(msg, 'replyTo')); | 967 let replyTo = _deserializeMessage(dart.dindex(msg, 'replyTo')); |
968 let context = new _IsolateContext(); | 968 let context = new _IsolateContext(); |
969 exports._globalState.topEventLoop.enqueue(context, dart.fn(() => { | 969 exports._globalState.topEventLoop.enqueue(context, dart.fn(() => { |
970 IsolateNatives._startIsolate(entryPoint, dart.as(args, core.List$(co
re.String)), message, dart.as(isSpawnUri, core.bool), dart.as(startPaused, core.
bool), dart.as(replyTo, isolate.SendPort)); | 970 IsolateNatives._startIsolate(entryPoint, dart.as(args, core.List$(co
re.String)), message, dart.as(isSpawnUri, core.bool), dart.as(startPaused, core.
bool), dart.as(replyTo, isolate.SendPort)); |
971 }), 'worker-start'); | 971 }), 'worker-start'); |
972 exports._globalState.currentContext = context; | 972 exports._globalState.currentContext = context; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 case 'error': | 1011 case 'error': |
1012 { | 1012 { |
1013 dart.throw(dart.dindex(msg, 'msg')); | 1013 dart.throw(dart.dindex(msg, 'msg')); |
1014 } | 1014 } |
1015 } | 1015 } |
1016 } | 1016 } |
1017 static handleSpawnWorkerRequest(msg) { | 1017 static handleSpawnWorkerRequest(msg) { |
1018 let replyPort = dart.dindex(msg, 'replyPort'); | 1018 let replyPort = dart.dindex(msg, 'replyPort'); |
1019 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.fn(msg => { | 1019 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.fn(msg => { |
1020 dart.dsend(replyPort, 'send', msg); | 1020 dart.dsend(replyPort, 'send', msg); |
1021 }), {onError: dart.fn(errorMessage => { | 1021 }, dart.dynamic, [core.List]), {onError: dart.fn(errorMessage => { |
1022 dart.dsend(replyPort, 'send', [_SPAWN_FAILED_SIGNAL, errorMessage]); | 1022 dart.dsend(replyPort, 'send', [_SPAWN_FAILED_SIGNAL, errorMessage]); |
1023 }, dart.dynamic, [core.String])}); | 1023 }, dart.dynamic, [core.String])}); |
1024 } | 1024 } |
1025 static _log(msg) { | 1025 static _log(msg) { |
1026 if (dart.notNull(exports._globalState.isWorker)) { | 1026 if (dart.notNull(exports._globalState.isWorker)) { |
1027 exports._globalState.mainManager.postMessage(_serializeMessage(dart.map(
{command: 'log', msg: msg}))); | 1027 exports._globalState.mainManager.postMessage(_serializeMessage(dart.map(
{command: 'log', msg: msg}))); |
1028 } else { | 1028 } else { |
1029 try { | 1029 try { |
1030 IsolateNatives._consoleLog(msg); | 1030 IsolateNatives._consoleLog(msg); |
1031 } catch (e) { | 1031 } catch (e) { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 exports.leaveJsAsync = leaveJsAsync; | 1508 exports.leaveJsAsync = leaveJsAsync; |
1509 exports.isWorker = isWorker; | 1509 exports.isWorker = isWorker; |
1510 exports.startRootIsolate = startRootIsolate; | 1510 exports.startRootIsolate = startRootIsolate; |
1511 exports.IsolateNatives = IsolateNatives; | 1511 exports.IsolateNatives = IsolateNatives; |
1512 exports.RawReceivePortImpl = RawReceivePortImpl; | 1512 exports.RawReceivePortImpl = RawReceivePortImpl; |
1513 exports.ReceivePortImpl = ReceivePortImpl; | 1513 exports.ReceivePortImpl = ReceivePortImpl; |
1514 exports.TimerImpl = TimerImpl; | 1514 exports.TimerImpl = TimerImpl; |
1515 exports.hasTimer = hasTimer; | 1515 exports.hasTimer = hasTimer; |
1516 exports.CapabilityImpl = CapabilityImpl; | 1516 exports.CapabilityImpl = CapabilityImpl; |
1517 }); | 1517 }); |
OLD | NEW |