From 7101a9d070dd3d7bb89475e125de65f85f93221e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Fri, 4 Oct 2019 12:54:16 +0200 Subject: Use BrowsingContextId for MediaSession registration --- components/script/script_thread.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'components/script/script_thread.rs') diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 5aec6a8a57d..2bd7cc4907b 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -698,10 +698,10 @@ pub struct ScriptThread { /// Code is running as a consequence of a user interaction is_user_interacting: Cell, - /// The MediaSessions registered for this Pipeline, if any. - /// There can only be one active MediaSession. The constellation - /// has the PipelineId of the active MediaSession, if any. - media_sessions: DomRefCell>>, + /// The MediaSessions known by this thread, if any. + /// There can only be one active MediaSession. + /// The constellation has the BrowsingContextId of the active MediaSession, if any. + media_sessions: DomRefCell>>, } /// In the event of thread panic, all data on the stack runs its destructor. However, there @@ -3956,23 +3956,26 @@ impl ScriptThread { ) } - pub fn register_media_session(media_session: &MediaSession, pipeline_id: PipelineId) { + pub fn register_media_session( + media_session: &MediaSession, + browsing_context_id: TopLevelBrowsingContextId, + ) { SCRIPT_THREAD_ROOT.with(|root| { let script_thread = unsafe { &*root.get().unwrap() }; script_thread .media_sessions .borrow_mut() - .insert(pipeline_id, Dom::from_ref(media_session)); + .insert(browsing_context_id, Dom::from_ref(media_session)); }) } - pub fn remove_media_session(pipeline_id: PipelineId) { + pub fn remove_media_session(browsing_context_id: TopLevelBrowsingContextId) { SCRIPT_THREAD_ROOT.with(|root| { let script_thread = unsafe { &*root.get().unwrap() }; script_thread .media_sessions .borrow_mut() - .remove(&pipeline_id); + .remove(&browsing_context_id); }) } } -- cgit v1.2.3