Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / workers / worker-shared-asm-buffer.html
blob0c96fae5a4b732d80ebb727bdb11b76b47dcf583
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5 function log(message)
7 document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
10 function runTest()
12 log("Test calling asm functions across workers with the same heap.");
13 var string = [
14 "worker = this;",
15 "onmessage = function(e) {",
16 " function Module(stdlib, foreign, heap) {",
17 " 'use asm';",
18 " var MEM32 = new stdlib.Int32Array(heap);",
19 " function load() { var res = MEM32[255]; MEM32[255] = 123457; return res; }",
20 " return { load: load };",
21 " }",
22 " var buffer = e.data;",
23 " var result = Module(worker, {}, buffer).load();",
24 " var message = result == 123456 ? 'SUCCESS' : 'FAILURE ' + result;",
25 " postMessage(message);",
26 "};"
27 ].join('\n');
28 var blobURL = URL.createObjectURL(new Blob([string]));
29 var worker = new Worker(blobURL);
30 function Module(stdlib, foreign, heap) {
31 'use asm';
32 var MEM32 = new stdlib.Int32Array(heap);
33 function store() { MEM32[255] = 123456; }
34 return { store: store };
36 var buffer = new ArrayBuffer(4 * 256);
37 Module(this, {}, buffer).store();
38 worker.onmessage = function(event) {
39 try {
40 // This buffer may or may not have been neutered, ensure we don't write across threads.
41 for (var i = 0; i < 4 * 256; i++) {
42 buffer[i] = 0;
44 } catch(e) {}
45 log(event.data);
46 log("DONE");
47 if (testRunner.notifyDone)
48 testRunner.notifyDone();
50 worker.postMessage(buffer);
53 if (window.testRunner) {
54 testRunner.setAllowUniversalAccessFromFileURLs(false);
55 testRunner.setAllowFileAccessFromFileURLs(true);
56 testRunner.dumpAsText();
57 testRunner.waitUntilDone();
59 </script>
60 </head>
61 <body onload="runTest()">
62 <pre id='console'></pre>
63 </body>
64 </html>