Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Side by Side Diff: lib/runtime/dart/_isolate_helper.js

Issue 1121993004: Inference through conditional expressions (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_interceptors.js ('k') | lib/runtime/dart/_js_helper.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 static _getEventData(e) { 882 static _getEventData(e) {
883 return e.data; 883 return e.data;
884 } 884 }
885 static _processWorkerMessage(sender, e) { 885 static _processWorkerMessage(sender, e) {
886 let msg = _deserializeMessage(IsolateNatives._getEventData(e)); 886 let msg = _deserializeMessage(IsolateNatives._getEventData(e));
887 switch (dart.dindex(msg, 'command')) { 887 switch (dart.dindex(msg, 'command')) {
888 case 'start': 888 case 'start':
889 { 889 {
890 exports._globalState.currentManagerId = dart.as(dart.dindex(msg, 'id') , core.int); 890 exports._globalState.currentManagerId = dart.as(dart.dindex(msg, 'id') , core.int);
891 let functionName = dart.as(dart.dindex(msg, 'functionName'), core.Stri ng); 891 let functionName = dart.as(dart.dindex(msg, 'functionName'), core.Stri ng);
892 let entryPoint = dart.as(functionName == null ? exports._globalState.e ntry : IsolateNatives._getJSFunctionFromName(functionName), core.Function); 892 let entryPoint = functionName == null ? exports._globalState.entry : d art.as(IsolateNatives._getJSFunctionFromName(functionName), core.Function);
893 let args = dart.dindex(msg, 'args'); 893 let args = dart.dindex(msg, 'args');
894 let message = _deserializeMessage(dart.dindex(msg, 'msg')); 894 let message = _deserializeMessage(dart.dindex(msg, 'msg'));
895 let isSpawnUri = dart.dindex(msg, 'isSpawnUri'); 895 let isSpawnUri = dart.dindex(msg, 'isSpawnUri');
896 let startPaused = dart.dindex(msg, 'startPaused'); 896 let startPaused = dart.dindex(msg, 'startPaused');
897 let replyTo = _deserializeMessage(dart.dindex(msg, 'replyTo')); 897 let replyTo = _deserializeMessage(dart.dindex(msg, 'replyTo'));
898 let context = new _IsolateContext(); 898 let context = new _IsolateContext();
899 exports._globalState.topEventLoop.enqueue(context, () => { 899 exports._globalState.topEventLoop.enqueue(context, () => {
900 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)); 900 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));
901 }, 'worker-start'); 901 }, 'worker-start');
902 exports._globalState.currentContext = context; 902 exports._globalState.currentContext = context;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 } 970 }
971 static _consoleLog(msg) { 971 static _consoleLog(msg) {
972 _js_helper.requiresPreamble(); 972 _js_helper.requiresPreamble();
973 self.console.log(msg); 973 self.console.log(msg);
974 } 974 }
975 static _getJSFunctionFromName(functionName) { 975 static _getJSFunctionFromName(functionName) {
976 let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_ embedded_names.GLOBAL_FUNCTIONS); 976 let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_ embedded_names.GLOBAL_FUNCTIONS);
977 return globalFunctionsContainer[functionName](); 977 return globalFunctionsContainer[functionName]();
978 } 978 }
979 static _getJSFunctionName(f) { 979 static _getJSFunctionName(f) {
980 return dart.as(dart.is(f, _js_helper.Closure) ? f.$name : null, core.Strin g); 980 return dart.is(f, _js_helper.Closure) ? dart.as(f.$name, core.String) : nu ll;
981 } 981 }
982 static _allocate(ctor) { 982 static _allocate(ctor) {
983 return new ctor(); 983 return new ctor();
984 } 984 }
985 static spawnFunction(topLevelFunction, message, startPaused) { 985 static spawnFunction(topLevelFunction, message, startPaused) {
986 IsolateNatives.enableSpawnWorker = true; 986 IsolateNatives.enableSpawnWorker = true;
987 let name = IsolateNatives._getJSFunctionName(topLevelFunction); 987 let name = IsolateNatives._getJSFunctionName(topLevelFunction);
988 if (name == null) { 988 if (name == null) {
989 throw new core.UnsupportedError("only top-level functions can be spawned ."); 989 throw new core.UnsupportedError("only top-level functions can be spawned .");
990 } 990 }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 exports.leaveJsAsync = leaveJsAsync; 1378 exports.leaveJsAsync = leaveJsAsync;
1379 exports.isWorker = isWorker; 1379 exports.isWorker = isWorker;
1380 exports.startRootIsolate = startRootIsolate; 1380 exports.startRootIsolate = startRootIsolate;
1381 exports.IsolateNatives = IsolateNatives; 1381 exports.IsolateNatives = IsolateNatives;
1382 exports.RawReceivePortImpl = RawReceivePortImpl; 1382 exports.RawReceivePortImpl = RawReceivePortImpl;
1383 exports.ReceivePortImpl = ReceivePortImpl; 1383 exports.ReceivePortImpl = ReceivePortImpl;
1384 exports.TimerImpl = TimerImpl; 1384 exports.TimerImpl = TimerImpl;
1385 exports.hasTimer = hasTimer; 1385 exports.hasTimer = hasTimer;
1386 exports.CapabilityImpl = CapabilityImpl; 1386 exports.CapabilityImpl = CapabilityImpl;
1387 })(_isolate_helper || (_isolate_helper = {})); 1387 })(_isolate_helper || (_isolate_helper = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_interceptors.js ('k') | lib/runtime/dart/_js_helper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698