Add CanGc argument to reflect_dom_object (#34606)

* applied mach fmt

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

Refinements

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

Modified reflect_dom_object signature and all its calls

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

* fix function calls when parameter is passed up

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

---------

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
This commit is contained in:
Domenico Rizzo 2024-12-13 16:51:59 +01:00 committed by GitHub
parent 471d3572b7
commit 0e9746fbbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
207 changed files with 570 additions and 101 deletions

View file

@ -41,7 +41,7 @@ impl GPU {
}
pub fn new(global: &GlobalScope) -> DomRoot<GPU> {
reflect_dom_object(Box::new(GPU::new_inherited()), global)
reflect_dom_object(Box::new(GPU::new_inherited()), global, CanGc::note())
}
}

View file

@ -86,6 +86,7 @@ impl GPUAdapter {
channel, name, extensions, &features, &limits, &info, adapter,
)),
global,
CanGc::note(),
)
}
}

View file

@ -9,6 +9,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUAdapterInfoMethod
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::CanGc;
use crate::test::DOMString;
#[dom_struct]
@ -28,7 +29,7 @@ impl GPUAdapterInfo {
}
pub fn new(global: &GlobalScope, info: AdapterInfo) -> DomRoot<Self> {
reflect_dom_object(Box::new(Self::new_inherited(info)), global)
reflect_dom_object(Box::new(Self::new_inherited(info)), global, CanGc::note())
}
}

View file

@ -19,6 +19,7 @@ use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gpubindgrouplayout::GPUBindGroupLayout;
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUBindGroup {
@ -65,6 +66,7 @@ impl GPUBindGroup {
channel, bind_group, device, layout, label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -20,6 +20,7 @@ use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gpuconvert::convert_bind_group_layout_entry;
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUBindGroupLayout {
@ -59,6 +60,7 @@ impl GPUBindGroupLayout {
label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -122,6 +122,7 @@ impl GPUBuffer {
channel, buffer, device, size, usage, mapping, label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -37,6 +37,7 @@ use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlcanvaselement::{HTMLCanvasElement, LayoutCanvasRenderingContextHelpers};
use crate::dom::node::{document_from_node, Node, NodeDamage};
use crate::script_runtime::CanGc;
impl HTMLCanvasElementOrOffscreenCanvas {
fn size(&self) -> Size2D<u64> {
@ -140,6 +141,7 @@ impl GPUCanvasContext {
channel,
)),
global,
CanGc::note(),
)
}
}

View file

@ -11,6 +11,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUCommandBuffer {
@ -50,6 +51,7 @@ impl GPUCommandBuffer {
label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -27,6 +27,7 @@ use crate::dom::webgpu::gpucomputepassencoder::GPUComputePassEncoder;
use crate::dom::webgpu::gpuconvert::{convert_load_op, convert_store_op};
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::dom::webgpu::gpurenderpassencoder::GPURenderPassEncoder;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUCommandEncoder {
@ -68,6 +69,7 @@ impl GPUCommandEncoder {
channel, device, encoder, label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -13,6 +13,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::types::GlobalScope;
use crate::script_runtime::CanGc;
use crate::test::DOMString;
#[dom_struct]
@ -61,6 +62,7 @@ impl GPUCompilationMessage {
message, mtype, line_num, line_pos, offset, length,
)),
global,
CanGc::note(),
)
}

View file

@ -15,6 +15,7 @@ use crate::dom::webgpu::gpubindgroup::GPUBindGroup;
use crate::dom::webgpu::gpubuffer::GPUBuffer;
use crate::dom::webgpu::gpucommandencoder::GPUCommandEncoder;
use crate::dom::webgpu::gpucomputepipeline::GPUComputePipeline;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUComputePassEncoder {
@ -59,6 +60,7 @@ impl GPUComputePassEncoder {
label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -19,6 +19,7 @@ use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gpubindgrouplayout::GPUBindGroupLayout;
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUComputePipeline {
@ -60,6 +61,7 @@ impl GPUComputePipeline {
device,
)),
global,
CanGc::note(),
)
}
}

View file

@ -166,6 +166,7 @@ impl GPUDevice {
lost_promise,
)),
global,
can_gc,
);
queue.set_device(&device);
device

View file

@ -13,6 +13,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUDeviceLostInfo {
@ -38,6 +39,7 @@ impl GPUDeviceLostInfo {
reflect_dom_object(
Box::new(GPUDeviceLostInfo::new_inherited(message, reason)),
global,
CanGc::note(),
)
}
}

View file

@ -18,6 +18,7 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUPipelineLayout {
@ -63,6 +64,7 @@ impl GPUPipelineLayout {
bgls,
)),
global,
CanGc::note(),
)
}
}

View file

@ -50,7 +50,11 @@ impl GPUQueue {
}
pub fn new(global: &GlobalScope, channel: WebGPU, queue: WebGPUQueue) -> DomRoot<Self> {
reflect_dom_object(Box::new(GPUQueue::new_inherited(channel, queue)), global)
reflect_dom_object(
Box::new(GPUQueue::new_inherited(channel, queue)),
global,
CanGc::note(),
)
}
}

View file

@ -11,6 +11,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPURenderBundle {
@ -56,6 +57,7 @@ impl GPURenderBundle {
label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -26,6 +26,7 @@ use crate::dom::webgpu::gpubuffer::GPUBuffer;
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::dom::webgpu::gpurenderbundle::GPURenderBundle;
use crate::dom::webgpu::gpurenderpipeline::GPURenderPipeline;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPURenderBundleEncoder {
@ -71,6 +72,7 @@ impl GPURenderBundleEncoder {
label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -21,6 +21,7 @@ use crate::dom::webgpu::gpubuffer::GPUBuffer;
use crate::dom::webgpu::gpucommandencoder::GPUCommandEncoder;
use crate::dom::webgpu::gpurenderbundle::GPURenderBundle;
use crate::dom::webgpu::gpurenderpipeline::GPURenderPipeline;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPURenderPassEncoder {
@ -65,6 +66,7 @@ impl GPURenderPassEncoder {
label,
)),
global,
CanGc::note(),
)
}

View file

@ -16,6 +16,7 @@ use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gpubindgrouplayout::GPUBindGroupLayout;
use crate::dom::webgpu::gpudevice::{GPUDevice, PipelineLayout};
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPURenderPipeline {
@ -57,6 +58,7 @@ impl GPURenderPipeline {
device,
)),
global,
CanGc::note(),
)
}
}

View file

@ -16,6 +16,7 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUSampler {
@ -66,6 +67,7 @@ impl GPUSampler {
label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -68,6 +68,7 @@ impl GPUShaderModule {
promise,
)),
global,
CanGc::note(),
)
}
}

View file

@ -11,6 +11,7 @@ use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUSupportedLimits_B
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUSupportedLimits {
@ -29,7 +30,7 @@ impl GPUSupportedLimits {
}
pub fn new(global: &GlobalScope, limits: Limits) -> DomRoot<Self> {
reflect_dom_object(Box::new(Self::new_inherited(limits)), global)
reflect_dom_object(Box::new(Self::new_inherited(limits)), global, CanGc::note())
}
}

View file

@ -22,6 +22,7 @@ use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::dom::webgpu::gputextureview::GPUTextureView;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUTexture {
@ -100,6 +101,7 @@ impl GPUTexture {
label,
)),
global,
CanGc::note(),
)
}
}

View file

@ -12,6 +12,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gputexture::GPUTexture;
use crate::script_runtime::CanGc;
#[dom_struct]
pub struct GPUTextureView {
@ -56,6 +57,7 @@ impl GPUTextureView {
label,
)),
global,
CanGc::note(),
)
}
}