OLD | NEW |
1 dart_library.library('dart/_isolate_helper', null, /* Imports */[ | 1 dart_library.library('dart/_isolate_helper', null, /* Imports */[ |
2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
3 'dart/core', | 3 'dart/core', |
4 'dart/_interceptors', | 4 'dart/_interceptors', |
5 'dart/_js_helper', | 5 'dart/_js_helper', |
6 'dart/isolate', | 6 'dart/isolate', |
7 'dart/_foreign_helper', | 7 'dart/_foreign_helper', |
8 'dart/collection', | 8 'dart/collection', |
9 'dart/async' | 9 'dart/async' |
10 ], /* Lazy imports */[ | 10 ], /* Lazy imports */[ |
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 let isolate = exports._globalState.isolates.get(this[_isolateId]); | 1270 let isolate = exports._globalState.isolates.get(this[_isolateId]); |
1271 if (isolate == null) | 1271 if (isolate == null) |
1272 return; | 1272 return; |
1273 if (dart.notNull(this[_receivePort][_isClosed])) | 1273 if (dart.notNull(this[_receivePort][_isClosed])) |
1274 return; | 1274 return; |
1275 let msg = _clone(message); | 1275 let msg = _clone(message); |
1276 if (dart.equals(isolate.controlPort, this[_receivePort])) { | 1276 if (dart.equals(isolate.controlPort, this[_receivePort])) { |
1277 isolate.handleControlMessage(msg); | 1277 isolate.handleControlMessage(msg); |
1278 return; | 1278 return; |
1279 } | 1279 } |
1280 exports._globalState.topEventLoop.enqueue(isolate, dart.fn(() => { | 1280 exports._globalState.topEventLoop.enqueue(isolate, dart.fn((() => { |
1281 if (!dart.notNull(this[_receivePort][_isClosed])) { | 1281 if (!dart.notNull(this[_receivePort][_isClosed])) { |
1282 this[_receivePort][_add](msg); | 1282 this[_receivePort][_add](msg); |
1283 } | 1283 } |
1284 }), `receive ${message}`); | 1284 }).bind(this)), `receive ${message}`); |
1285 } | 1285 } |
1286 ['=='](other) { | 1286 ['=='](other) { |
1287 return dart.is(other, _NativeJsSendPort) && dart.equals(this[_receivePort]
, dart.dload(other, _receivePort)); | 1287 return dart.is(other, _NativeJsSendPort) && dart.equals(this[_receivePort]
, dart.dload(other, _receivePort)); |
1288 } | 1288 } |
1289 get hashCode() { | 1289 get hashCode() { |
1290 return this[_receivePort][_id]; | 1290 return this[_receivePort][_id]; |
1291 } | 1291 } |
1292 } | 1292 } |
1293 _NativeJsSendPort[dart.implements] = () => [isolate.SendPort]; | 1293 _NativeJsSendPort[dart.implements] = () => [isolate.SendPort]; |
1294 dart.setSignature(_NativeJsSendPort, { | 1294 dart.setSignature(_NativeJsSendPort, { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 dart.assert(dart.notNull(milliseconds) > 0); | 1464 dart.assert(dart.notNull(milliseconds) > 0); |
1465 dart.throw(new core.UnsupportedError("Timer greater than 0.")); | 1465 dart.throw(new core.UnsupportedError("Timer greater than 0.")); |
1466 } | 1466 } |
1467 } | 1467 } |
1468 periodic(milliseconds, callback) { | 1468 periodic(milliseconds, callback) { |
1469 this[_once] = false; | 1469 this[_once] = false; |
1470 this[_inEventLoop] = false; | 1470 this[_inEventLoop] = false; |
1471 this[_handle] = null; | 1471 this[_handle] = null; |
1472 if (dart.notNull(hasTimer())) { | 1472 if (dart.notNull(hasTimer())) { |
1473 enterJsAsync(); | 1473 enterJsAsync(); |
1474 this[_handle] = self.setInterval(dart.fn(() => { | 1474 this[_handle] = self.setInterval(dart.fn((() => { |
1475 callback(this); | 1475 callback(this); |
1476 }), milliseconds); | 1476 }).bind(this)), milliseconds); |
1477 } else { | 1477 } else { |
1478 dart.throw(new core.UnsupportedError("Periodic timer.")); | 1478 dart.throw(new core.UnsupportedError("Periodic timer.")); |
1479 } | 1479 } |
1480 } | 1480 } |
1481 cancel() { | 1481 cancel() { |
1482 if (dart.notNull(hasTimer())) { | 1482 if (dart.notNull(hasTimer())) { |
1483 if (dart.notNull(this[_inEventLoop])) { | 1483 if (dart.notNull(this[_inEventLoop])) { |
1484 dart.throw(new core.UnsupportedError("Timer in event loop cannot be ca
nceled.")); | 1484 dart.throw(new core.UnsupportedError("Timer in event loop cannot be ca
nceled.")); |
1485 } | 1485 } |
1486 if (this[_handle] == null) | 1486 if (this[_handle] == null) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 exports.leaveJsAsync = leaveJsAsync; | 1554 exports.leaveJsAsync = leaveJsAsync; |
1555 exports.isWorker = isWorker; | 1555 exports.isWorker = isWorker; |
1556 exports.startRootIsolate = startRootIsolate; | 1556 exports.startRootIsolate = startRootIsolate; |
1557 exports.IsolateNatives = IsolateNatives; | 1557 exports.IsolateNatives = IsolateNatives; |
1558 exports.RawReceivePortImpl = RawReceivePortImpl; | 1558 exports.RawReceivePortImpl = RawReceivePortImpl; |
1559 exports.ReceivePortImpl = ReceivePortImpl; | 1559 exports.ReceivePortImpl = ReceivePortImpl; |
1560 exports.TimerImpl = TimerImpl; | 1560 exports.TimerImpl = TimerImpl; |
1561 exports.hasTimer = hasTimer; | 1561 exports.hasTimer = hasTimer; |
1562 exports.CapabilityImpl = CapabilityImpl; | 1562 exports.CapabilityImpl = CapabilityImpl; |
1563 }); | 1563 }); |
OLD | NEW |