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

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

Issue 2676513008: [wasm] Managed<T> ensures T's lifetime does not leak past Isolate's (Closed)
Patch Set: renamed to ManagedObjectFinalizer, and using "finalizer"` 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 | « src/wasm/wasm-objects.h ('k') | test/cctest/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-objects.cc
diff --git a/src/wasm/wasm-objects.cc b/src/wasm/wasm-objects.cc
index 46433e26b241f1f893d4c493589484168065acc7..c9b552f4a78a0260abe6e8266e132354a8da12c6 100644
--- a/src/wasm/wasm-objects.cc
+++ b/src/wasm/wasm-objects.cc
@@ -531,7 +531,13 @@ WasmSharedModuleData* WasmSharedModuleData::cast(Object* object) {
}
wasm::WasmModule* WasmSharedModuleData::module() {
- return reinterpret_cast<WasmModuleWrapper*>(get(kModuleWrapper))->get();
+ // We populate the kModuleWrapper field with a Foreign holding the
+ // address to the address of a WasmModule. This is because we can
+ // handle both cases when the WasmModule's lifetime is managed through
+ // a Managed<WasmModule> object, as well as cases when it's managed
+ // by the embedder. CcTests fall into the latter case.
+ return *(reinterpret_cast<wasm::WasmModule**>(
+ Foreign::cast(get(kModuleWrapper))->foreign_address()));
}
DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, module_bytes, kModuleBytes,
« no previous file with comments | « src/wasm/wasm-objects.h ('k') | test/cctest/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698