<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Media Session: push paused state to the media session focus manager instead of polling"
href="https://bugs.webkit.org/show_bug.cgi?id=147633#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Media Session: push paused state to the media session focus manager instead of polling"
href="https://bugs.webkit.org/show_bug.cgi?id=147633">bug 147633</a>
from <span class="vcard"><a class="email" href="mailto:mrajca@apple.com" title="Matt Rajca <mrajca@apple.com>"> <span class="fn">Matt Rajca</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=147633#c3">comment #3</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=258277&action=diff" name="attach_258277" title="Patch">attachment 258277</a> <a href="attachment.cgi?id=258277&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=258277&action=review">https://bugs.webkit.org/attachment.cgi?id=258277&action=review</a>
>
> This looks good modulo my minor comments, but I am now a WK2 reviewer so
> someone else will have to give the official r+.
>
> > Source/WebCore/Modules/webaudio/AudioContext.cpp:344
> > +#if ENABLE(MEDIA_SESSION)
> > + document()->updateIsPlayingMedia(HTMLMediaElementUnknownID);
> > +#else
> > + document()->updateIsPlayingMedia(0);
> > +#endif
>
> Nit: if you don't guard HTMLMediaElementUnknownID with
> "ENABLE(MEDIA_SESSION)" you won't need the #if here.</span >
Removed it to simplify subsequent code (1).
<span class="quote">>
> Also, the name "HTMLMediaElementUnknownID" is not quite correct because it
> isn't an HTMLMediaElement at all. Maybe HTMLMediaElementInvalidID?</span >
Renamed.
<span class="quote">>
> > Source/WebCore/Modules/webaudio/AudioContext.cpp:1085
> > +#if ENABLE(MEDIA_SESSION)
> > + strongThis->document()->updateIsPlayingMedia(HTMLMediaElementUnknownID);
> > +#else
> > + strongThis->document()->updateIsPlayingMedia(0);
> > +#endif
>
> Ditto.</span >
Simplified this after fixing (1).
<span class="quote">>
> > Source/WebCore/dom/Document.cpp:3505
> > +#if ENABLE(MEDIA_SESSION)
> > + updateIsPlayingMedia(HTMLMediaElementUnknownID);
> > +#else
> > + updateIsPlayingMedia(0);
> > +#endif
>
> Ditto.</span >
Simplified this after fixing (1).
<span class="quote">>
> > Source/WebCore/dom/Document.cpp:3516
> > +#if ENABLE(MEDIA_SESSION)
> > + updateIsPlayingMedia(HTMLMediaElementUnknownID);
> > +#else
> > + updateIsPlayingMedia(0);
> > +#endif
>
> Ditto.</span >
Simplified this after fixing (1).
<span class="quote">>
> > Source/WebCore/dom/Document.cpp:3529
> > + if (HTMLMediaElement* sourceElement = HTMLMediaElement::elementWithID(sourceElementID)) {
> > + if (sourceElement->isPlaying())
> > + state |= MediaProducer::IsSourcePlaying;
> > + }
>
> Nit: you can prevent the failed lookup by checking for
> HTMLMediaElementUnknownID (or HTMLMediaElementInvalidID, or whatever you
> use).</span >
I prefer just checking if the pointer is null (even if it's logically equivalent to checking for an invalid ID). Feels safer.
<span class="quote">>
> > Source/WebCore/page/MediaProducer.h:43
> > +#if ENABLE(MEDIA_SESSION)
> > + IsSourcePlaying = 1 << 6,
> > +#endif
>
> I don't think you need to #if this flag.</span >
Removed.
<span class="quote">>
> > Source/WebKit2/UIProcess/WebPageProxy.cpp:5947
> > + if (focusManager->focusedMediaElementPage() == this && focusManager->focusedMediaElementID() == sourceElementID)
> > + focusManager->setFocusedMediaElementIsPlaying(state & MediaProducer::IsSourcePlaying);
>
> This seems like the wrong place for this logic. Why not pass the element ID
> into the focus manager so you can keep all of the focus logic there.</span >
Refactored.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>