Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 | |
| 3 <!-- READ BEFORE UPDATING: | |
| 4 If this test is updated make sure to increment the "revision" value of the | |
| 5 associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure | |
| 6 that the baseline images are regenerated on the next run. | |
| 7 --> | |
| 8 | |
| 9 <html> | |
| 10 <head> | |
| 11 <title>OffscreenCanvas 2d commit flow on worker thread: blue square on white bac kground.</title> | |
| 12 <style type="text/css"> | |
| 13 .nomargin { | |
| 14 margin: 0px auto; | |
| 15 } | |
| 16 </style> | |
| 17 <script id="myWorker" type="text/worker"> | |
| 18 self.onmessage = function(e) { | |
| 19 var transferredCanvas = e.data; | |
| 20 var offscreen2d = transferredCanvas.getContext("2d"); | |
| 21 offscreen2d.fillStyle = "blue"; | |
| 22 offscreen2d.fillRect(0, 0, transferredCanvas.width, transferredCanvas.height ); | |
| 23 offscreen2d.commit(); | |
| 24 self.postMessage(""); | |
|
Ken Russell (switch to Gerrit)
2016/09/22 22:47:27
I think that you should change this test so it wai
| |
| 25 }; | |
| 26 </script> | |
| 27 <script> | |
| 28 var g_swapsBeforeAck = 15; | |
| 29 | |
| 30 function main() | |
| 31 { | |
| 32 draw(); | |
| 33 waitForFinish(); | |
| 34 } | |
| 35 | |
| 36 function makeWorker(script) | |
| 37 { | |
| 38 var blob = new Blob([script]); | |
| 39 return new Worker(URL.createObjectURL(blob)); | |
| 40 } | |
| 41 | |
| 42 function draw() | |
| 43 { | |
| 44 var canvas2D = document.getElementById("c"); | |
| 45 var offscreenCanvas = canvas2D.transferControlToOffscreen(); | |
| 46 var worker = makeWorker(document.getElementById("myWorker").textContent); | |
| 47 worker.postMessage(offscreenCanvas, [offscreenCanvas]); | |
| 48 } | |
| 49 | |
| 50 function waitForFinish() | |
| 51 { | |
| 52 if (g_swapsBeforeAck == 0) { | |
| 53 domAutomationController.setAutomationId(1); | |
| 54 domAutomationController.send("SUCCESS"); | |
| 55 } else { | |
| 56 g_swapsBeforeAck--; | |
| 57 document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1; | |
| 58 window.webkitRequestAnimationFrame(waitForFinish); | |
| 59 } | |
| 60 } | |
| 61 | |
| 62 </script> | |
| 63 </head> | |
| 64 <body onload="main()"> | |
| 65 <div style="position:relative; width:350px; height:350px; background-color:white "> | |
| 66 </div> | |
| 67 <div id="container" style="position:absolute; top:0px; left:0px"> | |
| 68 <canvas id="c" width="320" height="320" class="nomargin"></canvas> | |
| 69 </div> | |
| 70 </body> | |
| 71 </html> | |
| OLD | NEW |