Function mozjs::jsapi::GetArrayBufferData

source ·
pub unsafe extern "C" fn GetArrayBufferData(
    obj: *mut JSObject,
    isSharedMemory: *mut bool,
    arg1: *const AutoRequireNoGC,
) -> *mut u8
Expand description

Return a pointer to the start of the data referenced by a typed array. The data is still owned by the typed array, and should not be modified on another thread. Furthermore, the pointer can become invalid on GC (if the data is small and fits inside the array’s GC header), so callers must take care not to hold on across anything that could GC.

|obj| must have passed a JS::IsArrayBufferObject test, or somehow be known that it would pass such a test: it is an ArrayBuffer or a wrapper of an ArrayBuffer, and the unwrapping will succeed.

|*isSharedMemory| is always set to false. The argument is present to simplify its use from code that also interacts with SharedArrayBuffer.