RESOLVED FIXED 154823
Mac: Adopt the new version of AVOutputDeviceMenuController's showMenuForRect method
https://bugs.webkit.org/show_bug.cgi?id=154823
Summary Mac: Adopt the new version of AVOutputDeviceMenuController's showMenuForRect ...
Ada Chan
Reported 2016-02-29 10:35:49 PST
Mac: Adopt the new version of AVOutputDeviceMenuController's showMenuForRect method
Attachments
Patch (46.49 KB, patch)
2016-02-29 10:43 PST, Ada Chan
no flags
Patch (47.24 KB, patch)
2016-02-29 13:37 PST, Ada Chan
no flags
Patch (47.74 KB, patch)
2016-03-01 11:37 PST, Ada Chan
no flags
Patch (47.21 KB, patch)
2016-03-01 15:27 PST, Ada Chan
thorton: review+
Ada Chan
Comment 1 2016-02-29 10:37:06 PST
Ada Chan
Comment 2 2016-02-29 10:43:08 PST
Ada Chan
Comment 3 2016-02-29 13:30:36 PST
Comment on attachment 272503 [details] Patch Need to update AVKitSPI.h. Will send an updated patch soon.
Ada Chan
Comment 4 2016-02-29 13:37:18 PST
Darin Adler
Comment 5 2016-02-29 16:17:20 PST
Comment on attachment 272513 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=272513&action=review > Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp:277 > + for (size_t i = 0; i < m_clientState.size(); ++i) { > + auto& state = m_clientState[i]; > + Should use a modern for loop: for (auto& state : m_clientState) { > Source/WebCore/dom/Document.cpp:6890 > + auto it = m_idToClientMap.find(clientId); > + if (it == m_idToClientMap.end()) > + return; > + > + it->value->customPlaybackActionSelected(); When a map’s values are pointers, you can do this in a way that’s less complex with get: if (auto* client = m_idToClientMap.get(clientId)) client->customPlaybackActionSelected(); I have no idea why the functions above don’t do it this simpler way. > Source/WebCore/html/HTMLMediaElement.cpp:5217 > + return String(); There’s now a more terse way of writing the null string: return { }; > Source/WebCore/html/MediaElementSession.cpp:53 > +#if PLATFORM(MAC) > +#include "HTMLMediaElementEnums.h" > +#endif This seems peculiar. The code below is in #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS) so it doesn't seem right to put the #include in #if PLATFORM(MAC). Maybe make the include unconditional? Or match the conditional around the code below exactly? > Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h:73 > + WEBCORE_EXPORT void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override; A little bit strange to have the argument be WTF::String rather than const WTF::String&, but that’s in the base class too, not just here. > Source/WebKit/mac/WebView/WebView.mm:8743 > + [self _devicePicker]->showPlaybackTargetPicker(clientId, rectInScreenCoordinates, hasVideo, String()); Can use { } here instead of String().
Ada Chan
Comment 6 2016-03-01 11:35:50 PST
Thanks for the feedback! (In reply to comment #5) > Comment on attachment 272513 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=272513&action=review > > > Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp:277 > > + for (size_t i = 0; i < m_clientState.size(); ++i) { > > + auto& state = m_clientState[i]; > > + > > Should use a modern for loop: > > for (auto& state : m_clientState) { Fixed. > > > Source/WebCore/dom/Document.cpp:6890 > > + auto it = m_idToClientMap.find(clientId); > > + if (it == m_idToClientMap.end()) > > + return; > > + > > + it->value->customPlaybackActionSelected(); > > When a map’s values are pointers, you can do this in a way that’s less > complex with get: > > if (auto* client = m_idToClientMap.get(clientId)) > client->customPlaybackActionSelected(); > > I have no idea why the functions above don’t do it this simpler way. Fixed. > > > Source/WebCore/html/HTMLMediaElement.cpp:5217 > > + return String(); > > There’s now a more terse way of writing the null string: > > return { }; Fixed. > > > Source/WebCore/html/MediaElementSession.cpp:53 > > +#if PLATFORM(MAC) > > +#include "HTMLMediaElementEnums.h" > > +#endif > > This seems peculiar. The code below is in #if > ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS) so it doesn't seem right > to put the #include in #if PLATFORM(MAC). Maybe make the include > unconditional? Or match the conditional around the code below exactly? I made the include unconditional. > > > Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h:73 > > + WEBCORE_EXPORT void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override; > > A little bit strange to have the argument be WTF::String rather than const > WTF::String&, but that’s in the base class too, not just here. > > > Source/WebKit/mac/WebView/WebView.mm:8743 > > + [self _devicePicker]->showPlaybackTargetPicker(clientId, rectInScreenCoordinates, hasVideo, String()); > > Can use { } here instead of String(). Fixed. I had to add a forward declaration for the SPI in MediaPlaybackTargetPickerMac.mm to get things to compile for systems without that SPI. Will post an updated patch soon.
Ada Chan
Comment 7 2016-03-01 11:37:11 PST
Ada Chan
Comment 8 2016-03-01 15:25:07 PST
Removing the forward declaration since it's no longer a requirement to support building without the SPI in the headers.
Ada Chan
Comment 9 2016-03-01 15:27:14 PST
Ada Chan
Comment 10 2016-03-01 17:15:37 PST
Note You need to log in before you can comment on or make changes to this bug.