aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-10-08 10:18:13 +0200
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2019-11-20 13:33:14 +0100
commit4d147d2c56465405e7c3281073ef57fe1bd1c062 (patch)
tree7098eaa3bcccf06c44696023352eec78736b7027 /components/script/script_thread.rs
parent9c329a79354cb8b6c1000aa7c78364a5541de421 (diff)
downloadservo-4d147d2c56465405e7c3281073ef57fe1bd1c062.tar.gz
servo-4d147d2c56465405e7c3281073ef57fe1bd1c062.zip
Register media instance with session and prepare communication with embedder
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index ec1f5852060..e7b39d26420 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -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 {