OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library _isolate_helper; | 5 library _isolate_helper; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection' show Queue, HashMap; | 8 import 'dart:collection' show Queue, HashMap; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 import 'dart:_js_helper' show convertDartClosureToJS, | 10 import 'dart:_js_helper' show convertDartClosureToJS, |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 /** Internal counter to assign unique ids to each port. */ | 828 /** Internal counter to assign unique ids to each port. */ |
829 static int _idCount = 0; | 829 static int _idCount = 0; |
830 | 830 |
831 /** For implementing equals and hashcode. */ | 831 /** For implementing equals and hashcode. */ |
832 final int _id; | 832 final int _id; |
833 | 833 |
834 /** Underlying port, when resolved. */ | 834 /** Underlying port, when resolved. */ |
835 SendPort _port; | 835 SendPort _port; |
836 | 836 |
837 /** | 837 /** |
838 * Future of the underlying port, so that we can detect when this port can be | 838 * Future.sync the underlying port, so that we can detect when this port can b
e |
839 * sent on messages. | 839 * sent on messages. |
840 */ | 840 */ |
841 Future<SendPort> _futurePort; | 841 Future<SendPort> _futurePort; |
842 | 842 |
843 /** Pending messages (and reply ports). */ | 843 /** Pending messages (and reply ports). */ |
844 List pending; | 844 List pending; |
845 | 845 |
846 _BufferingSendPort(isolateId, this._futurePort) | 846 _BufferingSendPort(isolateId, this._futurePort) |
847 : super(isolateId), _id = _idCount, pending = [] { | 847 : super(isolateId), _id = _idCount, pending = [] { |
848 _idCount++; | 848 _idCount++; |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 JS('void', '#.clearInterval(#)', globalThis, _handle); | 1426 JS('void', '#.clearInterval(#)', globalThis, _handle); |
1427 } | 1427 } |
1428 _handle = null; | 1428 _handle = null; |
1429 } else { | 1429 } else { |
1430 throw new UnsupportedError("Canceling a timer."); | 1430 throw new UnsupportedError("Canceling a timer."); |
1431 } | 1431 } |
1432 } | 1432 } |
1433 } | 1433 } |
1434 | 1434 |
1435 bool hasTimer() => JS('', '#.setTimeout', globalThis) != null; | 1435 bool hasTimer() => JS('', '#.setTimeout', globalThis) != null; |
OLD | NEW |