| OLD | NEW |
| 1 var _isolate_helper = dart.defineLibrary(_isolate_helper, {}); | 1 var _isolate_helper = dart.defineLibrary(_isolate_helper, {}); |
| 2 var core = dart.import(core); | 2 var core = dart.import(core); |
| 3 var _native_typed_data = dart.import(_native_typed_data); | 3 var _native_typed_data = dart.import(_native_typed_data); |
| 4 var _interceptors = dart.lazyImport(_interceptors); | 4 var _interceptors = dart.import(_interceptors); |
| 5 var _js_helper = dart.lazyImport(_js_helper); | 5 var _js_helper = dart.import(_js_helper); |
| 6 var isolate = dart.import(isolate); | 6 var isolate = dart.import(isolate); |
| 7 var _foreign_helper = dart.import(_foreign_helper); | 7 var _foreign_helper = dart.import(_foreign_helper); |
| 8 var _js_embedded_names = dart.import(_js_embedded_names); | 8 var _js_embedded_names = dart.import(_js_embedded_names); |
| 9 var collection = dart.import(collection); | 9 var collection = dart.import(collection); |
| 10 var async = dart.import(async); | 10 var async = dart.import(async); |
| 11 (function(exports, core, _native_typed_data, _interceptors, _js_helper, isolate,
_foreign_helper, _js_embedded_names, collection, async) { | 11 (function(exports, core, _native_typed_data, _interceptors, _js_helper, isolate,
_foreign_helper, _js_embedded_names, collection, async) { |
| 12 'use strict'; | 12 'use strict'; |
| 13 function _serializeMessage(message) { | 13 function _serializeMessage(message) { |
| 14 return new _Serializer().serialize(message); | 14 return new _Serializer().serialize(message); |
| 15 } | 15 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return this.serializeJSObject(dart.as(x, _interceptors.JSObject)); | 56 return this.serializeJSObject(dart.as(x, _interceptors.JSObject)); |
| 57 if (dart.is(x, _interceptors.Interceptor)) | 57 if (dart.is(x, _interceptors.Interceptor)) |
| 58 this.unsupported(x); | 58 this.unsupported(x); |
| 59 if (dart.is(x, isolate.RawReceivePort)) { | 59 if (dart.is(x, isolate.RawReceivePort)) { |
| 60 this.unsupported(x, "RawReceivePorts can't be transmitted:"); | 60 this.unsupported(x, "RawReceivePorts can't be transmitted:"); |
| 61 } | 61 } |
| 62 if (dart.is(x, _NativeJsSendPort)) | 62 if (dart.is(x, _NativeJsSendPort)) |
| 63 return this.serializeJsSendPort(dart.as(x, _NativeJsSendPort)); | 63 return this.serializeJsSendPort(dart.as(x, _NativeJsSendPort)); |
| 64 if (dart.is(x, _WorkerSendPort)) | 64 if (dart.is(x, _WorkerSendPort)) |
| 65 return this.serializeWorkerSendPort(dart.as(x, _WorkerSendPort)); | 65 return this.serializeWorkerSendPort(dart.as(x, _WorkerSendPort)); |
| 66 if (dart.is(x, _js_helper.Closure)) | 66 if (dart.is(x, core.Function)) |
| 67 return this.serializeClosure(dart.as(x, _js_helper.Closure)); | 67 return this.serializeClosure(dart.as(x, core.Function)); |
| 68 return this.serializeDartObject(x); | 68 return this.serializeDartObject(x); |
| 69 } | 69 } |
| 70 unsupported(x, message) { | 70 unsupported(x, message) { |
| 71 if (message === void 0) | 71 if (message === void 0) |
| 72 message = null; | 72 message = null; |
| 73 if (message == null) | 73 if (message == null) |
| 74 message = "Can't transmit:"; | 74 message = "Can't transmit:"; |
| 75 throw new core.UnsupportedError(`${message} ${x}`); | 75 throw new core.UnsupportedError(`${message} ${x}`); |
| 76 } | 76 } |
| 77 makeRef(serializationId) { | 77 makeRef(serializationId) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 serializeByteBuffer: [core.Object, [_native_typed_data.NativeByteBuffer]], | 175 serializeByteBuffer: [core.Object, [_native_typed_data.NativeByteBuffer]], |
| 176 serializeTypedData: [core.Object, [_native_typed_data.NativeTypedData]], | 176 serializeTypedData: [core.Object, [_native_typed_data.NativeTypedData]], |
| 177 serializeJSIndexable: [core.Object, [_interceptors.JSIndexable]], | 177 serializeJSIndexable: [core.Object, [_interceptors.JSIndexable]], |
| 178 serializeArray: [core.Object, [_interceptors.JSArray]], | 178 serializeArray: [core.Object, [_interceptors.JSArray]], |
| 179 serializeArrayInPlace: [core.Object, [_interceptors.JSArray]], | 179 serializeArrayInPlace: [core.Object, [_interceptors.JSArray]], |
| 180 serializeMap: [core.Object, [core.Map]], | 180 serializeMap: [core.Object, [core.Map]], |
| 181 serializeJSObject: [core.Object, [_interceptors.JSObject]], | 181 serializeJSObject: [core.Object, [_interceptors.JSObject]], |
| 182 serializeWorkerSendPort: [core.Object, [_WorkerSendPort]], | 182 serializeWorkerSendPort: [core.Object, [_WorkerSendPort]], |
| 183 serializeJsSendPort: [core.Object, [_NativeJsSendPort]], | 183 serializeJsSendPort: [core.Object, [_NativeJsSendPort]], |
| 184 serializeCapability: [core.Object, [CapabilityImpl]], | 184 serializeCapability: [core.Object, [CapabilityImpl]], |
| 185 serializeClosure: [core.Object, [_js_helper.Closure]], | 185 serializeClosure: [core.Object, [core.Function]], |
| 186 serializeDartObject: [core.Object, [core.Object]] | 186 serializeDartObject: [core.Object, [core.Object]] |
| 187 }) | 187 }) |
| 188 }); | 188 }); |
| 189 let _adjustSendPorts = Symbol('_adjustSendPorts'); | 189 let _adjustSendPorts = Symbol('_adjustSendPorts'); |
| 190 class _Deserializer extends core.Object { | 190 class _Deserializer extends core.Object { |
| 191 _Deserializer(opts) { | 191 _Deserializer(opts) { |
| 192 let adjustSendPorts = opts && 'adjustSendPorts' in opts ? opts.adjustSendP
orts : true; | 192 let adjustSendPorts = opts && 'adjustSendPorts' in opts ? opts.adjustSendP
orts : true; |
| 193 this.deserializedObjects = core.List.new(); | 193 this.deserializedObjects = core.List.new(); |
| 194 this[_adjustSendPorts] = dart.as(adjustSendPorts, core.bool); | 194 this[_adjustSendPorts] = dart.as(adjustSendPorts, core.bool); |
| 195 } | 195 } |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 } | 908 } |
| 909 this.isolate.eval(this.fn); | 909 this.isolate.eval(this.fn); |
| 910 } | 910 } |
| 911 } | 911 } |
| 912 dart.setSignature(_IsolateEvent, { | 912 dart.setSignature(_IsolateEvent, { |
| 913 constructors: () => ({_IsolateEvent: [_IsolateEvent, [_IsolateContext, core.
Function, core.String]]}), | 913 constructors: () => ({_IsolateEvent: [_IsolateEvent, [_IsolateContext, core.
Function, core.String]]}), |
| 914 methods: () => ({process: [dart.void, []]}) | 914 methods: () => ({process: [dart.void, []]}) |
| 915 }); | 915 }); |
| 916 class _MainManagerStub extends core.Object { | 916 class _MainManagerStub extends core.Object { |
| 917 postMessage(msg) { | 917 postMessage(msg) { |
| 918 _js_helper.requiresPreamble(); | |
| 919 self.postMessage(msg); | 918 self.postMessage(msg); |
| 920 } | 919 } |
| 921 } | 920 } |
| 922 dart.setSignature(_MainManagerStub, { | 921 dart.setSignature(_MainManagerStub, { |
| 923 methods: () => ({postMessage: [dart.void, [core.Object]]}) | 922 methods: () => ({postMessage: [dart.void, [core.Object]]}) |
| 924 }); | 923 }); |
| 925 let _SPAWNED_SIGNAL = "spawned"; | 924 let _SPAWNED_SIGNAL = "spawned"; |
| 926 let _SPAWN_FAILED_SIGNAL = "spawn failed"; | 925 let _SPAWN_FAILED_SIGNAL = "spawn failed"; |
| 927 dart.copyProperties(exports, { | 926 dart.copyProperties(exports, { |
| 928 get globalWindow() { | 927 get globalWindow() { |
| 929 _js_helper.requiresPreamble(); | |
| 930 return self.window; | 928 return self.window; |
| 931 }, | 929 }, |
| 932 get globalWorker() { | 930 get globalWorker() { |
| 933 _js_helper.requiresPreamble(); | |
| 934 return self.Worker; | 931 return self.Worker; |
| 935 }, | 932 }, |
| 936 get globalPostMessageDefined() { | 933 get globalPostMessageDefined() { |
| 937 _js_helper.requiresPreamble(); | |
| 938 return !!self.postMessage; | 934 return !!self.postMessage; |
| 939 } | 935 } |
| 940 }); | 936 }); |
| 941 let _MainFunction = dart.typedef('_MainFunction', () => dart.functionType(core
.Object, [])); | 937 let _MainFunction = dart.typedef('_MainFunction', () => dart.functionType(core
.Object, [])); |
| 942 let _MainFunctionArgs = dart.typedef('_MainFunctionArgs', () => dart.functionT
ype(core.Object, [dart.bottom])); | 938 let _MainFunctionArgs = dart.typedef('_MainFunctionArgs', () => dart.functionT
ype(core.Object, [dart.bottom])); |
| 943 let _MainFunctionArgsMessage = dart.typedef('_MainFunctionArgsMessage', () =>
dart.functionType(core.Object, [dart.bottom, dart.bottom])); | 939 let _MainFunctionArgsMessage = dart.typedef('_MainFunctionArgsMessage', () =>
dart.functionType(core.Object, [dart.bottom, dart.bottom])); |
| 944 class IsolateNatives extends core.Object { | 940 class IsolateNatives extends core.Object { |
| 945 static computeThisScript() { | 941 static computeThisScript() { |
| 946 let currentScript = document.currentScript; | 942 let currentScript = document.currentScript; |
| 947 if (currentScript != null) { | 943 if (currentScript != null) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 try { | 1063 try { |
| 1068 IsolateNatives._consoleLog(msg); | 1064 IsolateNatives._consoleLog(msg); |
| 1069 } catch (e) { | 1065 } catch (e) { |
| 1070 let trace = dart.stackTrace(e); | 1066 let trace = dart.stackTrace(e); |
| 1071 throw core.Exception.new(trace); | 1067 throw core.Exception.new(trace); |
| 1072 } | 1068 } |
| 1073 | 1069 |
| 1074 } | 1070 } |
| 1075 } | 1071 } |
| 1076 static _consoleLog(msg) { | 1072 static _consoleLog(msg) { |
| 1077 _js_helper.requiresPreamble(); | |
| 1078 self.console.log(msg); | 1073 self.console.log(msg); |
| 1079 } | 1074 } |
| 1080 static _getJSFunctionFromName(functionName) { | 1075 static _getJSFunctionFromName(functionName) { |
| 1081 let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_
embedded_names.GLOBAL_FUNCTIONS); | 1076 let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_
embedded_names.GLOBAL_FUNCTIONS); |
| 1082 return globalFunctionsContainer[functionName](); | 1077 return globalFunctionsContainer[functionName](); |
| 1083 } | 1078 } |
| 1084 static _getJSFunctionName(f) { | 1079 static _getJSFunctionName(f) { |
| 1085 return dart.is(f, _js_helper.Closure) ? dart.as(f.$name, core.String) : nu
ll; | 1080 return dart.as(f.$name, core.String); |
| 1086 } | 1081 } |
| 1087 static _allocate(ctor) { | 1082 static _allocate(ctor) { |
| 1088 return new ctor(); | 1083 return new ctor(); |
| 1089 } | 1084 } |
| 1090 static spawnFunction(topLevelFunction, message, startPaused) { | 1085 static spawnFunction(topLevelFunction, message, startPaused) { |
| 1091 IsolateNatives.enableSpawnWorker = true; | 1086 IsolateNatives.enableSpawnWorker = true; |
| 1092 let name = IsolateNatives._getJSFunctionName(topLevelFunction); | 1087 let name = IsolateNatives._getJSFunctionName(topLevelFunction); |
| 1093 if (name == null) { | 1088 if (name == null) { |
| 1094 throw new core.UnsupportedError("only top-level functions can be spawned
."); | 1089 throw new core.UnsupportedError("only top-level functions can be spawned
."); |
| 1095 } | 1090 } |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 TimerImpl[dart.implements] = () => [async.Timer]; | 1500 TimerImpl[dart.implements] = () => [async.Timer]; |
| 1506 dart.defineNamedConstructor(TimerImpl, 'periodic'); | 1501 dart.defineNamedConstructor(TimerImpl, 'periodic'); |
| 1507 dart.setSignature(TimerImpl, { | 1502 dart.setSignature(TimerImpl, { |
| 1508 constructors: () => ({ | 1503 constructors: () => ({ |
| 1509 TimerImpl: [TimerImpl, [core.int, dart.functionType(dart.void, [])]], | 1504 TimerImpl: [TimerImpl, [core.int, dart.functionType(dart.void, [])]], |
| 1510 periodic: [TimerImpl, [core.int, dart.functionType(dart.void, [async.Timer
])]] | 1505 periodic: [TimerImpl, [core.int, dart.functionType(dart.void, [async.Timer
])]] |
| 1511 }), | 1506 }), |
| 1512 methods: () => ({cancel: [dart.void, []]}) | 1507 methods: () => ({cancel: [dart.void, []]}) |
| 1513 }); | 1508 }); |
| 1514 function hasTimer() { | 1509 function hasTimer() { |
| 1515 _js_helper.requiresPreamble(); | |
| 1516 return self.setTimeout != null; | 1510 return self.setTimeout != null; |
| 1517 } | 1511 } |
| 1518 dart.fn(hasTimer, core.bool, []); | 1512 dart.fn(hasTimer, core.bool, []); |
| 1519 class CapabilityImpl extends core.Object { | 1513 class CapabilityImpl extends core.Object { |
| 1520 CapabilityImpl() { | 1514 CapabilityImpl() { |
| 1521 this._internal(_js_helper.random64()); | 1515 this._internal(_js_helper.random64()); |
| 1522 } | 1516 } |
| 1523 _internal(id) { | 1517 _internal(id) { |
| 1524 this[_id] = id; | 1518 this[_id] = id; |
| 1525 } | 1519 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 exports.leaveJsAsync = leaveJsAsync; | 1551 exports.leaveJsAsync = leaveJsAsync; |
| 1558 exports.isWorker = isWorker; | 1552 exports.isWorker = isWorker; |
| 1559 exports.startRootIsolate = startRootIsolate; | 1553 exports.startRootIsolate = startRootIsolate; |
| 1560 exports.IsolateNatives = IsolateNatives; | 1554 exports.IsolateNatives = IsolateNatives; |
| 1561 exports.RawReceivePortImpl = RawReceivePortImpl; | 1555 exports.RawReceivePortImpl = RawReceivePortImpl; |
| 1562 exports.ReceivePortImpl = ReceivePortImpl; | 1556 exports.ReceivePortImpl = ReceivePortImpl; |
| 1563 exports.TimerImpl = TimerImpl; | 1557 exports.TimerImpl = TimerImpl; |
| 1564 exports.hasTimer = hasTimer; | 1558 exports.hasTimer = hasTimer; |
| 1565 exports.CapabilityImpl = CapabilityImpl; | 1559 exports.CapabilityImpl = CapabilityImpl; |
| 1566 })(_isolate_helper, core, _native_typed_data, _interceptors, _js_helper, isolate
, _foreign_helper, _js_embedded_names, collection, async); | 1560 })(_isolate_helper, core, _native_typed_data, _interceptors, _js_helper, isolate
, _foreign_helper, _js_embedded_names, collection, async); |
| OLD | NEW |