RESOLVED FIXED 223435
Move management of RemoteCommandListener from MediaSessionManagerCocoa into NowPlayingManager
https://bugs.webkit.org/show_bug.cgi?id=223435
Summary Move management of RemoteCommandListener from MediaSessionManagerCocoa into N...
Jean-Yves Avenard [:jya]
Reported 2021-03-18 03:37:27 PDT
sub-task of bug 223298 The NowPlayingManager already does almost the same work as done by MediaSessionManagerCocoa: 1- Setup and control RemoteCommandListener 2- Allow to set NowPlayingInfo to RemoteMedia instance. It does 2) via calling back the MediaSessionManagerCocoa::setNowPlayingInfo/clearPlayingInfo static method. NowPlayingManager is currently only used in the GPU process and acts as a proxy to MediaSessionManagerCocoa in the WebContent process. The flow currently being: with GPU process: MediaSessionManagerCocoa -> WebPlatformStrategies -> XPC to GPU -> GPUConnectionToWebProcess -> NowPlayingInfoManager -> MediaSessionManagerCocoa(static) -> MediaRemote without GPU process: MediaSessionManagerCocoa -> WebPlatformStrategies -> MediaSessionManagerCocoa(static) -> MediaRemote in bug 223298 we want to add special handling so that the MediaSessionManagerCocoa can set the NowPlayingInfo's artwork without having to always send the image. By doing: MediaSessionManagerCocoa -> NowPlayingInfoManager -> WebPlatformStrategies [-> XPC to GPU -> GPUConnectionToWebProcess] -> NowPlayingInfoManager -> MediaRemote We can simplify and centralise the code so that NowPlayingInfoManager will be responsible in calling the web strategies and the caching at both end of the XPC channel.
Attachments
Patch (489.68 KB, patch)
2021-03-20 03:41 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (28.18 KB, patch)
2021-03-20 05:13 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (28.07 KB, patch)
2021-03-22 16:45 PDT, Jean-Yves Avenard [:jya]
no flags
Radar WebKit Bug Importer
Comment 1 2021-03-18 03:37:49 PDT
Jean-Yves Avenard [:jya]
Comment 2 2021-03-20 03:41:08 PDT
Jean-Yves Avenard [:jya]
Comment 3 2021-03-20 05:13:42 PDT
Eric Carlson
Comment 4 2021-03-22 14:31:15 PDT
Comment on attachment 423814 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423814&action=review > Source/WebCore/platform/NowPlayingManager.cpp:65 > + m_setAsNowPlayingApplication = false; Do we need both `m_nowPlayingInfo` and `m_setAsNowPlayingApplication` now - couldn't we clear `m_nowPlayingInfo` here and check `!m_nowPlayingInfo` where we currently check `m_setAsNowPlayingApplication`? > Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:390 > + // FIXME: Eric, why is this call needed? This will reset the seek information from the one set in setNowPlayingInfo > updateSupportedRemoteCommands(); It is needed if we are just switched to a different element, which may have a different set of supported commands.
Jean-Yves Avenard [:jya]
Comment 5 2021-03-22 16:34:21 PDT
Comment on attachment 423814 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423814&action=review >> Source/WebCore/platform/NowPlayingManager.cpp:65 >> + m_setAsNowPlayingApplication = false; > > Do we need both `m_nowPlayingInfo` and `m_setAsNowPlayingApplication` now - couldn't we clear `m_nowPlayingInfo` here and check `!m_nowPlayingInfo` where we currently check `m_setAsNowPlayingApplication`? Not with the logic as-is m_setAsNowPlayingApplication is only set after the first call to setNowPlayingInfoPrivate, if we used to just check if m_nowPlayingInfo is set, then we would always pass true to MediaSessionManagerCocoa::setNowPlayingInfo And we need to set m_nowPlayingInfo before calling it as in bug 223298 as the parameter is const. So while we could probably combined the two members, I do feel like it would make the code harder to read. As such, I prefer to leave it as-is.
Jean-Yves Avenard [:jya]
Comment 6 2021-03-22 16:45:58 PDT
Created attachment 423960 [details] Patch remove FIXME question:
EWS
Comment 7 2021-03-22 17:43:16 PDT
Committed r274829: <https://commits.webkit.org/r274829> All reviewed patches have been landed. Closing bug and clearing flags on attachment 423960 [details].
Note You need to log in before you can comment on or make changes to this bug.