RESOLVED FIXED 210518
[macOS] Update ScreenTime as playback state changes
https://bugs.webkit.org/show_bug.cgi?id=210518
Summary [macOS] Update ScreenTime as playback state changes
Eric Carlson
Reported 2020-04-14 15:09:25 PDT
Update ScreenTime as playback state changes
Attachments
WIP patch for the bots to check (96.43 KB, patch)
2020-04-14 17:29 PDT, Eric Carlson
no flags
updated WIP patch for the bots (104.06 KB, patch)
2020-04-14 21:44 PDT, Eric Carlson
no flags
updated WIP patch for the bots (104.17 KB, patch)
2020-04-15 07:04 PDT, Eric Carlson
no flags
updated WIP patch for the bots (104.19 KB, patch)
2020-04-15 08:36 PDT, Eric Carlson
no flags
Patch (115.99 KB, patch)
2020-04-15 16:23 PDT, Eric Carlson
no flags
Patch for landing (116.60 KB, patch)
2020-04-15 21:33 PDT, Eric Carlson
no flags
Follow-up Patch (1.82 KB, patch)
2020-04-16 11:04 PDT, Jer Noble
eric.carlson: review+
Eric Carlson
Comment 1 2020-04-14 15:10:05 PDT
Eric Carlson
Comment 2 2020-04-14 17:29:58 PDT
Created attachment 396481 [details] WIP patch for the bots to check
Eric Carlson
Comment 3 2020-04-14 21:44:25 PDT
Created attachment 396497 [details] updated WIP patch for the bots
Eric Carlson
Comment 4 2020-04-15 07:04:52 PDT
Created attachment 396528 [details] updated WIP patch for the bots
Eric Carlson
Comment 5 2020-04-15 08:36:35 PDT
Created attachment 396540 [details] updated WIP patch for the bots
Jer Noble
Comment 6 2020-04-15 09:31:57 PDT
Comment on attachment 396540 [details] updated WIP patch for the bots View in context: https://bugs.webkit.org/attachment.cgi?id=396540&action=review > Source/WebCore/ChangeLog:1 > +2020-04-14 Eric Carlson <eric.carlson@apple.com> ... > Source/WebCore/ChangeLog:60 > +2020-04-14 Eric Carlson <eric.carlson@apple.com> Looks like you got a double changelong here. > Source/WebKit/ChangeLog:52 > +2020-04-14 Eric Carlson <eric.carlson@apple.com> Here too. > Source/WebCore/html/MediaElementSession.cpp:123 > +#if PLATFORM(MACCATALYST) || PLATFORM(MAC) Could you add a ENABLE(MEDIA_USAGE) pragma and use it in platform-independent code instead? That way other ports could adopt without having to touch all these call sites. > Source/WebKit/UIProcess/WebPageProxy.h:1739 > + void addMediaUsageManagerSession(WebCore::MediaSessionIdentifier, const String& /* bundleIdentifier */, const URL& /* pageURL */); Is there a reason these parameter names are commented out?
Eric Carlson
Comment 7 2020-04-15 16:23:59 PDT
Eric Carlson
Comment 8 2020-04-15 16:28:45 PDT
Comment on attachment 396540 [details] updated WIP patch for the bots View in context: https://bugs.webkit.org/attachment.cgi?id=396540&action=review >> Source/WebCore/ChangeLog:60 >> +2020-04-14 Eric Carlson <eric.carlson@apple.com> > > Looks like you got a double changelong here. Fixed. >> Source/WebCore/html/MediaElementSession.cpp:123 >> +#if PLATFORM(MACCATALYST) || PLATFORM(MAC) > > Could you add a ENABLE(MEDIA_USAGE) pragma and use it in platform-independent code instead? That way other ports could adopt without having to touch all these call sites. Good suggestion, changed. >> Source/WebKit/UIProcess/WebPageProxy.h:1739 >> + void addMediaUsageManagerSession(WebCore::MediaSessionIdentifier, const String& /* bundleIdentifier */, const URL& /* pageURL */); > > Is there a reason these parameter names are commented out? Left over from an earlier version with more parameters. Removed.
Peng Liu
Comment 9 2020-04-15 17:12:24 PDT
Comment on attachment 396586 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396586&action=review > Source/WebKit/UIProcess/Media/cocoa/MediaUsageManagerCocoa.h:42 > + void reset() final; Nit. Looks like these functions can be private?
Jon Lee
Comment 10 2020-04-15 17:29:17 PDT
Comment on attachment 396586 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396586&action=review > Source/WebCore/html/MediaElementSession.cpp:1021 > + auto* fullscreenElement = m_element.document().fullscreenManager().currentFullscreenElement(); document.fullscreenManager()... > Source/WebCore/html/MediaElementSession.cpp:1036 > + m_element.document().isMediaDocument() && (m_element.document().frame() && m_element.document().frame()->isMainFrame()), ditto
Jer Noble
Comment 11 2020-04-15 17:40:36 PDT
Comment on attachment 396586 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396586&action=review R=me with just a couple of nits. > Source/WebCore/testing/Internals.idl:120 > +[ > + ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, > + Conditional=VIDEO, > + JSGenerateToJSObject, > +] dictionary MediaUsageState { It's unfortunate you can't just re-use MediaUsageInfo here, and not re-declare the existing struct, but I guess that the URL -> DOMString for mediaURL makes that untenable. > Source/WebKit/UIProcess/Media/cocoa/MediaUsageManagerCocoa.h:63 > + WebCore::MediaSessionIdentifier m_identifier; > + String m_bundleIdentifier; > + URL m_pageURL; > + Optional<WebCore::MediaUsageInfo> m_mediaUsageInfo; > + RetainPtr<USVideoUsage> m_usageTracker; Since structs have public members, there's no no need to prefix these with `m_`. > Source/WebKit/UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm:198 > + WTFLogAlways("MediaUsageManagerCocoa::updateMediaUsage caught exception!"); Do you want to include the exception.description here?
Eric Carlson
Comment 12 2020-04-15 21:33:33 PDT
Created attachment 396616 [details] Patch for landing
EWS
Comment 13 2020-04-16 06:36:12 PDT
Committed r260182: <https://trac.webkit.org/changeset/260182> All reviewed patches have been landed. Closing bug and clearing flags on attachment 396616 [details].
Jer Noble
Comment 14 2020-04-16 11:04:15 PDT
Reopening to attach new patch.
Jer Noble
Comment 15 2020-04-16 11:04:17 PDT
Created attachment 396672 [details] Follow-up Patch
Jer Noble
Comment 16 2020-04-16 11:11:30 PDT
Note You need to log in before you can comment on or make changes to this bug.