WedIDL: bring dom/bindings/typedarray further in line with spec (#31375)

* WedIDL: bring dom/bindings/typedarray further in line with spec

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

* Rename HeapBufferSourceTypes to HeapBufferSource

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

* fmt code

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-02-25 13:13:17 +01:00 committed by GitHub
parent 32f1d07323
commit d0b663800f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 505 additions and 317 deletions

View file

@ -15,7 +15,7 @@ use webgpu::identity::WebGPUOpResult;
use webgpu::wgpu::device::HostMap;
use webgpu::{WebGPU, WebGPUBuffer, WebGPURequest, WebGPUResponse, WebGPUResponseResult};
use super::bindings::typedarrays::{create_new_external_array_buffer, HeapTypedArray};
use super::bindings::buffer_source::{create_new_external_array_buffer, HeapBufferSource};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{
GPUBufferMethods, GPUMapModeConstants, GPUSize64,
@ -54,7 +54,7 @@ pub struct GPUBufferMapInfo {
pub mapping_range: Range<u64>,
pub mapped_ranges: Vec<Range<u64>>,
#[ignore_malloc_size_of = "defined in mozjs"]
pub js_buffers: Vec<HeapTypedArray<ArrayBufferU8>>,
pub js_buffers: Vec<HeapBufferSource<ArrayBufferU8>>,
pub map_mode: Option<u32>,
}
@ -169,7 +169,7 @@ impl GPUBufferMethods for GPUBuffer {
}
// Step 3.3
m_info.js_buffers.drain(..).for_each(|obj| {
obj.detach_internal(cx);
obj.detach_buffer(cx);
});
},
// Step 2
@ -325,7 +325,7 @@ impl GPUBufferMethods for GPUBuffer {
m_end as usize,
);
let result = heap_typed_array.get_internal().map_err(|_| Error::JSFailed);
let result = heap_typed_array.get_buffer().map_err(|_| Error::JSFailed);
m_info.mapped_ranges.push(offset..m_end);
m_info.js_buffers.push(heap_typed_array);