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

Unified Diff: include/v8.h

Issue 2699843003: [wasm] Embedder can control what buffers wasm compilation works on. (Closed)
Patch Set: static initializers Created 3 years, 10 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 | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index b9d44d7df8b49053c4856ecfe913b1b9021eaa7b..15ad25a4c6e3fce62f1dd668bfd950dde619ccdb 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5947,6 +5947,21 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
*/
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context);
+// --- WASM compilation callbacks ---
+
+/**
+ * Callback to check if a buffer source may be compiled to WASM, given
+ * the compilation is attempted as a promise or not.
+ */
+
+typedef bool (*AllowWasmCompileCallback)(Isolate* isolate, Local<Value> source,
+ bool as_promise);
+
+typedef bool (*AllowWasmInstantiateCallback)(Isolate* isolate,
+ Local<Value> module_or_bytes,
+ MaybeLocal<Value> ffi,
+ bool as_promise);
+
// --- Garbage Collection Callbacks ---
/**
@@ -7201,6 +7216,16 @@ class V8_EXPORT Isolate {
AllowCodeGenerationFromStringsCallback callback);
/**
+ * Set the callback to invoke to check if wasm compilation from
+ * the specified object is allowed. By default, wasm compilation
+ * is allowed.
+ *
+ * Similar for instantiate.
+ */
+ void SetAllowWasmCompileCallback(AllowWasmCompileCallback callback);
+ void SetAllowWasmInstantiateCallback(AllowWasmInstantiateCallback callback);
+
+ /**
* Check if V8 is dead and therefore unusable. This is the case after
* fatal errors such as out-of-memory situations.
*/
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698