refactor: add CanGc as argument to DataBlock::view (#35610)

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
Yerkebulan Tulibergenov 2025-02-22 16:35:44 -08:00 committed by GitHub
parent b0b0289014
commit dd13342f18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -429,7 +429,7 @@ impl DataBlock {
} }
/// Returns error if requested range is already mapped /// Returns error if requested range is already mapped
pub(crate) fn view(&mut self, range: Range<usize>) -> Result<&DataView, ()> { pub(crate) fn view(&mut self, range: Range<usize>, _can_gc: CanGc) -> Result<&DataView, ()> {
if self if self
.data_views .data_views
.iter() .iter()

View file

@ -297,6 +297,7 @@ impl GPUBufferMethods<crate::DomTypeHolder> for GPUBuffer {
_cx: JSContext, _cx: JSContext,
offset: GPUSize64, offset: GPUSize64,
size: Option<GPUSize64>, size: Option<GPUSize64>,
can_gc: CanGc,
) -> Fallible<ArrayBuffer> { ) -> Fallible<ArrayBuffer> {
let range_size = if let Some(s) = size { let range_size = if let Some(s) = size {
s s
@ -321,7 +322,7 @@ impl GPUBufferMethods<crate::DomTypeHolder> for GPUBuffer {
let rebased_offset = (offset - mapping.range.start) as usize; let rebased_offset = (offset - mapping.range.start) as usize;
mapping mapping
.data .data
.view(rebased_offset..rebased_offset + range_size as usize) .view(rebased_offset..rebased_offset + range_size as usize, can_gc)
.map(|view| view.array_buffer()) .map(|view| view.array_buffer())
.map_err(|()| Error::Operation) .map_err(|()| Error::Operation)
} }

View file

@ -217,7 +217,7 @@ DOMInterfaces = {
'GPUBuffer': { 'GPUBuffer': {
'inRealms': ['MapAsync'], 'inRealms': ['MapAsync'],
'canGc': ['MapAsync'], 'canGc': ['GetMappedRange', 'MapAsync'],
}, },
'GPUCanvasContext': { 'GPUCanvasContext': {