Support multiple MediaPlayerHost connections per frame
With the previous set-up, MediaWebContentsObserver::BindMediaPlayerHost() contained a hidden assumption that a RenderFrameHost uniquely identifies a media element. When another element was created within the same frame, BindMediaPlayerHostReceiver() would reset the connection to the renderer that was set up previously. As a result, MediaPlayerHost messages for the media elements created earlier were not reaching the browser if a frame created multiple media elements. To fix this, we add support for multiple MediaPlayerHost connections from a single frame, one for each HTMLMediaElement, with each HTMLMediaElement calling mojom::MediaPlayerHost::OnMediaPlayerAdded() through a dedicated connection. The disconnect handler for MediaPlayerHost receivers is gone. It could have been reimplemented as a handler on the ReceiverSet, removing MediaPlayerHostImpl from MediaWebContentsObserver when the receiver set becomes empty. However, this removal is effectively a 'delete this' operation and it doesn't seem necessary. By the time there are no receivers, the MediaPlayerHostImpl object is just an empty ReceiverSet and two pointers. It is cleaned up upon render frame deletion. Bug: 1167154 Change-Id: Idd7873da91ee452c91b2f4667f29a1aa80831678 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2632691 Commit-Queue: Wojciech Dzierżanowski <wdzierzanowski@opera.com> Reviewed-by:Mario Sanchez Prada <mario@igalia.com> Reviewed-by:
Chrome Cunningham <chcunningham@chromium.org> Cr-Commit-Position: refs/heads/master@{#845371}
Showing
Please register or sign in to comment