Register media instance with session and prepare communication with embedder

This commit is contained in:
Fernando Jiménez Moreno 2019-10-08 10:18:13 +02:00
parent 9c329a7935
commit 4d147d2c56
8 changed files with 107 additions and 4 deletions

View file

@ -3993,6 +3993,19 @@ impl ScriptThread {
.remove(&browsing_context_id);
})
}
pub fn get_media_session(
browsing_context_id: TopLevelBrowsingContextId,
) -> Option<DomRoot<MediaSession>> {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };
script_thread
.media_sessions
.borrow()
.get(&browsing_context_id)
.map(|s| DomRoot::from_ref(&**s))
})
}
}
impl Drop for ScriptThread {