Bug 146282

Summary: MediaSession: propagate MediaSessionMetadata to WebPageProxy
Product: WebKit Reporter: Matt Rajca <mrajca>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: conrad_shultz, eric.carlson, jer.noble, mrajca, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 145411    
Attachments:
Description Flags
Patch
none
Patch darin: review+

Description Matt Rajca 2015-06-24 09:59:00 PDT
Propagate changes to MediaSessionMetadata to WebPageProxy for clients to ultimately respond to.
Comment 1 Radar WebKit Bug Importer 2015-06-24 09:59:41 PDT
<rdar://problem/21525952>
Comment 2 Matt Rajca 2015-06-24 10:15:09 PDT
Created attachment 255489 [details]
Patch
Comment 3 Eric Carlson 2015-06-24 10:19:32 PDT
Comment on attachment 255489 [details]
Patch

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

> Source/WebKit2/Shared/WebCoreArgumentCoders.cpp:91
> +#import <WebCore/MediaSessionMetadata.h>

This (and the one above :-O) should be "#include", not "#import".
Comment 4 Matt Rajca 2015-06-24 10:32:32 PDT
(In reply to comment #3)
> Comment on attachment 255489 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=255489&action=review
> 
> > Source/WebKit2/Shared/WebCoreArgumentCoders.cpp:91
> > +#import <WebCore/MediaSessionMetadata.h>
> 
> This (and the one above :-O) should be "#include", not "#import".

Fixed. I filed a separate bug (Bug 146283) for the one above.
Comment 5 Matt Rajca 2015-06-24 10:49:47 PDT
Created attachment 255491 [details]
Patch
Comment 6 Darin Adler 2015-06-24 14:58:10 PDT
Comment on attachment 255491 [details]
Patch

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

> Source/WebCore/Modules/mediasession/MediaSession.cpp:104
> +    m_document.page()->chrome().client().mediaSessionMetadataDidChange(m_metadata);

What guarantees that page() is not null here? We should check it for null unless there is an ironclad guarantee it can’t be.

> Source/WebCore/page/ChromeClient.h:50
> +#if ENABLE(MEDIA_SESSION)
> +#include "MediaSessionMetadata.h"
> +#endif

We should not include this header. We should be able to just forward-declare MediaSessionMetadata to compile this header.
Comment 7 Tim Horton 2015-06-24 14:58:54 PDT
Comment on attachment 255491 [details]
Patch

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

> Source/WebCore/page/ChromeClient.h:49
> +#include "MediaSessionMetadata.h"

Please forward-declare instead of including this header (it seems like you can, right?). ChromeClient.h is included in a billion places and this will just make the build slower.

> Source/WebKit2/UIProcess/WebPageProxy.cpp:5775
> +{

I assume you're going to put something here in a near-future patch?

> Source/WebKit2/UIProcess/WebPageProxy.h:123
> +#if ENABLE(MEDIA_SESSION)
> +#include <WebCore/MediaSessionMetadata.h>

Ditto here.
Comment 8 Matt Rajca 2015-06-24 15:31:07 PDT
(In reply to comment #7)
> Comment on attachment 255491 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=255491&action=review
> 
> > Source/WebCore/page/ChromeClient.h:49
> > +#include "MediaSessionMetadata.h"
> 
> Please forward-declare instead of including this header (it seems like you
> can, right?). ChromeClient.h is included in a billion places and this will
> just make the build slower.

Yup, fixed.

> 
> > Source/WebKit2/UIProcess/WebPageProxy.cpp:5775
> > +{
> 
> I assume you're going to put something here in a near-future patch?

Yes. I have the changes locally.

> 
> > Source/WebKit2/UIProcess/WebPageProxy.h:123
> > +#if ENABLE(MEDIA_SESSION)
> > +#include <WebCore/MediaSessionMetadata.h>
> 
> Ditto here.

Changed.
Comment 9 Matt Rajca 2015-06-24 15:32:18 PDT
(In reply to comment #6)
> Comment on attachment 255491 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=255491&action=review
> 
> > Source/WebCore/Modules/mediasession/MediaSession.cpp:104
> > +    m_document.page()->chrome().client().mediaSessionMetadataDidChange(m_metadata);
> 
> What guarantees that page() is not null here? We should check it for null
> unless there is an ironclad guarantee it can’t be.

Added the null check.

> 
> > Source/WebCore/page/ChromeClient.h:50
> > +#if ENABLE(MEDIA_SESSION)
> > +#include "MediaSessionMetadata.h"
> > +#endif
> 
> We should not include this header. We should be able to just forward-declare
> MediaSessionMetadata to compile this header.

Changed. Thanks!
Comment 10 Matt Rajca 2015-06-24 15:39:12 PDT
Committed r185929: <http://trac.webkit.org/changeset/185929>