mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-21 20:28:58 +00:00
Add WasmMemoryObject::buffer
method (#1128)
This commit is contained in:
parent
dd5fa705d4
commit
3a05ab4cd6
@ -2771,6 +2771,11 @@ void v8__WasmStreaming__SetUrl(WasmStreamingSharedPtr* self, const char* url,
|
||||
self->inner->SetUrl(url, len);
|
||||
}
|
||||
|
||||
const v8::ArrayBuffer* v8__WasmMemoryObject__Buffer(
|
||||
const v8::WasmMemoryObject& self) {
|
||||
return local_to_ptr(ptr_to_local(&self)->Buffer());
|
||||
}
|
||||
|
||||
using HeapSnapshotCallback = bool (*)(void*, const char*, size_t);
|
||||
|
||||
void v8__HeapProfiler__TakeHeapSnapshot(v8::Isolate* isolate,
|
||||
|
14
src/wasm.rs
14
src/wasm.rs
@ -7,9 +7,11 @@ use crate::scope::HandleScope;
|
||||
use crate::support::char;
|
||||
use crate::support::Opaque;
|
||||
use crate::support::UnitType;
|
||||
use crate::ArrayBuffer;
|
||||
use crate::Isolate;
|
||||
use crate::Local;
|
||||
use crate::Value;
|
||||
use crate::WasmMemoryObject;
|
||||
use crate::WasmModuleObject;
|
||||
use std::ptr::null;
|
||||
use std::ptr::null_mut;
|
||||
@ -173,6 +175,14 @@ impl Drop for CompiledWasmModule {
|
||||
}
|
||||
}
|
||||
|
||||
impl WasmMemoryObject {
|
||||
/// Returns underlying ArrayBuffer.
|
||||
#[inline(always)]
|
||||
pub fn buffer(&self) -> Local<ArrayBuffer> {
|
||||
unsafe { Local::from_raw(v8__WasmMemoryObject__Buffer(self)) }.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn trampoline<F>() -> extern "C" fn(*const FunctionCallbackInfo)
|
||||
where
|
||||
F: UnitType + Fn(&mut HandleScope, Local<Value>, WasmStreaming),
|
||||
@ -241,4 +251,8 @@ extern "C" {
|
||||
length: *mut usize,
|
||||
) -> *const char;
|
||||
fn v8__CompiledWasmModule__DELETE(this: *mut InternalCompiledWasmModule);
|
||||
|
||||
fn v8__WasmMemoryObject__Buffer(
|
||||
this: *const WasmMemoryObject,
|
||||
) -> *mut ArrayBuffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user