mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add AsHandleValue trait to Heap<Value> and make Heap values rooted (#38024)
Encapsulates the unsafe conversion from Heap<Value> to HandleValue<'a>, and reducing repetitive unsafe code at call. fix #37258
This commit is contained in:
parent
9416251cab
commit
04ec710e60
17 changed files with 204 additions and 146 deletions
|
@ -9,7 +9,7 @@ use std::cell::Cell;
|
|||
use std::rc::Rc;
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{Heap, JSObject};
|
||||
use js::jsapi::{HandleObject, Heap, JSObject};
|
||||
use webgpu_traits::{
|
||||
PopError, WebGPU, WebGPUComputePipeline, WebGPUComputePipelineResponse, WebGPUDevice,
|
||||
WebGPUPoppedErrorScopeResponse, WebGPUQueue, WebGPURenderPipeline,
|
||||
|
@ -114,7 +114,6 @@ impl GPUDevice {
|
|||
fn new_inherited(
|
||||
channel: WebGPU,
|
||||
adapter: &GPUAdapter,
|
||||
extensions: Heap<*mut JSObject>,
|
||||
features: &GPUSupportedFeatures,
|
||||
limits: &GPUSupportedLimits,
|
||||
device: WebGPUDevice,
|
||||
|
@ -126,7 +125,7 @@ impl GPUDevice {
|
|||
eventtarget: EventTarget::new_inherited(),
|
||||
channel,
|
||||
adapter: Dom::from_ref(adapter),
|
||||
extensions,
|
||||
extensions: Heap::default(),
|
||||
features: Dom::from_ref(features),
|
||||
limits: Dom::from_ref(limits),
|
||||
label: DomRefCell::new(USVString::from(label)),
|
||||
|
@ -142,7 +141,7 @@ impl GPUDevice {
|
|||
global: &GlobalScope,
|
||||
channel: WebGPU,
|
||||
adapter: &GPUAdapter,
|
||||
extensions: Heap<*mut JSObject>,
|
||||
extensions: HandleObject,
|
||||
features: wgpu_types::Features,
|
||||
limits: wgpu_types::Limits,
|
||||
device: WebGPUDevice,
|
||||
|
@ -158,7 +157,6 @@ impl GPUDevice {
|
|||
Box::new(GPUDevice::new_inherited(
|
||||
channel,
|
||||
adapter,
|
||||
extensions,
|
||||
&features,
|
||||
&limits,
|
||||
device,
|
||||
|
@ -170,6 +168,7 @@ impl GPUDevice {
|
|||
can_gc,
|
||||
);
|
||||
queue.set_device(&device);
|
||||
device.extensions.set(*extensions);
|
||||
device
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue