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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 if (event == null) { | 850 if (event == null) { |
851 this.checkOpenReceivePortsFromCommandLine(); | 851 this.checkOpenReceivePortsFromCommandLine(); |
852 exports._globalState.maybeCloseWorker(); | 852 exports._globalState.maybeCloseWorker(); |
853 return false; | 853 return false; |
854 } | 854 } |
855 event.process(); | 855 event.process(); |
856 return true; | 856 return true; |
857 } | 857 } |
858 [_runHelper]() { | 858 [_runHelper]() { |
859 if (exports.globalWindow != null) { | 859 if (exports.globalWindow != null) { |
860 let next = (() => { | 860 let next = () => { |
861 if (!dart.notNull(this.runIteration())) | 861 if (!dart.notNull(this.runIteration())) |
862 return; | 862 return; |
863 async.Timer.run(next); | 863 async.Timer.run(next); |
864 }).bind(this); | 864 }; |
865 dart.fn(next); | 865 dart.fn(next); |
866 next(); | 866 next(); |
867 } else { | 867 } else { |
868 while (this.runIteration()) { | 868 while (this.runIteration()) { |
869 } | 869 } |
870 } | 870 } |
871 } | 871 } |
872 run() { | 872 run() { |
873 if (!dart.notNull(exports._globalState.isWorker)) { | 873 if (!dart.notNull(exports._globalState.isWorker)) { |
874 this[_runHelper](); | 874 this[_runHelper](); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 let isolate = exports._globalState.isolates.get(this[_isolateId]); | 1272 let isolate = exports._globalState.isolates.get(this[_isolateId]); |
1273 if (isolate == null) | 1273 if (isolate == null) |
1274 return; | 1274 return; |
1275 if (this[_receivePort][_isClosed]) | 1275 if (this[_receivePort][_isClosed]) |
1276 return; | 1276 return; |
1277 let msg = _clone(message); | 1277 let msg = _clone(message); |
1278 if (dart.equals(isolate.controlPort, this[_receivePort])) { | 1278 if (dart.equals(isolate.controlPort, this[_receivePort])) { |
1279 isolate.handleControlMessage(msg); | 1279 isolate.handleControlMessage(msg); |
1280 return; | 1280 return; |
1281 } | 1281 } |
1282 exports._globalState.topEventLoop.enqueue(isolate, dart.fn((() => { | 1282 exports._globalState.topEventLoop.enqueue(isolate, dart.fn(() => { |
1283 if (!dart.notNull(this[_receivePort][_isClosed])) { | 1283 if (!dart.notNull(this[_receivePort][_isClosed])) { |
1284 this[_receivePort][_add](msg); | 1284 this[_receivePort][_add](msg); |
1285 } | 1285 } |
1286 }).bind(this)), `receive ${message}`); | 1286 }), `receive ${message}`); |
1287 } | 1287 } |
1288 ['=='](other) { | 1288 ['=='](other) { |
1289 return dart.is(other, _NativeJsSendPort) && dart.notNull(dart.equals(this[
_receivePort], dart.dload(other, _receivePort))); | 1289 return dart.is(other, _NativeJsSendPort) && dart.notNull(dart.equals(this[
_receivePort], dart.dload(other, _receivePort))); |
1290 } | 1290 } |
1291 get hashCode() { | 1291 get hashCode() { |
1292 return this[_receivePort][_id]; | 1292 return this[_receivePort][_id]; |
1293 } | 1293 } |
1294 } | 1294 } |
1295 _NativeJsSendPort[dart.implements] = () => [isolate.SendPort]; | 1295 _NativeJsSendPort[dart.implements] = () => [isolate.SendPort]; |
1296 dart.setSignature(_NativeJsSendPort, { | 1296 dart.setSignature(_NativeJsSendPort, { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 }); | 1438 }); |
1439 let _once = Symbol('_once'); | 1439 let _once = Symbol('_once'); |
1440 let _inEventLoop = Symbol('_inEventLoop'); | 1440 let _inEventLoop = Symbol('_inEventLoop'); |
1441 let _handle = Symbol('_handle'); | 1441 let _handle = Symbol('_handle'); |
1442 class TimerImpl extends core.Object { | 1442 class TimerImpl extends core.Object { |
1443 TimerImpl(milliseconds, callback) { | 1443 TimerImpl(milliseconds, callback) { |
1444 this[_once] = true; | 1444 this[_once] = true; |
1445 this[_inEventLoop] = false; | 1445 this[_inEventLoop] = false; |
1446 this[_handle] = null; | 1446 this[_handle] = null; |
1447 if (milliseconds == 0 && (!dart.notNull(hasTimer()) || dart.notNull(export
s._globalState.isWorker))) { | 1447 if (milliseconds == 0 && (!dart.notNull(hasTimer()) || dart.notNull(export
s._globalState.isWorker))) { |
1448 let internalCallback = (() => { | 1448 let internalCallback = () => { |
1449 this[_handle] = null; | 1449 this[_handle] = null; |
1450 callback(); | 1450 callback(); |
1451 }).bind(this); | 1451 }; |
1452 dart.fn(internalCallback, dart.void, []); | 1452 dart.fn(internalCallback, dart.void, []); |
1453 this[_handle] = 1; | 1453 this[_handle] = 1; |
1454 exports._globalState.topEventLoop.enqueue(exports._globalState.currentCo
ntext, internalCallback, 'timer'); | 1454 exports._globalState.topEventLoop.enqueue(exports._globalState.currentCo
ntext, internalCallback, 'timer'); |
1455 this[_inEventLoop] = true; | 1455 this[_inEventLoop] = true; |
1456 } else if (hasTimer()) { | 1456 } else if (hasTimer()) { |
1457 let internalCallback = (() => { | 1457 let internalCallback = () => { |
1458 this[_handle] = null; | 1458 this[_handle] = null; |
1459 leaveJsAsync(); | 1459 leaveJsAsync(); |
1460 callback(); | 1460 callback(); |
1461 }).bind(this); | 1461 }; |
1462 dart.fn(internalCallback, dart.void, []); | 1462 dart.fn(internalCallback, dart.void, []); |
1463 enterJsAsync(); | 1463 enterJsAsync(); |
1464 this[_handle] = self.setTimeout(_js_helper.convertDartClosureToJS(intern
alCallback, 0), milliseconds); | 1464 this[_handle] = self.setTimeout(_js_helper.convertDartClosureToJS(intern
alCallback, 0), milliseconds); |
1465 } else { | 1465 } else { |
1466 dart.assert(dart.notNull(milliseconds) > 0); | 1466 dart.assert(dart.notNull(milliseconds) > 0); |
1467 throw new core.UnsupportedError("Timer greater than 0."); | 1467 throw new core.UnsupportedError("Timer greater than 0."); |
1468 } | 1468 } |
1469 } | 1469 } |
1470 periodic(milliseconds, callback) { | 1470 periodic(milliseconds, callback) { |
1471 this[_once] = false; | 1471 this[_once] = false; |
1472 this[_inEventLoop] = false; | 1472 this[_inEventLoop] = false; |
1473 this[_handle] = null; | 1473 this[_handle] = null; |
1474 if (hasTimer()) { | 1474 if (hasTimer()) { |
1475 enterJsAsync(); | 1475 enterJsAsync(); |
1476 this[_handle] = self.setInterval(_js_helper.convertDartClosureToJS(dart.
fn((() => { | 1476 this[_handle] = self.setInterval(_js_helper.convertDartClosureToJS(dart.
fn(() => { |
1477 callback(this); | 1477 callback(this); |
1478 }).bind(this)), 0), milliseconds); | 1478 }), 0), milliseconds); |
1479 } else { | 1479 } else { |
1480 throw new core.UnsupportedError("Periodic timer."); | 1480 throw new core.UnsupportedError("Periodic timer."); |
1481 } | 1481 } |
1482 } | 1482 } |
1483 cancel() { | 1483 cancel() { |
1484 if (hasTimer()) { | 1484 if (hasTimer()) { |
1485 if (this[_inEventLoop]) { | 1485 if (this[_inEventLoop]) { |
1486 throw new core.UnsupportedError("Timer in event loop cannot be cancele
d."); | 1486 throw new core.UnsupportedError("Timer in event loop cannot be cancele
d."); |
1487 } | 1487 } |
1488 if (this[_handle] == null) | 1488 if (this[_handle] == null) |
(...skipping 68 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 |