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

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: Comments 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
Index: src/wasm/wasm-objects.cc
diff --git a/src/wasm/wasm-objects.cc b/src/wasm/wasm-objects.cc
index 4e4bb05ae08fab9e530a704fe6031f9aef10bed2..00056bc12fbb6bdf762ed64b2cb69c9679d9384e 100644
--- a/src/wasm/wasm-objects.cc
+++ b/src/wasm/wasm-objects.cc
@@ -530,7 +530,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,
« src/isolate.cc ('K') | « src/wasm/wasm-objects.h ('k') | test/cctest/wasm/test-managed.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698