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

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

Issue 1122283002: fixes #158, precendence of call and access in new (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: redesgin 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/_internal.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);
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 _id = Symbol('_id');
23 let _receivePort = Symbol('_receivePort'); 23 let _receivePort = Symbol('_receivePort');
24 class _Serializer extends core.Object { 24 class _Serializer extends core.Object {
25 _Serializer(opts) { 25 _Serializer(opts) {
26 let serializeSendPorts = opts && 'serializeSendPorts' in opts ? opts.seria lizeSendPorts : true; 26 let serializeSendPorts = opts && 'serializeSendPorts' in opts ? opts.seria lizeSendPorts : true;
27 this.serializedObjectIds = new core.Map$(dart.dynamic, core.int).identity( ); 27 this.serializedObjectIds = new (core.Map$(dart.dynamic, core.int)).identit y();
28 this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool); 28 this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool);
29 } 29 }
30 serialize(x) { 30 serialize(x) {
31 if (this.isPrimitive(x)) 31 if (this.isPrimitive(x))
32 return this.serializePrimitive(x); 32 return this.serializePrimitive(x);
33 let serializationId = this.serializedObjectIds.get(x); 33 let serializationId = this.serializedObjectIds.get(x);
34 if (serializationId != null) 34 if (serializationId != null)
35 return this.makeRef(serializationId); 35 return this.makeRef(serializationId);
36 serializationId = this.serializedObjectIds.length; 36 serializationId = this.serializedObjectIds.length;
37 this.serializedObjectIds.set(x, serializationId); 37 this.serializedObjectIds.set(x, serializationId);
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 let signalReply = port.sendPort; 1015 let signalReply = port.sendPort;
1016 if (dart.notNull(exports._globalState.useWorkers) && !dart.notNull(isLight )) { 1016 if (dart.notNull(exports._globalState.useWorkers) && !dart.notNull(isLight )) {
1017 IsolateNatives._startWorker(functionName, uri, args, message, isSpawnUri , startPaused, signalReply, message => completer.completeError(message)); 1017 IsolateNatives._startWorker(functionName, uri, args, message, isSpawnUri , startPaused, signalReply, message => completer.completeError(message));
1018 } else { 1018 } else {
1019 IsolateNatives._startNonWorker(functionName, uri, args, message, isSpawn Uri, startPaused, signalReply); 1019 IsolateNatives._startNonWorker(functionName, uri, args, message, isSpawn Uri, startPaused, signalReply);
1020 } 1020 }
1021 return completer.future; 1021 return completer.future;
1022 } 1022 }
1023 static _startWorker(functionName, uri, args, message, isSpawnUri, startPause d, replyPort, onError) { 1023 static _startWorker(functionName, uri, args, message, isSpawnUri, startPause d, replyPort, onError) {
1024 if (args != null) 1024 if (args != null)
1025 args = new core.List$(core.String).from(args); 1025 args = new (core.List$(core.String)).from(args);
1026 if (exports._globalState.isWorker) { 1026 if (exports._globalState.isWorker) {
1027 exports._globalState.mainManager.postMessage(_serializeMessage(dart.map( {command: 'spawn-worker', functionName: functionName, args: args, msg: message, uri: uri, isSpawnUri: isSpawnUri, startPaused: startPaused, replyPort: replyPort }))); 1027 exports._globalState.mainManager.postMessage(_serializeMessage(dart.map( {command: 'spawn-worker', functionName: functionName, args: args, msg: message, uri: uri, isSpawnUri: isSpawnUri, startPaused: startPaused, replyPort: replyPort })));
1028 } else { 1028 } else {
1029 IsolateNatives._spawnWorker(functionName, uri, args, message, isSpawnUri , startPaused, replyPort, onError); 1029 IsolateNatives._spawnWorker(functionName, uri, args, message, isSpawnUri , startPaused, replyPort, onError);
1030 } 1030 }
1031 } 1031 }
1032 static _startNonWorker(functionName, uri, args, message, isSpawnUri, startPa used, replyPort) { 1032 static _startNonWorker(functionName, uri, args, message, isSpawnUri, startPa used, replyPort) {
1033 if (uri != null) { 1033 if (uri != null) {
1034 throw new core.UnsupportedError("Currently spawnUri is not supported wit hout web workers."); 1034 throw new core.UnsupportedError("Currently spawnUri is not supported wit hout web workers.");
1035 } 1035 }
1036 message = _clone(message); 1036 message = _clone(message);
1037 if (args != null) 1037 if (args != null)
1038 args = new core.List$(core.String).from(args); 1038 args = new (core.List$(core.String)).from(args);
1039 exports._globalState.topEventLoop.enqueue(new _IsolateContext(), () => { 1039 exports._globalState.topEventLoop.enqueue(new _IsolateContext(), () => {
1040 let func = IsolateNatives._getJSFunctionFromName(functionName); 1040 let func = IsolateNatives._getJSFunctionFromName(functionName);
1041 IsolateNatives._startIsolate(dart.as(func, core.Function), args, message , isSpawnUri, startPaused, replyPort); 1041 IsolateNatives._startIsolate(dart.as(func, core.Function), args, message , isSpawnUri, startPaused, replyPort);
1042 }, 'nonworker start'); 1042 }, 'nonworker start');
1043 } 1043 }
1044 static get currentIsolate() { 1044 static get currentIsolate() {
1045 let context = dart.as(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _Isola teContext); 1045 let context = dart.as(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT(), _Isola teContext);
1046 return new isolate.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability}); 1046 return new isolate.Isolate(context.controlPort.sendPort, {pauseCapability: context.pauseCapability, terminateCapability: context.terminateCapability});
1047 } 1047 }
1048 static _startIsolate(topLevel, args, message, isSpawnUri, startPaused, reply To) { 1048 static _startIsolate(topLevel, args, message, isSpawnUri, startPaused, reply To) {
(...skipping 329 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/_internal.js ('k') | lib/runtime/dart/_js_helper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698