OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // This test creates a lot of isolates. This is meant to exhaust | 5 // This test creates a lot of isolates. This is meant to exhaust |
6 // resources if the isolates aren't closed correctly (which happened | 6 // resources if the isolates aren't closed correctly (which happened |
7 // in dart2js). | 7 // in dart2js). |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'dart:isolate'; | 10 import 'dart:isolate'; |
11 | 11 |
12 // TODO(ahe): Remove this import when we have wrapper-less testing. | 12 // TODO(12588): Remove this import when we have wrapper-less testing. |
13 import 'dart:html'; | 13 import 'dart:html'; |
14 | 14 |
15 worker() { | 15 worker() { |
16 port.receive((String uri, SendPort replyTo) { | 16 port.receive((String uri, SendPort replyTo) { |
17 replyTo.send('Hello from Worker'); | 17 replyTo.send('Hello from Worker'); |
18 port.close(); | 18 port.close(); |
19 }); | 19 }); |
20 } | 20 } |
21 | 21 |
22 main() { | 22 main() { |
(...skipping 14 matching lines...) Expand all Loading... |
37 window.postMessage('unittest-suite-success', '*'); | 37 window.postMessage('unittest-suite-success', '*'); |
38 return; | 38 return; |
39 } | 39 } |
40 spawnFunction(worker).call('').then(spawnMany); | 40 spawnFunction(worker).call('').then(spawnMany); |
41 print('isolateCount = $isolateCount'); | 41 print('isolateCount = $isolateCount'); |
42 } | 42 } |
43 | 43 |
44 spawnMany('Hello from Worker'); | 44 spawnMany('Hello from Worker'); |
45 window.postMessage('unittest-suite-wait-for-done', '*'); | 45 window.postMessage('unittest-suite-wait-for-done', '*'); |
46 } | 46 } |
OLD | NEW |