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

Side by Side Diff: chrome/test/data/workers/queued_shared_worker_shutdown.html

Issue 580007: Changed CreateWorker to coalesce any matching queued shared workers when a (Closed)
Patch Set: Now supports multiple queued instances of one shared worker. Created 10 years, 10 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 <html>
2 <body>
3 <div id=result></div>
4 <script>
5 function log(message)
6 {
7 document.getElementById("result").innerHTML += message + "<br>";
8 }
9
10 var url = document.location.toString();
11 var num_workers = parseInt(url.substr(url.search("count=") + 6));
12
13 if (!num_workers) {
14 log("No count= parameter provided - test aborted");
15 } else {
16 for (var i = 0; i < num_workers ; ++i) {
17 createWorker(i);
18 }
19
20 // Create two extra workers - these should both be queued, and launched as a
21 // single instance when we shutdown a worker.
22 createWorker(num_workers);
23 createWorker(num_workers);
24 }
25
26 var workers_created = 0;
27 function createWorker(i) {
28 var worker = new SharedWorker("worker_common.js?id=" + i);
29 worker.port.postMessage("ping");
30 worker.port.onmessage = function() {
31 workers_created++;
32 log("worker " + i + " started");
33 if (workers_created == num_workers) {
34 // We've created all of our workers. Let's shut down the most recent one
35 // and see if we startup the queued worker.
36 log("Shutting down worker " + i);
37 worker.port.postMessage("close");
38 } else if (workers_created == (num_workers+2)) {
39 // created the last worker
40 log("SUCCESS: queued worker created");
41 document.cookie = "status=OK";
42 }
43 }
44 }
45 </script>
46
47 </body>
48 </html>
OLDNEW
« no previous file with comments | « chrome/test/data/workers/many_shared_workers.html ('k') | chrome/test/data/workers/shutdown_shared_worker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698