Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/audiosource-premature-gc.html

Issue 1727333002: Revert of Add ScriptWrappable::hasPendingActivity to AudioSourceNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/audiosource-premature-gc-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test premature GC upon OscillatorNode and AudioBufferSourceNode</titl e>
5 <script src="../resources/js-test.js"></script>
6 </head>
7
8 <body>
9 <script type="text/javascript">
10 description("Test premature GC upon OscillatorNode and AudioBufferSourceNo de");
11 window.jsTestIsAsync = true;
12
13 var sampleRate = 44100;
14 var renderLength = 2 * sampleRate;
15
16 var context = new OfflineAudioContext(1, renderLength, sampleRate);
17
18 // Immediately execute this code inside of the closure. This way |osc| is
19 // contained in the scope and will be a possible target of GC. However,
20 // it will survive GC since it has a pending activity because it is
21 // scheduled. Thus |onended| will be fired eventually.
22 (function () {
23 var osc = context.createOscillator();
24 osc.connect(context.destination);
25 osc.onended = function () {
26 testPassed('OscillatorNode survived GC and onended event fired.');
27 };
28
29 // Play the oscillator for 1 second.
30 osc.start();
31 osc.stop(1);
32 })();
33
34 // The below does the same thing, but with AudioBufferSourceNode.
35 (function () {
36 var source = context.createBufferSource();
37 var dummy = context.createBuffer(1, sampleRate, sampleRate);
38 source.buffer = dummy;
39
40 source.connect(context.destination);
41
42 source.onended = function () {
43 testPassed('AudioBufferSourceNode survived GC and onended event fired. ');
44 };
45
46 source.start();
47 })();
48
49 // Suspend the rendering at 0.1 second and perform GC. The reference to
50 // the oscillator and the buffer source should not be collected.
51 context.suspend(0.1).then(function () {
52 gc();
53 context.resume();
54 });
55
56 context.startRendering().then(function () {
57 finishJSTest();
58 });
59
60 succesfullyParsed = true;
61 </script>
62 </body>
63 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/audiosource-premature-gc-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698