aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/buffer_source.rs
diff options
context:
space:
mode:
authorTaym Haddadi <haddadi.taym@gmail.com>2024-02-26 15:21:46 +0100
committerGitHub <noreply@github.com>2024-02-26 14:21:46 +0000
commita9a7e8a5cfbd57b7b164a027f5afdcacc298751d (patch)
treec6107331b3ade7b961cc4d7aecbfe2d221a6106e /components/script/dom/bindings/buffer_source.rs
parentef8a0b7f7be8dce5a09f771822c112692a0f9921 (diff)
downloadservo-a9a7e8a5cfbd57b7b164a027f5afdcacc298751d.tar.gz
servo-a9a7e8a5cfbd57b7b164a027f5afdcacc298751d.zip
Rename buffer_source_type to buffer_source (#31426)
* Rename buffer_source_type to buffer_source Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Code format Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Diffstat (limited to 'components/script/dom/bindings/buffer_source.rs')
-rw-r--r--components/script/dom/bindings/buffer_source.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/components/script/dom/bindings/buffer_source.rs b/components/script/dom/bindings/buffer_source.rs
index 2e7073356b5..031ecf9c185 100644
--- a/components/script/dom/bindings/buffer_source.rs
+++ b/components/script/dom/bindings/buffer_source.rs
@@ -67,14 +67,14 @@ unsafe impl<T> crate::dom::bindings::trace::JSTraceable for HeapBufferSource<T>
}
}
-pub fn new_initialized_heap_buffer_source_types<T>(
+pub fn new_initialized_heap_buffer_source<T>(
init: HeapTypedArrayInit,
) -> Result<HeapBufferSource<T>, ()>
where
T: TypedArrayElement + TypedArrayElementCreator,
T::Element: Clone + Copy,
{
- let heap_buffer_source_types = match init {
+ let heap_buffer_source = match init {
HeapTypedArrayInit::Buffer(buffer_source) => HeapBufferSource {
buffer_source: buffer_source,
phantom: PhantomData::default(),
@@ -82,13 +82,13 @@ where
HeapTypedArrayInit::Info { len, cx } => {
rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
let typed_array_result =
- create_buffer_source_types_with_length::<T>(cx, len as usize, array.handle_mut());
+ create_buffer_source_with_length::<T>(cx, len as usize, array.handle_mut());
if typed_array_result.is_err() {
return Err(());
}
- let heap_buffer_source_types = HeapBufferSource::<T>::default();
+ let heap_buffer_source = HeapBufferSource::<T>::default();
- match &heap_buffer_source_types.buffer_source {
+ match &heap_buffer_source.buffer_source {
BufferSource::Int8Array(buffer) |
BufferSource::Int16Array(buffer) |
BufferSource::Int32Array(buffer) |
@@ -106,10 +106,10 @@ where
buffer.set(*array);
},
}
- heap_buffer_source_types
+ heap_buffer_source
},
};
- Ok(heap_buffer_source_types)
+ Ok(heap_buffer_source)
}
pub enum HeapTypedArrayInit {
@@ -131,8 +131,7 @@ where
pub fn set_data(&self, cx: JSContext, data: &[T::Element]) -> Result<(), ()> {
rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
- let _: TypedArray<T, *mut JSObject> =
- create_buffer_source_types(cx, data, array.handle_mut())?;
+ let _: TypedArray<T, *mut JSObject> = create_buffer_source(cx, data, array.handle_mut())?;
match &self.buffer_source {
BufferSource::Int8Array(buffer) |
@@ -367,7 +366,7 @@ where
}
/// <https://webidl.spec.whatwg.org/#arraybufferview-create>
-pub fn create_buffer_source_types<T>(
+pub fn create_buffer_source<T>(
cx: JSContext,
data: &[T::Element],
dest: MutableHandleObject,
@@ -384,7 +383,7 @@ where
}
}
-fn create_buffer_source_types_with_length<T>(
+fn create_buffer_source_with_length<T>(
cx: JSContext,
len: usize,
dest: MutableHandleObject,