Bug 145806 - Implement MediaSessionManager to keep track of all MediaSessions
Summary: Implement MediaSessionManager to keep track of all MediaSessions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 145411
  Show dependency treegraph
 
Reported: 2015-06-09 10:25 PDT by Matt Rajca
Modified: 2015-06-09 15:57 PDT (History)
6 users (show)

See Also:


Attachments
Patch (11.28 KB, patch)
2015-06-09 10:40 PDT, Matt Rajca
no flags Details | Formatted Diff | Diff
Patch (11.27 KB, patch)
2015-06-09 12:12 PDT, Matt Rajca
no flags Details | Formatted Diff | Diff
Patch (11.15 KB, patch)
2015-06-09 14:01 PDT, Matt Rajca
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Rajca 2015-06-09 10:25:03 PDT
As described in the Media Session spec, MediaPlayPause events need to be handled by each Media Session, and we need a MediaSessionManager to keep track of them.
Comment 1 Radar WebKit Bug Importer 2015-06-09 10:26:27 PDT
<rdar://problem/21302849>
Comment 2 Matt Rajca 2015-06-09 10:40:09 PDT
Created attachment 254580 [details]
Patch
Comment 3 Darin Adler 2015-06-09 11:04:14 PDT
Comment on attachment 254580 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=254580&action=review

> Source/WebCore/Modules/mediasession/MediaSessionManager.cpp:49
> +    m_sessions.remove(m_sessions.find(&session));

Normally it’s not good to use remove/find. I’d suggest using a HashSet or ListHashSet for this collection instead of a vector.
Comment 4 Matt Rajca 2015-06-09 12:12:43 PDT
Created attachment 254585 [details]
Patch
Comment 5 Matt Rajca 2015-06-09 12:14:35 PDT
(In reply to comment #3)
> Comment on attachment 254580 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=254580&action=review
> 
> > Source/WebCore/Modules/mediasession/MediaSessionManager.cpp:49
> > +    m_sessions.remove(m_sessions.find(&session));
> 
> Normally it’s not good to use remove/find. I’d suggest using a HashSet or
> ListHashSet for this collection instead of a vector.

Settled on HashSet since we don't care about the ordering of MediaSessions. Thanks!
Comment 6 Eric Carlson 2015-06-09 13:53:24 PDT
Comment on attachment 254585 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=254585&action=review

> Source/WebCore/Modules/mediasession/MediaSessionManager.h:41
> +    const HashSet<MediaSession*>& sessions() const { return m_sessions; }

Is there any reason to not make this private?
Comment 7 Matt Rajca 2015-06-09 14:00:46 PDT
(In reply to comment #6)
> Comment on attachment 254585 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=254585&action=review
> 
> > Source/WebCore/Modules/mediasession/MediaSessionManager.h:41
> > +    const HashSet<MediaSession*>& sessions() const { return m_sessions; }
> 
> Is there any reason to not make this private?

I have other uncommitted code here locally that requires it to be public, but that is probably going to get refactored anyway. I'll remove the accessor for now.
Comment 8 Matt Rajca 2015-06-09 14:01:13 PDT
Created attachment 254599 [details]
Patch
Comment 9 WebKit Commit Bot 2015-06-09 15:57:36 PDT
Comment on attachment 254599 [details]
Patch

Clearing flags on attachment: 254599

Committed r185389: <http://trac.webkit.org/changeset/185389>
Comment 10 WebKit Commit Bot 2015-06-09 15:57:40 PDT
All reviewed patches have been landed.  Closing bug.