Mark promise creation methods with CanGc (#33928)

* Add CanGc annotations to promise constructor.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Propagate CanGc arguments for Promise::new_in_current_realm.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix out-of-order entries.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Propagate CanGc from Promise::new.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Suppress clippy warning.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2024-10-22 05:35:20 -04:00 committed by GitHub
parent edc304854f
commit 575e885529
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 422 additions and 221 deletions

View file

@ -108,9 +108,14 @@ impl Drop for GPUAdapter {
impl GPUAdapterMethods for GPUAdapter {
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapter-requestdevice>
fn RequestDevice(&self, descriptor: &GPUDeviceDescriptor, comp: InRealm) -> Rc<Promise> {
fn RequestDevice(
&self,
descriptor: &GPUDeviceDescriptor,
comp: InRealm,
can_gc: CanGc,
) -> Rc<Promise> {
// Step 2
let promise = Promise::new_in_current_realm(comp);
let promise = Promise::new_in_current_realm(comp, can_gc);
let sender = response_async(&promise, self);
let mut required_features = wgt::Features::empty();
for &ext in descriptor.requiredFeatures.iter() {
@ -171,10 +176,15 @@ impl GPUAdapterMethods for GPUAdapter {
}
/// <https://gpuweb.github.io/gpuweb/#dom-gpuadapter-requestadapterinfo>
fn RequestAdapterInfo(&self, unmask_hints: Vec<DOMString>, comp: InRealm) -> Rc<Promise> {
fn RequestAdapterInfo(
&self,
unmask_hints: Vec<DOMString>,
comp: InRealm,
can_gc: CanGc,
) -> Rc<Promise> {
// XXX: Adapter info should be generated here ...
// Step 1
let promise = Promise::new_in_current_realm(comp);
let promise = Promise::new_in_current_realm(comp, can_gc);
// Step 4
if !unmask_hints.is_empty() {
todo!("unmaskHints on RequestAdapterInfo");