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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-thread-creation.html

Issue 2889393003: Lazy initialization of the rendering thread in OfflineAudioContext (Closed)
Patch Set: Change thread creation location and add layout test Created 3 years, 7 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>
5 OfflineAudioContext - Thread Creation
6 </title>
7 <script src="../../resources/testharness.js"></script>
8 <script src="../../resources/testharnessreport.js"></script>
9 <script src="../resources/audit.js"></script>
10 </head>
11 <body>
12 <script id="layout-test-code">
13 const audit = Audit.createTaskRunner();
Raymond Toy 2017/05/23 17:05:01 Ah, we should do this in the rest of the code. Fo
hongchan 2017/05/23 18:10:38 Yeap. I am testing more ideas from ES6 pattern. Th
14
15 // The common sample rate.
16 const sampleRate = 48000;
17
18 // To make channel count and buffer length irrelevant to this test.
19 const numberOfChannels = 1;
20 const renderLength = 1;
21
22 // Create 2500 contexts in total, 1 context per 5ms.
Raymond Toy 2017/05/23 17:05:01 Why 2500? And why every 5 ms? Doesn't this mean
hongchan 2017/05/23 18:10:38 I was simply using the repro code from the bug. I
Raymond Toy 2017/05/23 18:13:28 12.5 sec for the test seems really bad. I think i
23 const maxNumberOfContexts = 2500;
24 const contextCreationIntervalInMS = 5;
25
26 // Create multiple contexts and drop them rapidly. This should not crash
27 // the browser with out-of-threads error. The repro code is from
28 // crbug.com/716800.
29 audit.define(
30 {
31 label: 'thread-creation',
32 description: 'Creating ' + maxNumberOfContexts +
33 ' contexts without a crash.'
34 },
35 (task, should) => {
36 let numberOfContexts = 0;
37 let timerId = setInterval(() => {
38 let context = new OfflineAudioContext(
39 numberOfChannels, renderLength, sampleRate);
40 delete context;
41 if (++numberOfContexts === maxNumberOfContexts) {
42 clearInterval(timerId);
43 should(numberOfContexts,
44 'The number of created contexts without a crash')
45 .beEqualTo(maxNumberOfContexts);
46 task.done();
47 }
48 }, contextCreationIntervalInMS);
49 });
50
51 audit.run();
52 </script>
53 </body>
54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698