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

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

Issue 1047203002: compute interfaces lazily (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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);
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 722 }
723 this.doneHandlers = null; 723 this.doneHandlers = null;
724 } 724 }
725 } 725 }
726 unregister(portId) { 726 unregister(portId) {
727 this.ports.remove(portId); 727 this.ports.remove(portId);
728 this.weakPorts.remove(portId); 728 this.weakPorts.remove(portId);
729 this[_updateGlobalState](); 729 this[_updateGlobalState]();
730 } 730 }
731 } 731 }
732 _IsolateContext[dart.implements] = [_foreign_helper.IsolateContext]; 732 _IsolateContext[dart.implements] = () => [_foreign_helper.IsolateContext];
733 let _runHelper = Symbol('_runHelper'); 733 let _runHelper = Symbol('_runHelper');
734 class _EventLoop extends core.Object { 734 class _EventLoop extends core.Object {
735 _EventLoop() { 735 _EventLoop() {
736 this.events = new collection.Queue(); 736 this.events = new collection.Queue();
737 this[_activeJsAsyncCount] = 0; 737 this[_activeJsAsyncCount] = 0;
738 } 738 }
739 enqueue(isolate, fn, msg) { 739 enqueue(isolate, fn, msg) {
740 this.events.addLast(new _IsolateEvent(dart.as(isolate, _IsolateContext), d art.as(fn, core.Function), dart.as(msg, core.String))); 740 this.events.addLast(new _IsolateEvent(dart.as(isolate, _IsolateContext), d art.as(fn, core.Function), dart.as(msg, core.String)));
741 } 741 }
742 prequeue(event) { 742 prequeue(event) {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 class _BaseSendPort extends core.Object { 1118 class _BaseSendPort extends core.Object {
1119 _BaseSendPort(isolateId$) { 1119 _BaseSendPort(isolateId$) {
1120 this[_isolateId] = isolateId$; 1120 this[_isolateId] = isolateId$;
1121 } 1121 }
1122 [_checkReplyTo](replyTo) { 1122 [_checkReplyTo](replyTo) {
1123 if (dart.notNull(replyTo != null) && dart.notNull(!dart.is(replyTo, _Nativ eJsSendPort)) && dart.notNull(!dart.is(replyTo, _WorkerSendPort))) { 1123 if (dart.notNull(replyTo != null) && dart.notNull(!dart.is(replyTo, _Nativ eJsSendPort)) && dart.notNull(!dart.is(replyTo, _WorkerSendPort))) {
1124 throw new core.Exception("SendPort.send: Illegal replyTo port type"); 1124 throw new core.Exception("SendPort.send: Illegal replyTo port type");
1125 } 1125 }
1126 } 1126 }
1127 } 1127 }
1128 _BaseSendPort[dart.implements] = [isolate.SendPort]; 1128 _BaseSendPort[dart.implements] = () => [isolate.SendPort];
1129 let _isClosed = Symbol('_isClosed'); 1129 let _isClosed = Symbol('_isClosed');
1130 class _NativeJsSendPort extends _BaseSendPort { 1130 class _NativeJsSendPort extends _BaseSendPort {
1131 _NativeJsSendPort(receivePort$, isolateId) { 1131 _NativeJsSendPort(receivePort$, isolateId) {
1132 this[_receivePort] = receivePort$; 1132 this[_receivePort] = receivePort$;
1133 super._BaseSendPort(isolateId); 1133 super._BaseSendPort(isolateId);
1134 } 1134 }
1135 send(message) { 1135 send(message) {
1136 let isolate = exports._globalState.isolates.get(this[_isolateId]); 1136 let isolate = exports._globalState.isolates.get(this[_isolateId]);
1137 if (isolate == null) 1137 if (isolate == null)
1138 return; 1138 return;
(...skipping 10 matching lines...) Expand all
1149 } 1149 }
1150 }).bind(this), `receive ${message}`); 1150 }).bind(this), `receive ${message}`);
1151 } 1151 }
1152 ['=='](other) { 1152 ['=='](other) {
1153 return dart.notNull(dart.is(other, _NativeJsSendPort)) && dart.notNull(dar t.equals(this[_receivePort], dart.dload(other, '_receivePort'))); 1153 return dart.notNull(dart.is(other, _NativeJsSendPort)) && dart.notNull(dar t.equals(this[_receivePort], dart.dload(other, '_receivePort')));
1154 } 1154 }
1155 get hashCode() { 1155 get hashCode() {
1156 return this[_receivePort][_id]; 1156 return this[_receivePort][_id];
1157 } 1157 }
1158 } 1158 }
1159 _NativeJsSendPort[dart.implements] = [isolate.SendPort]; 1159 _NativeJsSendPort[dart.implements] = () => [isolate.SendPort];
1160 class _WorkerSendPort extends _BaseSendPort { 1160 class _WorkerSendPort extends _BaseSendPort {
1161 _WorkerSendPort(workerId$, isolateId, receivePortId$) { 1161 _WorkerSendPort(workerId$, isolateId, receivePortId$) {
1162 this[_workerId] = workerId$; 1162 this[_workerId] = workerId$;
1163 this[_receivePortId] = receivePortId$; 1163 this[_receivePortId] = receivePortId$;
1164 super._BaseSendPort(isolateId); 1164 super._BaseSendPort(isolateId);
1165 } 1165 }
1166 send(message) { 1166 send(message) {
1167 let workerMessage = _serializeMessage(dart.map({command: 'message', port: this, msg: message})); 1167 let workerMessage = _serializeMessage(dart.map({command: 'message', port: this, msg: message}));
1168 if (exports._globalState.isWorker) { 1168 if (exports._globalState.isWorker) {
1169 exports._globalState.mainManager.postMessage(workerMessage); 1169 exports._globalState.mainManager.postMessage(workerMessage);
1170 } else { 1170 } else {
1171 let manager = exports._globalState.managers.get(this[_workerId]); 1171 let manager = exports._globalState.managers.get(this[_workerId]);
1172 if (manager != null) { 1172 if (manager != null) {
1173 manager.postMessage(workerMessage); 1173 manager.postMessage(workerMessage);
1174 } 1174 }
1175 } 1175 }
1176 } 1176 }
1177 ['=='](other) { 1177 ['=='](other) {
1178 return dart.notNull(dart.is(other, _WorkerSendPort)) && dart.equals(this[_ workerId], dart.dload(other, '_workerId')) && dart.equals(this[_isolateId], dart .dload(other, '_isolateId')) && dart.equals(this[_receivePortId], dart.dload(oth er, '_receivePortId')); 1178 return dart.notNull(dart.is(other, _WorkerSendPort)) && dart.equals(this[_ workerId], dart.dload(other, '_workerId')) && dart.equals(this[_isolateId], dart .dload(other, '_isolateId')) && dart.equals(this[_receivePortId], dart.dload(oth er, '_receivePortId'));
1179 } 1179 }
1180 get hashCode() { 1180 get hashCode() {
1181 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId] ) << 8 ^ dart.notNull(this[_receivePortId]); 1181 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId] ) << 8 ^ dart.notNull(this[_receivePortId]);
1182 } 1182 }
1183 } 1183 }
1184 _WorkerSendPort[dart.implements] = [isolate.SendPort]; 1184 _WorkerSendPort[dart.implements] = () => [isolate.SendPort];
1185 let _handler = Symbol('_handler'); 1185 let _handler = Symbol('_handler');
1186 let _nextFreeId = Symbol('_nextFreeId'); 1186 let _nextFreeId = Symbol('_nextFreeId');
1187 let _close = Symbol('_close'); 1187 let _close = Symbol('_close');
1188 let _add = Symbol('_add'); 1188 let _add = Symbol('_add');
1189 class RawReceivePortImpl extends core.Object { 1189 class RawReceivePortImpl extends core.Object {
1190 RawReceivePortImpl(handler) { 1190 RawReceivePortImpl(handler) {
1191 this[_handler] = handler; 1191 this[_handler] = handler;
1192 this[_id] = ((x$) => RawReceivePortImpl[_nextFreeId] = dart.notNull(x$) + 1, x$)(RawReceivePortImpl[_nextFreeId]); 1192 this[_id] = ((x$) => RawReceivePortImpl[_nextFreeId] = dart.notNull(x$) + 1, x$)(RawReceivePortImpl[_nextFreeId]);
1193 this[_isClosed] = false; 1193 this[_isClosed] = false;
1194 exports._globalState.currentContext.register(this[_id], this); 1194 exports._globalState.currentContext.register(this[_id], this);
(...skipping 25 matching lines...) Expand all
1220 } 1220 }
1221 [_add](dataEvent) { 1221 [_add](dataEvent) {
1222 if (this[_isClosed]) 1222 if (this[_isClosed])
1223 return; 1223 return;
1224 dart.dinvokef(this[_handler], dataEvent); 1224 dart.dinvokef(this[_handler], dataEvent);
1225 } 1225 }
1226 get sendPort() { 1226 get sendPort() {
1227 return new _NativeJsSendPort(this, exports._globalState.currentContext.id) ; 1227 return new _NativeJsSendPort(this, exports._globalState.currentContext.id) ;
1228 } 1228 }
1229 } 1229 }
1230 RawReceivePortImpl[dart.implements] = [isolate.RawReceivePort]; 1230 RawReceivePortImpl[dart.implements] = () => [isolate.RawReceivePort];
1231 dart.defineNamedConstructor(RawReceivePortImpl, 'weak'); 1231 dart.defineNamedConstructor(RawReceivePortImpl, 'weak');
1232 dart.defineNamedConstructor(RawReceivePortImpl, _controlPort); 1232 dart.defineNamedConstructor(RawReceivePortImpl, _controlPort);
1233 RawReceivePortImpl._nextFreeId = 1; 1233 RawReceivePortImpl._nextFreeId = 1;
1234 let _rawPort = Symbol('_rawPort'); 1234 let _rawPort = Symbol('_rawPort');
1235 let _controller = Symbol('_controller'); 1235 let _controller = Symbol('_controller');
1236 class ReceivePortImpl extends async.Stream { 1236 class ReceivePortImpl extends async.Stream {
1237 ReceivePortImpl() { 1237 ReceivePortImpl() {
1238 this.fromRawReceivePort(new RawReceivePortImpl(null)); 1238 this.fromRawReceivePort(new RawReceivePortImpl(null));
1239 } 1239 }
1240 weak() { 1240 weak() {
(...skipping 13 matching lines...) Expand all
1254 return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError}); 1254 return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
1255 } 1255 }
1256 close() { 1256 close() {
1257 this[_rawPort].close(); 1257 this[_rawPort].close();
1258 this[_controller].close(); 1258 this[_controller].close();
1259 } 1259 }
1260 get sendPort() { 1260 get sendPort() {
1261 return this[_rawPort].sendPort; 1261 return this[_rawPort].sendPort;
1262 } 1262 }
1263 } 1263 }
1264 ReceivePortImpl[dart.implements] = [isolate.ReceivePort]; 1264 ReceivePortImpl[dart.implements] = () => [isolate.ReceivePort];
1265 dart.defineNamedConstructor(ReceivePortImpl, 'weak'); 1265 dart.defineNamedConstructor(ReceivePortImpl, 'weak');
1266 dart.defineNamedConstructor(ReceivePortImpl, 'fromRawReceivePort'); 1266 dart.defineNamedConstructor(ReceivePortImpl, 'fromRawReceivePort');
1267 let _once = Symbol('_once'); 1267 let _once = Symbol('_once');
1268 let _inEventLoop = Symbol('_inEventLoop'); 1268 let _inEventLoop = Symbol('_inEventLoop');
1269 let _handle = Symbol('_handle'); 1269 let _handle = Symbol('_handle');
1270 class TimerImpl extends core.Object { 1270 class TimerImpl extends core.Object {
1271 TimerImpl(milliseconds, callback) { 1271 TimerImpl(milliseconds, callback) {
1272 this[_once] = true; 1272 this[_once] = true;
1273 this[_inEventLoop] = false; 1273 this[_inEventLoop] = false;
1274 this[_handle] = null; 1274 this[_handle] = null;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 } 1323 }
1324 this[_handle] = null; 1324 this[_handle] = null;
1325 } else { 1325 } else {
1326 throw new core.UnsupportedError("Canceling a timer."); 1326 throw new core.UnsupportedError("Canceling a timer.");
1327 } 1327 }
1328 } 1328 }
1329 get isActive() { 1329 get isActive() {
1330 return this[_handle] != null; 1330 return this[_handle] != null;
1331 } 1331 }
1332 } 1332 }
1333 TimerImpl[dart.implements] = [async.Timer]; 1333 TimerImpl[dart.implements] = () => [async.Timer];
1334 dart.defineNamedConstructor(TimerImpl, 'periodic'); 1334 dart.defineNamedConstructor(TimerImpl, 'periodic');
1335 // Function hasTimer: () → bool 1335 // Function hasTimer: () → bool
1336 function hasTimer() { 1336 function hasTimer() {
1337 _js_helper.requiresPreamble(); 1337 _js_helper.requiresPreamble();
1338 return self.setTimeout != null; 1338 return self.setTimeout != null;
1339 } 1339 }
1340 let _internal = Symbol('_internal'); 1340 let _internal = Symbol('_internal');
1341 class CapabilityImpl extends core.Object { 1341 class CapabilityImpl extends core.Object {
1342 CapabilityImpl() { 1342 CapabilityImpl() {
1343 this[_internal](_js_helper.random64()); 1343 this[_internal](_js_helper.random64());
(...skipping 14 matching lines...) Expand all
1358 } 1358 }
1359 ['=='](other) { 1359 ['=='](other) {
1360 if (core.identical(other, this)) 1360 if (core.identical(other, this))
1361 return true; 1361 return true;
1362 if (dart.is(other, CapabilityImpl)) { 1362 if (dart.is(other, CapabilityImpl)) {
1363 return core.identical(this[_id], other[_id]); 1363 return core.identical(this[_id], other[_id]);
1364 } 1364 }
1365 return false; 1365 return false;
1366 } 1366 }
1367 } 1367 }
1368 CapabilityImpl[dart.implements] = [isolate.Capability]; 1368 CapabilityImpl[dart.implements] = () => [isolate.Capability];
1369 dart.defineNamedConstructor(CapabilityImpl, _internal); 1369 dart.defineNamedConstructor(CapabilityImpl, _internal);
1370 // Exports: 1370 // Exports:
1371 exports.enterJsAsync = enterJsAsync; 1371 exports.enterJsAsync = enterJsAsync;
1372 exports.leaveJsAsync = leaveJsAsync; 1372 exports.leaveJsAsync = leaveJsAsync;
1373 exports.isWorker = isWorker; 1373 exports.isWorker = isWorker;
1374 exports.startRootIsolate = startRootIsolate; 1374 exports.startRootIsolate = startRootIsolate;
1375 exports.IsolateNatives = IsolateNatives; 1375 exports.IsolateNatives = IsolateNatives;
1376 exports.RawReceivePortImpl = RawReceivePortImpl; 1376 exports.RawReceivePortImpl = RawReceivePortImpl;
1377 exports.ReceivePortImpl = ReceivePortImpl; 1377 exports.ReceivePortImpl = ReceivePortImpl;
1378 exports.TimerImpl = TimerImpl; 1378 exports.TimerImpl = TimerImpl;
1379 exports.hasTimer = hasTimer; 1379 exports.hasTimer = hasTimer;
1380 exports.CapabilityImpl = CapabilityImpl; 1380 exports.CapabilityImpl = CapabilityImpl;
1381 })(_isolate_helper || (_isolate_helper = {})); 1381 })(_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