Summary: | [Modern Media Controls] Add a MediaControlsHost API to retrieve images as base64 | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Antoine Quint <graouts> | ||||||
Component: | Media | Assignee: | Antoine Quint <graouts> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, graouts, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | Safari 10 | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Bug Depends on: | 163500 | ||||||||
Bug Blocks: | |||||||||
Attachments: |
|
Description
Antoine Quint
2016-10-16 06:44:13 PDT
Created attachment 291747 [details]
Patch
Comment on attachment 291747 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=291747&action=review > Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp:292 > + if (page) > + return RenderTheme::themeForPage(page)->mediaControlsBase64StringForIconAndPlatform(iconName, platform); > + return ""; Early return means error case comes first. Please use emptyString(), rather than "". > Source/WebCore/Modules/mediacontrols/MediaControlsHost.h:85 > + String base64StringForIconAndPlatform(String iconName, String platform) const; Argument types should be const String&, not String. > Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl:63 > + [EnabledAtRuntime=ModernMediaControls] DOMString base64StringForIconAndPlatform(DOMString iconName, DOMString platform); Could be a dangerous API for performance because it loads the file from disk and encodes it every time with no caching. (In reply to comment #3) > Comment on attachment 291747 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=291747&action=review > > > Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp:292 > > + if (page) > > + return RenderTheme::themeForPage(page)->mediaControlsBase64StringForIconAndPlatform(iconName, platform); > > + return ""; > > Early return means error case comes first. Please use emptyString(), rather > than "". Sure thing, will change when landing. > > Source/WebCore/Modules/mediacontrols/MediaControlsHost.h:85 > > + String base64StringForIconAndPlatform(String iconName, String platform) const; > > Argument types should be const String&, not String. Thanks, will change when landing. > > Source/WebCore/Modules/mediacontrols/MediaControlsHost.idl:63 > > + [EnabledAtRuntime=ModernMediaControls] DOMString base64StringForIconAndPlatform(DOMString iconName, DOMString platform); > > Could be a dangerous API for performance because it loads the file from disk > and encodes it every time with no caching. True. I will add caching on the JS side as part of the iconService singleton (see Source/WebCore/Modules/modern-media-controls/controls/icon-service.js). Currently caching is done based on the image URL, but we need to do it based on the iconName / platform pair. Created attachment 291856 [details]
Patch for landing
Comment on attachment 291856 [details] Patch for landing Clearing flags on attachment: 291856 Committed r207423: <http://trac.webkit.org/changeset/207423> All reviewed patches have been landed. Closing bug. |