mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Propagate CanGc
arguments through callers in constructors (#35541)
Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
This commit is contained in:
parent
5465bfc2af
commit
863d2ce871
260 changed files with 986 additions and 603 deletions
|
@ -43,8 +43,8 @@ impl GPU {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope) -> DomRoot<GPU> {
|
||||
reflect_dom_object(Box::new(GPU::new_inherited()), global, CanGc::note())
|
||||
pub(crate) fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<GPU> {
|
||||
reflect_dom_object(Box::new(GPU::new_inherited()), global, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,14 +79,14 @@ impl GPUAdapter {
|
|||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
let features = GPUSupportedFeatures::Constructor(global, None, features, can_gc).unwrap();
|
||||
let limits = GPUSupportedLimits::new(global, limits);
|
||||
let info = GPUAdapterInfo::new(global, info);
|
||||
let limits = GPUSupportedLimits::new(global, limits, can_gc);
|
||||
let info = GPUAdapterInfo::new(global, info, can_gc);
|
||||
reflect_dom_object(
|
||||
Box::new(GPUAdapter::new_inherited(
|
||||
channel, name, extensions, &features, &limits, &info, adapter,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ impl GPUAdapterInfo {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope, info: AdapterInfo) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited(info)), global, CanGc::note())
|
||||
pub(crate) fn new(global: &GlobalScope, info: AdapterInfo, can_gc: CanGc) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited(info)), global, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,13 +60,14 @@ impl GPUBindGroup {
|
|||
device: WebGPUDevice,
|
||||
layout: &GPUBindGroupLayout,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUBindGroup::new_inherited(
|
||||
channel, bind_group, device, layout, label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -113,6 +114,7 @@ impl GPUBindGroup {
|
|||
device.id(),
|
||||
&descriptor.layout,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ impl GPUBindGroupLayout {
|
|||
channel: WebGPU,
|
||||
bind_group_layout: WebGPUBindGroupLayout,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUBindGroupLayout::new_inherited(
|
||||
|
@ -60,7 +61,7 @@ impl GPUBindGroupLayout {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +111,7 @@ impl GPUBindGroupLayout {
|
|||
device.channel().clone(),
|
||||
bgl,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,13 +116,14 @@ impl GPUBuffer {
|
|||
usage: GPUFlagsConstant,
|
||||
mapping: Option<ActiveBufferMapping>,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUBuffer::new_inherited(
|
||||
channel, buffer, device, size, usage, mapping, label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -174,6 +175,7 @@ impl GPUBuffer {
|
|||
descriptor.usage,
|
||||
mapping,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ impl GPUCanvasContext {
|
|||
global: &GlobalScope,
|
||||
canvas: &HTMLCanvasElement,
|
||||
channel: WebGPU,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
let document = canvas.owner_document();
|
||||
let this = reflect_dom_object(
|
||||
|
@ -154,7 +155,7 @@ impl GPUCanvasContext {
|
|||
document.webgpu_contexts(),
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
);
|
||||
this.webgpu_contexts
|
||||
.borrow_mut()
|
||||
|
|
|
@ -43,6 +43,7 @@ impl GPUCommandBuffer {
|
|||
channel: WebGPU,
|
||||
command_buffer: WebGPUCommandBuffer,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUCommandBuffer::new_inherited(
|
||||
|
@ -51,7 +52,7 @@ impl GPUCommandBuffer {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,13 +63,14 @@ impl GPUCommandEncoder {
|
|||
device: &GPUDevice,
|
||||
encoder: WebGPUCommandEncoder,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUCommandEncoder::new_inherited(
|
||||
channel, device, encoder, label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +110,7 @@ impl GPUCommandEncoder {
|
|||
device,
|
||||
encoder,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -146,6 +148,7 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> for GPUCommandEncoder {
|
|||
self,
|
||||
WebGPUComputePass(compute_pass_id),
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -215,6 +218,7 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> for GPUCommandEncoder {
|
|||
WebGPURenderPass(render_pass_id),
|
||||
self,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -319,6 +323,7 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> for GPUCommandEncoder {
|
|||
self.channel.clone(),
|
||||
buffer,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ impl GPUCompilationMessage {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
message: DOMString,
|
||||
|
@ -56,13 +57,14 @@ impl GPUCompilationMessage {
|
|||
line_pos: u64,
|
||||
offset: u64,
|
||||
length: u64,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(Self::new_inherited(
|
||||
message, mtype, line_num, line_pos, offset, length,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -75,6 +77,7 @@ impl GPUCompilationMessage {
|
|||
info.line_pos,
|
||||
info.offset,
|
||||
info.length,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ impl GPUComputePassEncoder {
|
|||
parent: &GPUCommandEncoder,
|
||||
compute_pass: WebGPUComputePass,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUComputePassEncoder::new_inherited(
|
||||
|
@ -60,7 +61,7 @@ impl GPUComputePassEncoder {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ impl GPUComputePipeline {
|
|||
compute_pipeline: WebGPUComputePipeline,
|
||||
label: USVString,
|
||||
device: &GPUDevice,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUComputePipeline::new_inherited(
|
||||
|
@ -61,7 +62,7 @@ impl GPUComputePipeline {
|
|||
device,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -137,6 +138,7 @@ impl GPUComputePipelineMethods<crate::DomTypeHolder> for GPUComputePipeline {
|
|||
self.channel.clone(),
|
||||
WebGPUBindGroupLayout(id),
|
||||
USVString::default(),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,8 +149,8 @@ impl GPUDevice {
|
|||
label: String,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
let queue = GPUQueue::new(global, channel.clone(), queue);
|
||||
let limits = GPUSupportedLimits::new(global, limits);
|
||||
let queue = GPUQueue::new(global, channel.clone(), queue, can_gc);
|
||||
let limits = GPUSupportedLimits::new(global, limits, can_gc);
|
||||
let features = GPUSupportedFeatures::Constructor(global, None, features, can_gc).unwrap();
|
||||
let lost_promise = Promise::new(global, can_gc);
|
||||
let device = reflect_dom_object(
|
||||
|
@ -372,7 +372,7 @@ impl GPUDevice {
|
|||
pub(crate) fn lose(&self, reason: GPUDeviceLostReason, msg: String) {
|
||||
let lost_promise = &(*self.lost_promise.borrow());
|
||||
let global = &self.global();
|
||||
let lost = GPUDeviceLostInfo::new(global, msg.into(), reason);
|
||||
let lost = GPUDeviceLostInfo::new(global, msg.into(), reason, CanGc::note());
|
||||
lost_promise.resolve_native(&*lost);
|
||||
}
|
||||
}
|
||||
|
@ -456,6 +456,7 @@ impl GPUDeviceMethods<crate::DomTypeHolder> for GPUDevice {
|
|||
compute_pipeline,
|
||||
descriptor.parent.parent.label.clone(),
|
||||
self,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -502,6 +503,7 @@ impl GPUDeviceMethods<crate::DomTypeHolder> for GPUDevice {
|
|||
render_pipeline,
|
||||
descriptor.parent.parent.label.clone(),
|
||||
self,
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -596,6 +598,7 @@ impl AsyncWGPUListener for GPUDevice {
|
|||
WebGPUComputePipeline(pipeline.id),
|
||||
pipeline.label.into(),
|
||||
self,
|
||||
can_gc,
|
||||
)),
|
||||
Err(webgpu::Error::Validation(msg)) => {
|
||||
promise.reject_native(&GPUPipelineError::new(
|
||||
|
@ -619,6 +622,7 @@ impl AsyncWGPUListener for GPUDevice {
|
|||
WebGPURenderPipeline(pipeline.id),
|
||||
pipeline.label.into(),
|
||||
self,
|
||||
can_gc,
|
||||
)),
|
||||
Err(webgpu::Error::Validation(msg)) => {
|
||||
promise.reject_native(&GPUPipelineError::new(
|
||||
|
|
|
@ -35,11 +35,12 @@ impl GPUDeviceLostInfo {
|
|||
global: &GlobalScope,
|
||||
message: DOMString,
|
||||
reason: GPUDeviceLostReason,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUDeviceLostInfo::new_inherited(message, reason)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ impl GPUPipelineLayout {
|
|||
pipeline_layout: WebGPUPipelineLayout,
|
||||
label: USVString,
|
||||
bgls: Vec<WebGPUBindGroupLayout>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUPipelineLayout::new_inherited(
|
||||
|
@ -64,7 +65,7 @@ impl GPUPipelineLayout {
|
|||
bgls,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -113,6 +114,7 @@ impl GPUPipelineLayout {
|
|||
pipeline_layout,
|
||||
descriptor.parent.label.clone(),
|
||||
bgls,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,11 +49,16 @@ impl GPUQueue {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope, channel: WebGPU, queue: WebGPUQueue) -> DomRoot<Self> {
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
queue: WebGPUQueue,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUQueue::new_inherited(channel, queue)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ impl GPURenderBundle {
|
|||
device: WebGPUDevice,
|
||||
channel: WebGPU,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPURenderBundle::new_inherited(
|
||||
|
@ -57,7 +58,7 @@ impl GPURenderBundle {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ impl GPURenderBundleEncoder {
|
|||
device: &GPUDevice,
|
||||
channel: WebGPU,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPURenderBundleEncoder::new_inherited(
|
||||
|
@ -72,7 +73,7 @@ impl GPURenderBundleEncoder {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +124,7 @@ impl GPURenderBundleEncoder {
|
|||
device,
|
||||
device.channel().clone(),
|
||||
descriptor.parent.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -277,6 +279,7 @@ impl GPURenderBundleEncoderMethods<crate::DomTypeHolder> for GPURenderBundleEnco
|
|||
self.device.id(),
|
||||
self.channel.clone(),
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ impl GPURenderPassEncoder {
|
|||
render_pass: WebGPURenderPass,
|
||||
parent: &GPUCommandEncoder,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPURenderPassEncoder::new_inherited(
|
||||
|
@ -66,7 +67,7 @@ impl GPURenderPassEncoder {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ impl GPURenderPipeline {
|
|||
render_pipeline: WebGPURenderPipeline,
|
||||
label: USVString,
|
||||
device: &GPUDevice,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPURenderPipeline::new_inherited(
|
||||
|
@ -58,7 +59,7 @@ impl GPURenderPipeline {
|
|||
device,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -126,6 +127,7 @@ impl GPURenderPipelineMethods<crate::DomTypeHolder> for GPURenderPipeline {
|
|||
self.channel.clone(),
|
||||
WebGPUBindGroupLayout(id),
|
||||
USVString::default(),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ impl GPUSampler {
|
|||
compare_enable: bool,
|
||||
sampler: WebGPUSampler,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUSampler::new_inherited(
|
||||
|
@ -67,7 +68,7 @@ impl GPUSampler {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +121,7 @@ impl GPUSampler {
|
|||
compare_enable,
|
||||
sampler,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ impl GPUShaderModule {
|
|||
shader_module: WebGPUShaderModule,
|
||||
label: USVString,
|
||||
promise: Rc<Promise>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUShaderModule::new_inherited(
|
||||
|
@ -68,7 +69,7 @@ impl GPUShaderModule {
|
|||
promise,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +94,7 @@ impl GPUShaderModule {
|
|||
WebGPUShaderModule(program_id),
|
||||
descriptor.parent.label.clone(),
|
||||
promise.clone(),
|
||||
CanGc::note(),
|
||||
);
|
||||
let sender = response_async(&promise, &*shader_module);
|
||||
device
|
||||
|
|
|
@ -29,8 +29,8 @@ impl GPUSupportedLimits {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope, limits: Limits) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited(limits)), global, CanGc::note())
|
||||
pub(crate) fn new(global: &GlobalScope, limits: Limits, can_gc: CanGc) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited(limits)), global, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ impl GPUTexture {
|
|||
format: GPUTextureFormat,
|
||||
texture_usage: u32,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUTexture::new_inherited(
|
||||
|
@ -101,7 +102,7 @@ impl GPUTexture {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -159,6 +160,7 @@ impl GPUTexture {
|
|||
descriptor.format,
|
||||
descriptor.usage,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -230,6 +232,7 @@ impl GPUTextureMethods<crate::DomTypeHolder> for GPUTexture {
|
|||
texture_view,
|
||||
self,
|
||||
descriptor.parent.label.clone(),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ impl GPUTextureView {
|
|||
texture_view: WebGPUTextureView,
|
||||
texture: &GPUTexture,
|
||||
label: USVString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<GPUTextureView> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUTextureView::new_inherited(
|
||||
|
@ -57,7 +58,7 @@ impl GPUTextureView {
|
|||
label,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue