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

Unified Diff: src/wasm/wasm-js.cc

Issue 2773063002: [wasm] Override mechanism for wasm js APIs (Closed)
Patch Set: Created 3 years, 9 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
« src/runtime/runtime-test.cc ('K') | « src/runtime/runtime-test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-js.cc
diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc
index 0a81a528895a5118947ea2d0fb5c53a3c4379027..e3e0cf4498c33cfabf8555fd7045a13746ed6bd4 100644
--- a/src/wasm/wasm-js.cc
+++ b/src/wasm/wasm-js.cc
@@ -178,6 +178,8 @@ i::MaybeHandle<i::JSReceiver> GetSecondArgumentAsImports(
void WebAssemblyCompile(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ if (i_isolate->wasm_compile_callback()(args)) return;
+
HandleScope scope(isolate);
ErrorThrower thrower(i_isolate, "WebAssembly.compile()");
@@ -222,6 +224,8 @@ void WebAssemblyValidate(const v8::FunctionCallbackInfo<v8::Value>& args) {
void WebAssemblyModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ if (i_isolate->wasm_module_callback()(args)) return;
+
HandleScope scope(isolate);
ErrorThrower thrower(i_isolate, "WebAssembly.Module()");
@@ -297,6 +301,8 @@ void WebAssemblyInstance(const v8::FunctionCallbackInfo<v8::Value>& args) {
HandleScope scope(args.GetIsolate());
v8::Isolate* isolate = args.GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ if (i_isolate->wasm_instance_callback()(args)) return;
+
ErrorThrower thrower(i_isolate, "WebAssembly.Instance()");
auto maybe_module = GetFirstArgumentAsModule(args, &thrower);
@@ -322,6 +328,8 @@ void WebAssemblyInstance(const v8::FunctionCallbackInfo<v8::Value>& args) {
void WebAssemblyInstantiate(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ if (i_isolate->wasm_instantiate_callback()(args)) return;
+
ErrorThrower thrower(i_isolate, "WebAssembly.instantiate()");
HandleScope scope(isolate);
« src/runtime/runtime-test.cc ('K') | « src/runtime/runtime-test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698