Use FLoat32Array in GamepadPose (#31106)

* Use FLoat32Array in GamepadPose

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove unused create_typed_array

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi 2024-01-19 05:39:09 +01:00 committed by GitHub
parent 9a698b7bfb
commit 9d2c102fa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 38 additions and 84 deletions

View file

@ -30,7 +30,6 @@ use js::rust::{
get_object_class, is_dom_class, GCMethods, Handle, HandleId, HandleObject, HandleValue,
MutableHandleValue, ToString,
};
use js::typedarray::{CreateWith, Float32Array};
use js::JS_CALLEE;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
@ -133,15 +132,6 @@ pub fn to_frozen_array<T: ToJSValConvertible>(convertibles: &[T], cx: SafeJSCont
*ports
}
/// Creates a Float32 array
pub fn create_typed_array(cx: SafeJSContext, src: &[f32], dst: &Heap<*mut JSObject>) {
rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
unsafe {
let _ = Float32Array::create(*cx, CreateWith::Slice(src), array.handle_mut());
}
(*dst).set(array.get());
}
/// Returns the ProtoOrIfaceArray for the given global object.
/// Fails if `global` is not a DOM global object.
pub fn get_proto_or_iface_array(global: *mut JSObject) -> *mut ProtoOrIfaceArray {