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

Unified Diff: test/mjsunit/d8-worker-sharedarraybuffer.js

Issue 2657403002: Revert of [d8] Use ValueSerializer for postMessage (instead of ad-hoc serializer) (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/d8-worker.js ('k') | test/mjsunit/harmony/futex.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/d8-worker-sharedarraybuffer.js
diff --git a/test/mjsunit/d8-worker-sharedarraybuffer.js b/test/mjsunit/d8-worker-sharedarraybuffer.js
index 09586c3a11c7bcebb3d8aca5e41680784c528b3e..3fe9fdd143b1eab5eabe85ff57dcf908e524a39f 100644
--- a/test/mjsunit/d8-worker-sharedarraybuffer.js
+++ b/test/mjsunit/d8-worker-sharedarraybuffer.js
@@ -28,19 +28,20 @@
// Flags: --harmony-sharedarraybuffer
if (this.Worker) {
+
(function TestTransfer() {
var workerScript =
`onmessage = function(m) {
- var sab = m;
- var ta = new Uint32Array(sab);
- if (sab.byteLength !== 16) {
- throw new Error('SharedArrayBuffer transfer byteLength');
- }
- for (var i = 0; i < 4; ++i) {
- if (ta[i] !== i) {
- throw new Error('SharedArrayBuffer transfer value ' + i);
- }
- }
+ var sab = m;
+ var ta = new Uint32Array(sab);
+ if (sab.byteLength !== 16) {
+ throw new Error('SharedArrayBuffer transfer byteLength');
+ }
+ for (var i = 0; i < 4; ++i) {
+ if (ta[i] !== i) {
+ throw new Error('SharedArrayBuffer transfer value ' + i);
+ }
+ }
// Atomically update ta[0]
Atomics.store(ta, 0, 100);
};`;
@@ -54,7 +55,7 @@
}
// Transfer SharedArrayBuffer
- w.postMessage(sab);
+ w.postMessage(sab, [sab]);
assertEquals(16, sab.byteLength); // ArrayBuffer should not be neutered.
// Spinwait for the worker to update ta[0]
@@ -85,7 +86,7 @@
var workers = [];
for (id = 0; id < 4; ++id) {
workers[id] = new Worker(workerScript);
- workers[id].postMessage({sab: sab, id: id});
+ workers[id].postMessage({sab: sab, id: id}, [sab]);
}
// Spinwait for each worker to update ta[id]
« no previous file with comments | « test/mjsunit/d8-worker.js ('k') | test/mjsunit/harmony/futex.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698