mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
edc304854f
commit
575e885529
50 changed files with 422 additions and 221 deletions
|
@ -20,6 +20,7 @@ use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
|
|||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::promise::Promise;
|
||||
use crate::realms::InRealm;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattserver
|
||||
#[dom_struct]
|
||||
|
@ -70,9 +71,9 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
|||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connect
|
||||
#[allow(unsafe_code)]
|
||||
fn Connect(&self, comp: InRealm) -> Rc<Promise> {
|
||||
fn Connect(&self, comp: InRealm, can_gc: CanGc) -> Rc<Promise> {
|
||||
// Step 1.
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
let p = Promise::new_in_current_realm(comp, can_gc);
|
||||
let sender = response_async(&p, self);
|
||||
|
||||
// TODO: Step 3: Check if the UA is currently using the Bluetooth system.
|
||||
|
@ -110,7 +111,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
|||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice
|
||||
fn GetPrimaryService(&self, service: BluetoothServiceUUID) -> Rc<Promise> {
|
||||
fn GetPrimaryService(&self, service: BluetoothServiceUUID, can_gc: CanGc) -> Rc<Promise> {
|
||||
// Step 1 - 2.
|
||||
get_gatt_children(
|
||||
self,
|
||||
|
@ -120,11 +121,16 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
|||
String::from(self.Device().Id()),
|
||||
self.Device().get_gatt().Connected(),
|
||||
GATTType::PrimaryService,
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservices
|
||||
fn GetPrimaryServices(&self, service: Option<BluetoothServiceUUID>) -> Rc<Promise> {
|
||||
fn GetPrimaryServices(
|
||||
&self,
|
||||
service: Option<BluetoothServiceUUID>,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
// Step 1 - 2.
|
||||
get_gatt_children(
|
||||
self,
|
||||
|
@ -134,6 +140,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
|||
String::from(self.Device().Id()),
|
||||
self.Connected(),
|
||||
GATTType::PrimaryService,
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue