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

Unified Diff: chrome/test/data/wasm/wasm_serialization_worker.js

Issue 2255673003: [wasm] Support wasm module structured cloning. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android/windows Created 4 years, 4 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
Index: chrome/test/data/wasm/wasm_serialization_worker.js
diff --git a/chrome/test/data/wasm/wasm_serialization_worker.js b/chrome/test/data/wasm/wasm_serialization_worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..2281e7e682da54c0d9339ce1d4488b513a3276a5
--- /dev/null
+++ b/chrome/test/data/wasm/wasm_serialization_worker.js
@@ -0,0 +1,24 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+onmessage = function(e) {
+ var compiled_module = e.data;
+ var instance = new WebAssembly.Instance(compiled_module);
+ if (typeof instance === "undefined") {
jsbell 2016/08/18 16:48:02 nit: why not just `instance === undefined` ?
Mircea Trofin 2016/08/18 17:34:08 Acknowledged.
Mircea Trofin 2016/08/18 23:02:59 Done.
+ postMessage("error!");
+ return;
+ }
+ var entrypoint = instance.exports["increment"];
+
+ if (typeof entrypoint != "function") {
jsbell 2016/08/18 16:48:02 nit: might as well be consistent and use !==
Mircea Trofin 2016/08/18 17:34:08 Acknowledged.
Mircea Trofin 2016/08/18 23:02:59 Done.
+ postMessage("error!");
+ return;
+ }
+
+ var ret = entrypoint(42);
+ if (ret != 43) {
+ postMessage("didn't get 43");
jsbell 2016/08/18 16:48:02 Do you want a return after this postMessage too, s
Mircea Trofin 2016/08/18 17:34:08 Acknowledged.
Mircea Trofin 2016/08/18 23:02:59 Actually, don't need to post that string, can just
+ }
+ postMessage(ret);
+}

Powered by Google App Engine
This is Rietveld 408576698