Bug 147629 - Media Session: add a focus manager that WebKit clients can use to access the focused media element
Summary: Media Session: add a focus manager that WebKit clients can use to access the ...
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:
Depends on:
Blocks: 145411
  Show dependency treegraph
 
Reported: 2015-08-04 09:50 PDT by Matt Rajca
Modified: 2015-08-04 16:55 PDT (History)
6 users (show)

See Also:


Attachments
Patch (59.80 KB, patch)
2015-08-04 10:11 PDT, Matt Rajca
no flags Details | Formatted Diff | Diff
Patch (59.93 KB, patch)
2015-08-04 10:57 PDT, Matt Rajca
no flags Details | Formatted Diff | Diff
Patch (59.93 KB, patch)
2015-08-04 11:39 PDT, Matt Rajca
no flags Details | Formatted Diff | Diff
Patch (59.89 KB, patch)
2015-08-04 16:36 PDT, Matt Rajca
thorton: review+
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-08-04 09:50:08 PDT
In the UI process, we keep track of the "focused" Content media element across all web processes. Clients should be able to access this state to get information about the focused media element such as its metadata or whether its paused. This is useful in UIs such as lock screens and notification areas.
Comment 1 Matt Rajca 2015-08-04 10:11:19 PDT
Created attachment 258180 [details]
Patch
Comment 2 WebKit Commit Bot 2015-08-04 10:13:10 PDT
Attachment 258180 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/WebPageProxy.cpp:3886:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
ERROR: Source/WebKit2/UIProcess/WebPageProxy.h:946:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 2 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Matt Rajca 2015-08-04 10:57:01 PDT
Created attachment 258184 [details]
Patch
Comment 4 WebKit Commit Bot 2015-08-04 10:58:42 PDT
Attachment 258184 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/WebPageProxy.cpp:3886:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
ERROR: Source/WebKit2/UIProcess/WebPageProxy.h:946:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 2 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Matt Rajca 2015-08-04 11:39:59 PDT
Created attachment 258191 [details]
Patch
Comment 6 WebKit Commit Bot 2015-08-04 11:43:31 PDT
Attachment 258191 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/WebPageProxy.cpp:3886:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
ERROR: Source/WebKit2/UIProcess/WebPageProxy.h:946:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 2 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Tim Horton 2015-08-04 16:29:18 PDT
Comment on attachment 258191 [details]
Patch

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

> Source/WebKit2/UIProcess/WebMediaSessionFocusManager.cpp:67
> +    ASSERT(proxy);

No real need for this assert if you're just going to go ahead and dereference the null pointer two lines away.

> Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h:38
> +typedef std::tuple<WebPageProxy*, uint64_t> FocusedMediaElement;

might be clearer if this is a std::pair? then you don't have the fairly surprising std::get in the impl. Unless you're planning to add more components.

> Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h:40
> +class WebMediaSessionFocusManager: public API::ObjectImpl<API::Object::Type::MediaSessionFocusManager>, public WebContextSupplement {

space before the colon

> Source/WebKit2/WebKit2.xcodeproj/project.pbxproj:-7626
> -				15739BBD1B42042D00D258C1 /* WebUserMediaClient.h in Headers */,

This patch is doing a surprising about of xcodeproj reordering.
Comment 8 Matt Rajca 2015-08-04 16:35:08 PDT
(In reply to comment #7)
> Comment on attachment 258191 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=258191&action=review
> 
> > Source/WebKit2/UIProcess/WebMediaSessionFocusManager.cpp:67
> > +    ASSERT(proxy);
> 
> No real need for this assert if you're just going to go ahead and
> dereference the null pointer two lines away.

Removed.

> 
> > Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h:38
> > +typedef std::tuple<WebPageProxy*, uint64_t> FocusedMediaElement;
> 
> might be clearer if this is a std::pair? then you don't have the fairly
> surprising std::get in the impl. Unless you're planning to add more
> components.

Switched to std::pair. Much cleaner.

> 
> > Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h:40
> > +class WebMediaSessionFocusManager: public API::ObjectImpl<API::Object::Type::MediaSessionFocusManager>, public WebContextSupplement {
> 
> space before the colon

Added.

> 
> > Source/WebKit2/WebKit2.xcodeproj/project.pbxproj:-7626
> > -				15739BBD1B42042D00D258C1 /* WebUserMediaClient.h in Headers */,
> 
> This patch is doing a surprising about of xcodeproj reordering.

I just ran sort-xcode-project.
Comment 9 Matt Rajca 2015-08-04 16:36:28 PDT
Created attachment 258233 [details]
Patch
Comment 10 WebKit Commit Bot 2015-08-04 16:38:37 PDT
Attachment 258233 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/WebPageProxy.cpp:3886:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
ERROR: Source/WebKit2/UIProcess/WebPageProxy.h:946:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 2 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Tim Horton 2015-08-04 16:48:43 PDT
(In reply to comment #8)
> (In reply to comment #7)
> > Comment on attachment 258191 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=258191&action=review
> > 
> > > Source/WebKit2/UIProcess/WebMediaSessionFocusManager.cpp:67
> > > +    ASSERT(proxy);
> > 
> > No real need for this assert if you're just going to go ahead and
> > dereference the null pointer two lines away.
> 
> Removed.
> 
> > 
> > > Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h:38
> > > +typedef std::tuple<WebPageProxy*, uint64_t> FocusedMediaElement;
> > 
> > might be clearer if this is a std::pair? then you don't have the fairly
> > surprising std::get in the impl. Unless you're planning to add more
> > components.
> 
> Switched to std::pair. Much cleaner.
> 
> > 
> > > Source/WebKit2/UIProcess/WebMediaSessionFocusManager.h:40
> > > +class WebMediaSessionFocusManager: public API::ObjectImpl<API::Object::Type::MediaSessionFocusManager>, public WebContextSupplement {
> > 
> > space before the colon
> 
> Added.
> 
> > 
> > > Source/WebKit2/WebKit2.xcodeproj/project.pbxproj:-7626
> > > -				15739BBD1B42042D00D258C1 /* WebUserMediaClient.h in Headers */,
> > 
> > This patch is doing a surprising about of xcodeproj reordering.
> 
> I just ran sort-xcode-project.

Not usually recommended in a patch that is also doing other things (can make reverts more annoying than usual, especially). But, ok.
Comment 12 Matt Rajca 2015-08-04 16:55:29 PDT
Committed r187917: <http://trac.webkit.org/changeset/187917>