| 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.lazyImport(_interceptors); |
| 5 var _js_helper = dart.lazyImport(_js_helper); | 5 var _js_helper = dart.lazyImport(_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); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return ["extendable", serialized]; | 98 return ["extendable", serialized]; |
| 99 if (dart.is(indexable, _interceptors.JSMutableArray)) | 99 if (dart.is(indexable, _interceptors.JSMutableArray)) |
| 100 return ["mutable", serialized]; | 100 return ["mutable", serialized]; |
| 101 if (dart.is(indexable, _interceptors.JSArray)) | 101 if (dart.is(indexable, _interceptors.JSArray)) |
| 102 return ["const", serialized]; | 102 return ["const", serialized]; |
| 103 this.unsupported(indexable, "Can't serialize indexable: "); | 103 this.unsupported(indexable, "Can't serialize indexable: "); |
| 104 return null; | 104 return null; |
| 105 } | 105 } |
| 106 serializeArray(x) { | 106 serializeArray(x) { |
| 107 let serialized = []; | 107 let serialized = []; |
| 108 serialized[core.$length] = x[core.$length]; | 108 serialized.length = x.length; |
| 109 for (let i = 0; dart.notNull(i) < dart.notNull(x[core.$length]); i = dart.
notNull(i) + 1) { | 109 for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull
(i) + 1) { |
| 110 serialized[core.$set](i, this.serialize(x[core.$get](i))); | 110 serialized[dartx.set](i, this.serialize(x[dartx.get](i))); |
| 111 } | 111 } |
| 112 return serialized; | 112 return serialized; |
| 113 } | 113 } |
| 114 serializeArrayInPlace(x) { | 114 serializeArrayInPlace(x) { |
| 115 for (let i = 0; dart.notNull(i) < dart.notNull(x[core.$length]); i = dart.
notNull(i) + 1) { | 115 for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull
(i) + 1) { |
| 116 x[core.$set](i, this.serialize(x[core.$get](i))); | 116 x[dartx.set](i, this.serialize(x[dartx.get](i))); |
| 117 } | 117 } |
| 118 return x; | 118 return x; |
| 119 } | 119 } |
| 120 serializeMap(x) { | 120 serializeMap(x) { |
| 121 let serializeTearOff = dart.bind(this, 'serialize'); | 121 let serializeTearOff = dart.bind(this, 'serialize'); |
| 122 return ['map', x.keys[core.$map](dart.as(serializeTearOff, __CastType0))[c
ore.$toList](), x.values[core.$map](dart.as(serializeTearOff, dart.functionType(
core.Object, [dart.bottom])))[core.$toList]()]; | 122 return ['map', x.keys[dartx.map](dart.as(serializeTearOff, __CastType0))[d
artx.toList](), x.values[dartx.map](dart.as(serializeTearOff, dart.functionType(
core.Object, [dart.bottom])))[dartx.toList]()]; |
| 123 } | 123 } |
| 124 serializeJSObject(x) { | 124 serializeJSObject(x) { |
| 125 if (!!x.constructor && x.constructor !== Object) { | 125 if (!!x.constructor && x.constructor !== Object) { |
| 126 this.unsupported(x, "Only plain JS Objects are supported:"); | 126 this.unsupported(x, "Only plain JS Objects are supported:"); |
| 127 } | 127 } |
| 128 let keys = dart.as(Object.keys(x), core.List); | 128 let keys = dart.as(Object.keys(x), core.List); |
| 129 let values = []; | 129 let values = []; |
| 130 values[core.$length] = keys[core.$length]; | 130 values.length = keys.length; |
| 131 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { | 131 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
| 132 values[core.$set](i, this.serialize(x[keys[core.$get](i)])); | 132 values[dartx.set](i, this.serialize(x[keys[dartx.get](i)])); |
| 133 } | 133 } |
| 134 return ['js-object', keys, values]; | 134 return ['js-object', keys, values]; |
| 135 } | 135 } |
| 136 serializeWorkerSendPort(x) { | 136 serializeWorkerSendPort(x) { |
| 137 if (this[_serializeSendPorts]) { | 137 if (this[_serializeSendPorts]) { |
| 138 return ['sendport', x[_workerId], x[_isolateId], x[_receivePortId]]; | 138 return ['sendport', x[_workerId], x[_isolateId], x[_receivePortId]]; |
| 139 } | 139 } |
| 140 return ['raw sendport', x]; | 140 return ['raw sendport', x]; |
| 141 } | 141 } |
| 142 serializeJsSendPort(x) { | 142 serializeJsSendPort(x) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 259 } |
| 260 isPrimitive(x) { | 260 isPrimitive(x) { |
| 261 return dart.notNull(x == null) || typeof x == 'string' || dart.is(x, core.
num) || typeof x == 'boolean'; | 261 return dart.notNull(x == null) || typeof x == 'string' || dart.is(x, core.
num) || typeof x == 'boolean'; |
| 262 } | 262 } |
| 263 deserializePrimitive(x) { | 263 deserializePrimitive(x) { |
| 264 return x; | 264 return x; |
| 265 } | 265 } |
| 266 deserializeRef(x) { | 266 deserializeRef(x) { |
| 267 dart.assert(dart.equals(dart.dindex(x, 0), 'ref')); | 267 dart.assert(dart.equals(dart.dindex(x, 0), 'ref')); |
| 268 let serializationId = dart.as(dart.dindex(x, 1), core.int); | 268 let serializationId = dart.as(dart.dindex(x, 1), core.int); |
| 269 return this.deserializedObjects[core.$get](serializationId); | 269 return this.deserializedObjects[dartx.get](serializationId); |
| 270 } | 270 } |
| 271 deserializeByteBuffer(x) { | 271 deserializeByteBuffer(x) { |
| 272 dart.assert(dart.equals(dart.dindex(x, 0), 'buffer')); | 272 dart.assert(dart.equals(dart.dindex(x, 0), 'buffer')); |
| 273 let result = dart.as(dart.dindex(x, 1), _native_typed_data.NativeByteBuffe
r); | 273 let result = dart.as(dart.dindex(x, 1), _native_typed_data.NativeByteBuffe
r); |
| 274 this.deserializedObjects[core.$add](result); | 274 this.deserializedObjects[dartx.add](result); |
| 275 return result; | 275 return result; |
| 276 } | 276 } |
| 277 deserializeTypedData(x) { | 277 deserializeTypedData(x) { |
| 278 dart.assert(dart.equals(dart.dindex(x, 0), 'typed')); | 278 dart.assert(dart.equals(dart.dindex(x, 0), 'typed')); |
| 279 let result = dart.as(dart.dindex(x, 1), _native_typed_data.NativeTypedData
); | 279 let result = dart.as(dart.dindex(x, 1), _native_typed_data.NativeTypedData
); |
| 280 this.deserializedObjects[core.$add](result); | 280 this.deserializedObjects[dartx.add](result); |
| 281 return result; | 281 return result; |
| 282 } | 282 } |
| 283 deserializeArrayInPlace(x) { | 283 deserializeArrayInPlace(x) { |
| 284 for (let i = 0; dart.notNull(i) < dart.notNull(x[core.$length]); i = dart.
notNull(i) + 1) { | 284 for (let i = 0; dart.notNull(i) < dart.notNull(x.length); i = dart.notNull
(i) + 1) { |
| 285 x[core.$set](i, this.deserialize(x[core.$get](i))); | 285 x[dartx.set](i, this.deserialize(x[dartx.get](i))); |
| 286 } | 286 } |
| 287 return x; | 287 return x; |
| 288 } | 288 } |
| 289 deserializeFixed(x) { | 289 deserializeFixed(x) { |
| 290 dart.assert(dart.equals(dart.dindex(x, 0), 'fixed')); | 290 dart.assert(dart.equals(dart.dindex(x, 0), 'fixed')); |
| 291 let result = dart.as(dart.dindex(x, 1), core.List); | 291 let result = dart.as(dart.dindex(x, 1), core.List); |
| 292 this.deserializedObjects[core.$add](result); | 292 this.deserializedObjects[dartx.add](result); |
| 293 return _interceptors.JSArray.markFixed(this.deserializeArrayInPlace(dart.a
s(result, _interceptors.JSArray))); | 293 return _interceptors.JSArray.markFixed(this.deserializeArrayInPlace(dart.a
s(result, _interceptors.JSArray))); |
| 294 } | 294 } |
| 295 deserializeExtendable(x) { | 295 deserializeExtendable(x) { |
| 296 dart.assert(dart.equals(dart.dindex(x, 0), 'extendable')); | 296 dart.assert(dart.equals(dart.dindex(x, 0), 'extendable')); |
| 297 let result = dart.as(dart.dindex(x, 1), core.List); | 297 let result = dart.as(dart.dindex(x, 1), core.List); |
| 298 this.deserializedObjects[core.$add](result); | 298 this.deserializedObjects[dartx.add](result); |
| 299 return _interceptors.JSArray.markGrowable(this.deserializeArrayInPlace(dar
t.as(result, _interceptors.JSArray))); | 299 return _interceptors.JSArray.markGrowable(this.deserializeArrayInPlace(dar
t.as(result, _interceptors.JSArray))); |
| 300 } | 300 } |
| 301 deserializeMutable(x) { | 301 deserializeMutable(x) { |
| 302 dart.assert(dart.equals(dart.dindex(x, 0), 'mutable')); | 302 dart.assert(dart.equals(dart.dindex(x, 0), 'mutable')); |
| 303 let result = dart.as(dart.dindex(x, 1), core.List); | 303 let result = dart.as(dart.dindex(x, 1), core.List); |
| 304 this.deserializedObjects[core.$add](result); | 304 this.deserializedObjects[dartx.add](result); |
| 305 return this.deserializeArrayInPlace(dart.as(result, _interceptors.JSArray)
); | 305 return this.deserializeArrayInPlace(dart.as(result, _interceptors.JSArray)
); |
| 306 } | 306 } |
| 307 deserializeConst(x) { | 307 deserializeConst(x) { |
| 308 dart.assert(dart.equals(dart.dindex(x, 0), 'const')); | 308 dart.assert(dart.equals(dart.dindex(x, 0), 'const')); |
| 309 let result = dart.as(dart.dindex(x, 1), core.List); | 309 let result = dart.as(dart.dindex(x, 1), core.List); |
| 310 this.deserializedObjects[core.$add](result); | 310 this.deserializedObjects[dartx.add](result); |
| 311 return _interceptors.JSArray.markFixed(this.deserializeArrayInPlace(dart.a
s(result, _interceptors.JSArray))); | 311 return _interceptors.JSArray.markFixed(this.deserializeArrayInPlace(dart.a
s(result, _interceptors.JSArray))); |
| 312 } | 312 } |
| 313 deserializeMap(x) { | 313 deserializeMap(x) { |
| 314 dart.assert(dart.equals(dart.dindex(x, 0), 'map')); | 314 dart.assert(dart.equals(dart.dindex(x, 0), 'map')); |
| 315 let keys = dart.as(dart.dindex(x, 1), core.List); | 315 let keys = dart.as(dart.dindex(x, 1), core.List); |
| 316 let values = dart.as(dart.dindex(x, 2), core.List); | 316 let values = dart.as(dart.dindex(x, 2), core.List); |
| 317 let result = dart.map(); | 317 let result = dart.map(); |
| 318 this.deserializedObjects[core.$add](result); | 318 this.deserializedObjects[dartx.add](result); |
| 319 keys = keys[core.$map](dart.bind(this, 'deserialize'))[core.$toList](); | 319 keys = keys[dartx.map](dart.bind(this, 'deserialize'))[dartx.toList](); |
| 320 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { | 320 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
| 321 result.set(keys[core.$get](i), this.deserialize(values[core.$get](i))); | 321 result.set(keys[dartx.get](i), this.deserialize(values[dartx.get](i))); |
| 322 } | 322 } |
| 323 return result; | 323 return result; |
| 324 } | 324 } |
| 325 deserializeSendPort(x) { | 325 deserializeSendPort(x) { |
| 326 dart.assert(dart.equals(dart.dindex(x, 0), 'sendport')); | 326 dart.assert(dart.equals(dart.dindex(x, 0), 'sendport')); |
| 327 let managerId = dart.as(dart.dindex(x, 1), core.int); | 327 let managerId = dart.as(dart.dindex(x, 1), core.int); |
| 328 let isolateId = dart.as(dart.dindex(x, 2), core.int); | 328 let isolateId = dart.as(dart.dindex(x, 2), core.int); |
| 329 let receivePortId = dart.as(dart.dindex(x, 3), core.int); | 329 let receivePortId = dart.as(dart.dindex(x, 3), core.int); |
| 330 let result = null; | 330 let result = null; |
| 331 if (managerId == exports._globalState.currentManagerId) { | 331 if (managerId == exports._globalState.currentManagerId) { |
| 332 let isolate = exports._globalState.isolates.get(isolateId); | 332 let isolate = exports._globalState.isolates.get(isolateId); |
| 333 if (isolate == null) | 333 if (isolate == null) |
| 334 return null; | 334 return null; |
| 335 let receivePort = isolate.lookup(receivePortId); | 335 let receivePort = isolate.lookup(receivePortId); |
| 336 if (receivePort == null) | 336 if (receivePort == null) |
| 337 return null; | 337 return null; |
| 338 result = new _NativeJsSendPort(receivePort, isolateId); | 338 result = new _NativeJsSendPort(receivePort, isolateId); |
| 339 } else { | 339 } else { |
| 340 result = new _WorkerSendPort(managerId, isolateId, receivePortId); | 340 result = new _WorkerSendPort(managerId, isolateId, receivePortId); |
| 341 } | 341 } |
| 342 this.deserializedObjects[core.$add](result); | 342 this.deserializedObjects[dartx.add](result); |
| 343 return result; | 343 return result; |
| 344 } | 344 } |
| 345 deserializeRawSendPort(x) { | 345 deserializeRawSendPort(x) { |
| 346 dart.assert(dart.equals(dart.dindex(x, 0), 'raw sendport')); | 346 dart.assert(dart.equals(dart.dindex(x, 0), 'raw sendport')); |
| 347 let result = dart.as(dart.dindex(x, 1), isolate.SendPort); | 347 let result = dart.as(dart.dindex(x, 1), isolate.SendPort); |
| 348 this.deserializedObjects[core.$add](result); | 348 this.deserializedObjects[dartx.add](result); |
| 349 return result; | 349 return result; |
| 350 } | 350 } |
| 351 deserializeJSObject(x) { | 351 deserializeJSObject(x) { |
| 352 dart.assert(dart.equals(dart.dindex(x, 0), 'js-object')); | 352 dart.assert(dart.equals(dart.dindex(x, 0), 'js-object')); |
| 353 let keys = dart.as(dart.dindex(x, 1), core.List); | 353 let keys = dart.as(dart.dindex(x, 1), core.List); |
| 354 let values = dart.as(dart.dindex(x, 2), core.List); | 354 let values = dart.as(dart.dindex(x, 2), core.List); |
| 355 let o = {}; | 355 let o = {}; |
| 356 this.deserializedObjects[core.$add](o); | 356 this.deserializedObjects[dartx.add](o); |
| 357 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = da
rt.notNull(i) + 1) { | 357 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.notN
ull(i) + 1) { |
| 358 o[keys[core.$get](i)] = this.deserialize(values[core.$get](i)); | 358 o[keys[dartx.get](i)] = this.deserialize(values[dartx.get](i)); |
| 359 } | 359 } |
| 360 return o; | 360 return o; |
| 361 } | 361 } |
| 362 deserializeClosure(x) { | 362 deserializeClosure(x) { |
| 363 dart.assert(dart.equals(dart.dindex(x, 0), 'function')); | 363 dart.assert(dart.equals(dart.dindex(x, 0), 'function')); |
| 364 let name = dart.as(dart.dindex(x, 1), core.String); | 364 let name = dart.as(dart.dindex(x, 1), core.String); |
| 365 let result = dart.as(IsolateNatives._getJSFunctionFromName(name), core.Fun
ction); | 365 let result = dart.as(IsolateNatives._getJSFunctionFromName(name), core.Fun
ction); |
| 366 this.deserializedObjects[core.$add](result); | 366 this.deserializedObjects[dartx.add](result); |
| 367 return result; | 367 return result; |
| 368 } | 368 } |
| 369 deserializeDartObject(x) { | 369 deserializeDartObject(x) { |
| 370 dart.assert(dart.equals(dart.dindex(x, 0), 'dart')); | 370 dart.assert(dart.equals(dart.dindex(x, 0), 'dart')); |
| 371 let classId = dart.as(dart.dindex(x, 1), core.String); | 371 let classId = dart.as(dart.dindex(x, 1), core.String); |
| 372 let fields = dart.as(dart.dindex(x, 2), core.List); | 372 let fields = dart.as(dart.dindex(x, 2), core.List); |
| 373 let instanceFromClassId = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embed
ded_names.INSTANCE_FROM_CLASS_ID); | 373 let instanceFromClassId = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embed
ded_names.INSTANCE_FROM_CLASS_ID); |
| 374 let initializeObject = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded
_names.INITIALIZE_EMPTY_INSTANCE); | 374 let initializeObject = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded
_names.INITIALIZE_EMPTY_INSTANCE); |
| 375 let emptyInstance = instanceFromClassId(classId); | 375 let emptyInstance = instanceFromClassId(classId); |
| 376 this.deserializedObjects[core.$add](emptyInstance); | 376 this.deserializedObjects[dartx.add](emptyInstance); |
| 377 this.deserializeArrayInPlace(dart.as(fields, _interceptors.JSArray)); | 377 this.deserializeArrayInPlace(dart.as(fields, _interceptors.JSArray)); |
| 378 return initializeObject(classId, emptyInstance, fields); | 378 return initializeObject(classId, emptyInstance, fields); |
| 379 } | 379 } |
| 380 } | 380 } |
| 381 dart.setSignature(_Deserializer, { | 381 dart.setSignature(_Deserializer, { |
| 382 constructors: () => ({_Deserializer: [_Deserializer, [], {adjustSendPorts: c
ore.Object}]}), | 382 constructors: () => ({_Deserializer: [_Deserializer, [], {adjustSendPorts: c
ore.Object}]}), |
| 383 methods: () => ({ | 383 methods: () => ({ |
| 384 deserialize: [core.Object, [core.Object]], | 384 deserialize: [core.Object, [core.Object]], |
| 385 isPrimitive: [core.bool, [core.Object]], | 385 isPrimitive: [core.bool, [core.Object]], |
| 386 deserializePrimitive: [core.Object, [core.Object]], | 386 deserializePrimitive: [core.Object, [core.Object]], |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 let o = exports._globalState, x = o.nextIsolateId; | 546 let o = exports._globalState, x = o.nextIsolateId; |
| 547 o.nextIsolateId = dart.notNull(x) + 1; | 547 o.nextIsolateId = dart.notNull(x) + 1; |
| 548 return x; | 548 return x; |
| 549 })(); | 549 })(); |
| 550 this.ports = core.Map$(core.int, RawReceivePortImpl).new(); | 550 this.ports = core.Map$(core.int, RawReceivePortImpl).new(); |
| 551 this.weakPorts = core.Set$(core.int).new(); | 551 this.weakPorts = core.Set$(core.int).new(); |
| 552 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); | 552 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); |
| 553 this.controlPort = new RawReceivePortImpl._controlPort(); | 553 this.controlPort = new RawReceivePortImpl._controlPort(); |
| 554 this.pauseCapability = isolate.Capability.new(); | 554 this.pauseCapability = isolate.Capability.new(); |
| 555 this.terminateCapability = isolate.Capability.new(); | 555 this.terminateCapability = isolate.Capability.new(); |
| 556 this.delayedEvents = dart.setType([], core.List$(_IsolateEvent)); | 556 this.delayedEvents = dart.list([], _IsolateEvent); |
| 557 this.pauseTokens = core.Set$(isolate.Capability).new(); | 557 this.pauseTokens = core.Set$(isolate.Capability).new(); |
| 558 this.errorPorts = core.Set$(isolate.SendPort).new(); | 558 this.errorPorts = core.Set$(isolate.SendPort).new(); |
| 559 this.initialized = false; | 559 this.initialized = false; |
| 560 this.isPaused = false; | 560 this.isPaused = false; |
| 561 this.doneHandlers = null; | 561 this.doneHandlers = null; |
| 562 this[_scheduledControlEvents] = null; | 562 this[_scheduledControlEvents] = null; |
| 563 this[_isExecutingEvent] = false; | 563 this[_isExecutingEvent] = false; |
| 564 this.errorsAreFatal = true; | 564 this.errorsAreFatal = true; |
| 565 this.registerWeak(this.controlPort[_id], this.controlPort); | 565 this.registerWeak(this.controlPort[_id], this.controlPort); |
| 566 } | 566 } |
| 567 addPause(authentification, resume) { | 567 addPause(authentification, resume) { |
| 568 if (!dart.equals(this.pauseCapability, authentification)) | 568 if (!dart.equals(this.pauseCapability, authentification)) |
| 569 return; | 569 return; |
| 570 if (dart.notNull(this.pauseTokens.add(resume)) && !dart.notNull(this.isPau
sed)) { | 570 if (dart.notNull(this.pauseTokens.add(resume)) && !dart.notNull(this.isPau
sed)) { |
| 571 this.isPaused = true; | 571 this.isPaused = true; |
| 572 } | 572 } |
| 573 this[_updateGlobalState](); | 573 this[_updateGlobalState](); |
| 574 } | 574 } |
| 575 removePause(resume) { | 575 removePause(resume) { |
| 576 if (!dart.notNull(this.isPaused)) | 576 if (!dart.notNull(this.isPaused)) |
| 577 return; | 577 return; |
| 578 this.pauseTokens.remove(resume); | 578 this.pauseTokens.remove(resume); |
| 579 if (this.pauseTokens[core.$isEmpty]) { | 579 if (this.pauseTokens.isEmpty) { |
| 580 while (this.delayedEvents[core.$isNotEmpty]) { | 580 while (this.delayedEvents[dartx.isNotEmpty]) { |
| 581 let event = this.delayedEvents[core.$removeLast](); | 581 let event = this.delayedEvents[dartx.removeLast](); |
| 582 exports._globalState.topEventLoop.prequeue(event); | 582 exports._globalState.topEventLoop.prequeue(event); |
| 583 } | 583 } |
| 584 this.isPaused = false; | 584 this.isPaused = false; |
| 585 } | 585 } |
| 586 this[_updateGlobalState](); | 586 this[_updateGlobalState](); |
| 587 } | 587 } |
| 588 addDoneListener(responsePort) { | 588 addDoneListener(responsePort) { |
| 589 if (this.doneHandlers == null) { | 589 if (this.doneHandlers == null) { |
| 590 this.doneHandlers = []; | 590 this.doneHandlers = []; |
| 591 } | 591 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 } | 639 } |
| 640 dart.dsend(this[_scheduledControlEvents], 'addLast', dart.bind(this, 'kill
')); | 640 dart.dsend(this[_scheduledControlEvents], 'addLast', dart.bind(this, 'kill
')); |
| 641 } | 641 } |
| 642 addErrorListener(port) { | 642 addErrorListener(port) { |
| 643 this.errorPorts.add(port); | 643 this.errorPorts.add(port); |
| 644 } | 644 } |
| 645 removeErrorListener(port) { | 645 removeErrorListener(port) { |
| 646 this.errorPorts.remove(port); | 646 this.errorPorts.remove(port); |
| 647 } | 647 } |
| 648 handleUncaughtError(error, stackTrace) { | 648 handleUncaughtError(error, stackTrace) { |
| 649 if (this.errorPorts[core.$isEmpty]) { | 649 if (this.errorPorts.isEmpty) { |
| 650 if (dart.notNull(this.errorsAreFatal) && dart.notNull(core.identical(thi
s, exports._globalState.rootContext))) { | 650 if (dart.notNull(this.errorsAreFatal) && dart.notNull(core.identical(thi
s, exports._globalState.rootContext))) { |
| 651 return; | 651 return; |
| 652 } | 652 } |
| 653 if (self.console && self.console.error) { | 653 if (self.console && self.console.error) { |
| 654 self.console.error(error, stackTrace); | 654 self.console.error(error, stackTrace); |
| 655 } else { | 655 } else { |
| 656 core.print(error); | 656 core.print(error); |
| 657 if (stackTrace != null) | 657 if (stackTrace != null) |
| 658 core.print(stackTrace); | 658 core.print(stackTrace); |
| 659 } | 659 } |
| 660 return; | 660 return; |
| 661 } | 661 } |
| 662 let message = core.List.new(2); | 662 let message = core.List.new(2); |
| 663 message[core.$set](0, dart.toString(error)); | 663 message[dartx.set](0, dart.toString(error)); |
| 664 message[core.$set](1, stackTrace == null ? null : dart.toString(stackTrace
)); | 664 message[dartx.set](1, stackTrace == null ? null : dart.toString(stackTrace
)); |
| 665 for (let port of this.errorPorts) | 665 for (let port of this.errorPorts) |
| 666 port.send(message); | 666 port.send(message); |
| 667 } | 667 } |
| 668 eval(code) { | 668 eval(code) { |
| 669 let old = exports._globalState.currentContext; | 669 let old = exports._globalState.currentContext; |
| 670 exports._globalState.currentContext = this; | 670 exports._globalState.currentContext = this; |
| 671 this[_setGlobals](); | 671 this[_setGlobals](); |
| 672 let result = null; | 672 let result = null; |
| 673 this[_isExecutingEvent] = true; | 673 this[_isExecutingEvent] = true; |
| 674 try { | 674 try { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 } | 760 } |
| 761 register(portId, port) { | 761 register(portId, port) { |
| 762 this[_addRegistration](portId, port); | 762 this[_addRegistration](portId, port); |
| 763 this[_updateGlobalState](); | 763 this[_updateGlobalState](); |
| 764 } | 764 } |
| 765 registerWeak(portId, port) { | 765 registerWeak(portId, port) { |
| 766 this.weakPorts.add(portId); | 766 this.weakPorts.add(portId); |
| 767 this[_addRegistration](portId, port); | 767 this[_addRegistration](portId, port); |
| 768 } | 768 } |
| 769 [_updateGlobalState]() { | 769 [_updateGlobalState]() { |
| 770 if (dart.notNull(this.ports.length) - dart.notNull(this.weakPorts[core.$le
ngth]) > 0 || dart.notNull(this.isPaused) || !dart.notNull(this.initialized)) { | 770 if (dart.notNull(this.ports.length) - dart.notNull(this.weakPorts.length)
> 0 || dart.notNull(this.isPaused) || !dart.notNull(this.initialized)) { |
| 771 exports._globalState.isolates.set(this.id, this); | 771 exports._globalState.isolates.set(this.id, this); |
| 772 } else { | 772 } else { |
| 773 this.kill(); | 773 this.kill(); |
| 774 } | 774 } |
| 775 } | 775 } |
| 776 kill() { | 776 kill() { |
| 777 if (this[_scheduledControlEvents] != null) { | 777 if (this[_scheduledControlEvents] != null) { |
| 778 dart.dsend(this[_scheduledControlEvents], 'clear'); | 778 dart.dsend(this[_scheduledControlEvents], 'clear'); |
| 779 } | 779 } |
| 780 for (let port of this.ports.values) { | 780 for (let port of this.ports.values) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 this.events = collection.Queue$(_IsolateEvent).new(); | 829 this.events = collection.Queue$(_IsolateEvent).new(); |
| 830 this[_activeJsAsyncCount] = 0; | 830 this[_activeJsAsyncCount] = 0; |
| 831 } | 831 } |
| 832 enqueue(isolate, fn, msg) { | 832 enqueue(isolate, fn, msg) { |
| 833 this.events.addLast(new _IsolateEvent(dart.as(isolate, _IsolateContext), d
art.as(fn, core.Function), dart.as(msg, core.String))); | 833 this.events.addLast(new _IsolateEvent(dart.as(isolate, _IsolateContext), d
art.as(fn, core.Function), dart.as(msg, core.String))); |
| 834 } | 834 } |
| 835 prequeue(event) { | 835 prequeue(event) { |
| 836 this.events.addFirst(event); | 836 this.events.addFirst(event); |
| 837 } | 837 } |
| 838 dequeue() { | 838 dequeue() { |
| 839 if (this.events[core.$isEmpty]) | 839 if (this.events.isEmpty) |
| 840 return null; | 840 return null; |
| 841 return this.events.removeFirst(); | 841 return this.events.removeFirst(); |
| 842 } | 842 } |
| 843 checkOpenReceivePortsFromCommandLine() { | 843 checkOpenReceivePortsFromCommandLine() { |
| 844 if (dart.notNull(exports._globalState.rootContext != null) && dart.notNull
(exports._globalState.isolates.containsKey(exports._globalState.rootContext.id))
&& dart.notNull(exports._globalState.fromCommandLine) && dart.notNull(exports._
globalState.rootContext.ports.isEmpty)) { | 844 if (dart.notNull(exports._globalState.rootContext != null) && dart.notNull
(exports._globalState.isolates.containsKey(exports._globalState.rootContext.id))
&& dart.notNull(exports._globalState.fromCommandLine) && dart.notNull(exports._
globalState.rootContext.ports.isEmpty)) { |
| 845 throw core.Exception.new("Program exited with open ReceivePorts."); | 845 throw core.Exception.new("Program exited with open ReceivePorts."); |
| 846 } | 846 } |
| 847 } | 847 } |
| 848 runIteration() { | 848 runIteration() { |
| 849 let event = this.dequeue(); | 849 let event = this.dequeue(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 }) | 896 }) |
| 897 }); | 897 }); |
| 898 class _IsolateEvent extends core.Object { | 898 class _IsolateEvent extends core.Object { |
| 899 _IsolateEvent(isolate, fn, message) { | 899 _IsolateEvent(isolate, fn, message) { |
| 900 this.isolate = isolate; | 900 this.isolate = isolate; |
| 901 this.fn = fn; | 901 this.fn = fn; |
| 902 this.message = message; | 902 this.message = message; |
| 903 } | 903 } |
| 904 process() { | 904 process() { |
| 905 if (this.isolate.isPaused) { | 905 if (this.isolate.isPaused) { |
| 906 this.isolate.delayedEvents[core.$add](this); | 906 this.isolate.delayedEvents[dartx.add](this); |
| 907 return; | 907 return; |
| 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 { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 let isSpawnUri = false; | 1097 let isSpawnUri = false; |
| 1098 return IsolateNatives.spawn(name, null, null, message, isLight, isSpawnUri
, startPaused); | 1098 return IsolateNatives.spawn(name, null, null, message, isLight, isSpawnUri
, startPaused); |
| 1099 } | 1099 } |
| 1100 static spawnUri(uri, args, message, startPaused) { | 1100 static spawnUri(uri, args, message, startPaused) { |
| 1101 IsolateNatives.enableSpawnWorker = true; | 1101 IsolateNatives.enableSpawnWorker = true; |
| 1102 let isLight = false; | 1102 let isLight = false; |
| 1103 let isSpawnUri = true; | 1103 let isSpawnUri = true; |
| 1104 return IsolateNatives.spawn(null, dart.toString(uri), args, message, isLig
ht, isSpawnUri, startPaused); | 1104 return IsolateNatives.spawn(null, dart.toString(uri), args, message, isLig
ht, isSpawnUri, startPaused); |
| 1105 } | 1105 } |
| 1106 static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPau
sed) { | 1106 static spawn(functionName, uri, args, message, isLight, isSpawnUri, startPau
sed) { |
| 1107 if (uri != null && dart.notNull(uri.endsWith(".dart"))) { | 1107 if (uri != null && dart.notNull(uri[dartx.endsWith](".dart"))) { |
| 1108 uri = dart.notNull(uri) + ".js"; | 1108 uri = dart.notNull(uri) + ".js"; |
| 1109 } | 1109 } |
| 1110 let port = isolate.ReceivePort.new(); | 1110 let port = isolate.ReceivePort.new(); |
| 1111 let completer = async.Completer$(core.List).new(); | 1111 let completer = async.Completer$(core.List).new(); |
| 1112 port.first.then(dart.fn(msg => { | 1112 port.first.then(dart.fn(msg => { |
| 1113 if (dart.equals(dart.dindex(msg, 0), _SPAWNED_SIGNAL)) { | 1113 if (dart.equals(dart.dindex(msg, 0), _SPAWNED_SIGNAL)) { |
| 1114 completer.complete(msg); | 1114 completer.complete(msg); |
| 1115 } else { | 1115 } else { |
| 1116 dart.assert(dart.equals(dart.dindex(msg, 0), _SPAWN_FAILED_SIGNAL)); | 1116 dart.assert(dart.equals(dart.dindex(msg, 0), _SPAWN_FAILED_SIGNAL)); |
| 1117 completer.completeError(dart.dindex(msg, 1)); | 1117 completer.completeError(dart.dindex(msg, 1)); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 exports.leaveJsAsync = leaveJsAsync; | 1557 exports.leaveJsAsync = leaveJsAsync; |
| 1558 exports.isWorker = isWorker; | 1558 exports.isWorker = isWorker; |
| 1559 exports.startRootIsolate = startRootIsolate; | 1559 exports.startRootIsolate = startRootIsolate; |
| 1560 exports.IsolateNatives = IsolateNatives; | 1560 exports.IsolateNatives = IsolateNatives; |
| 1561 exports.RawReceivePortImpl = RawReceivePortImpl; | 1561 exports.RawReceivePortImpl = RawReceivePortImpl; |
| 1562 exports.ReceivePortImpl = ReceivePortImpl; | 1562 exports.ReceivePortImpl = ReceivePortImpl; |
| 1563 exports.TimerImpl = TimerImpl; | 1563 exports.TimerImpl = TimerImpl; |
| 1564 exports.hasTimer = hasTimer; | 1564 exports.hasTimer = hasTimer; |
| 1565 exports.CapabilityImpl = CapabilityImpl; | 1565 exports.CapabilityImpl = CapabilityImpl; |
| 1566 })(_isolate_helper, core, _native_typed_data, _interceptors, _js_helper, isolate
, _foreign_helper, _js_embedded_names, collection, async); | 1566 })(_isolate_helper, core, _native_typed_data, _interceptors, _js_helper, isolate
, _foreign_helper, _js_embedded_names, collection, async); |
| OLD | NEW |