OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title> | 4 <title> |
5 cycle-connection-gc.html | 5 cycle-connection-gc.html |
6 </title> | 6 </title> |
7 <script src="../../resources/js-test.js"></script> | 7 <script src="../../resources/js-test.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script id="layout-test-code"> | 10 <script id="layout-test-code"> |
11 description('Cycles of AudioNode connections should be collected.'); | 11 description('Cycles of AudioNode connections should be collected.'); |
12 let context = new OfflineAudioContext(2, 44100, 44100); | 12 let context = new OfflineAudioContext(2, 44100, 44100); |
13 gc(); | 13 gc(); |
14 let initialCount = internals.audioHandlerCount(); | 14 let initialCount = internals.audioHandlerCount(); |
15 createCycle(); | 15 createCycle(); |
16 debug('A cycle was created:'); | 16 debug('A cycle was created:'); |
17 shouldBeTrue('internals.audioHandlerCount() > initialCount'); | 17 shouldBeTrue('internals.audioHandlerCount() > initialCount'); |
18 gc(); | 18 gc(); |
19 debug('GC happened:'); | 19 debug('GC happened:'); |
20 shouldBe('internals.audioHandlerCount()', 'initialCount'); | 20 shouldBe('internals.audioHandlerCount()', 'initialCount'); |
21 | 21 |
22 function createCycle() { | 22 function createCycle() { |
23 let source = context.createBufferSource(); | 23 let source = context.createBufferSource(); |
24 let delay1 = context.createDelay(); | 24 let gain1 = context.createGain(); |
25 let delay2 = context.createDelay(); | 25 let gain2 = context.createGain(); |
26 source.connect(delay1); | 26 source.connect(gain1); |
27 delay1.connect(delay2); | 27 gain1.connect(gain2); |
28 delay2.connect(delay1); | 28 gain2.connect(gain1); |
29 delay1.connect(context.destination); | 29 gain1.connect(context.destination); |
30 } | 30 } |
31 </script> | 31 </script> |
32 </body> | 32 </body> |
33 </html> | 33 </html> |
OLD | NEW |