Chromium Code Reviews| Index: content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html |
| diff --git a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html b/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html |
| similarity index 69% |
| copy from content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html |
| copy to content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html |
| index 3ae0e56c24d2c1864f35277dbaa6b75ff33191d1..928a509ec68702451d12f7917f708fcf4a4093d5 100644 |
| --- a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html |
| +++ b/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html |
| @@ -8,15 +8,29 @@ that the baseline images are regenerated on the next run. |
| <html> |
| <head> |
| -<title>OffscreenCanvas commit flow on main thread: green square on white background.</title> |
| +<title>OffscreenCanvas commit flow on worker thread: red square on white background.</title> |
| <style type="text/css"> |
| .nomargin { |
| margin: 0px auto; |
| } |
| </style> |
| +<script id="myWorker" type="text/worker"> |
| +self.onmessage = function(e) { |
| + var transferredOffscreenCanvas = e.data.data; |
| + var gl = transferredOffscreenCanvas.getContext("webgl"); |
| + gl.clearColor(1.0, 0.0, 0.0, 1.0); |
| + gl.clear(gl.COLOR_BUFFER_BIT); |
| + gl.commit(); |
| +}; |
| +</script> |
| <script> |
| var g_swapsBeforeAck = 15; |
| +function makeWorker(script) { |
| + var blob = new Blob([script]); |
| + return new Worker(URL.createObjectURL(blob)); |
| +} |
| + |
| function main() |
| { |
| draw(); |
| @@ -27,10 +41,8 @@ function draw() |
| { |
| var canvas = document.getElementById("c"); |
| var offscreenCanvas = canvas.transferControlToOffscreen(); |
| - var gl = offscreenCanvas.getContext("webgl"); |
| - gl.clearColor(0.0, 1.0, 0.0, 1.0); |
| - gl.clear(gl.COLOR_BUFFER_BIT); |
| - gl.commit(); |
| + var worker = makeWorker(document.getElementById("myWorker").textContent); |
| + worker.postMessage({data: offscreenCanvas}, [offscreenCanvas]); |
|
Justin Novosad
2016/09/21 17:23:21
'data' is not a great name for this field. In fact
xidachen
2016/09/21 17:50:17
Done.
|
| } |
| function waitForFinish() |