mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
CanGc fixes starting from blob.rs, mediastream.rs, custom_event.rs (#33820)
Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
parent
bd8006afc5
commit
a55f9a37ec
9 changed files with 58 additions and 28 deletions
|
@ -25,6 +25,7 @@ use crate::dom::mediastream::MediaStream;
|
|||
use crate::dom::mediastreamtrack::MediaStreamTrack;
|
||||
use crate::dom::promise::Promise;
|
||||
use crate::realms::{AlreadyInRealm, InRealm};
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MediaDevices {
|
||||
|
@ -46,10 +47,15 @@ impl MediaDevices {
|
|||
impl MediaDevicesMethods for MediaDevices {
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediadevices-getusermedia>
|
||||
#[allow(unsafe_code)]
|
||||
fn GetUserMedia(&self, constraints: &MediaStreamConstraints, comp: InRealm) -> Rc<Promise> {
|
||||
fn GetUserMedia(
|
||||
&self,
|
||||
constraints: &MediaStreamConstraints,
|
||||
comp: InRealm,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
let p = Promise::new_in_current_realm(comp);
|
||||
let media = ServoMedia::get().unwrap();
|
||||
let stream = MediaStream::new(&self.global());
|
||||
let stream = MediaStream::new(&self.global(), can_gc);
|
||||
if let Some(constraints) = convert_constraints(&constraints.audio) {
|
||||
if let Some(audio) = media.create_audioinput_stream(constraints) {
|
||||
let track = MediaStreamTrack::new(&self.global(), audio, MediaStreamType::Audio);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue