Some of the functions in MIMETypeRegistry return HashSet<Sting>. For these functions, we need to do the following: 1. Use NeverDestroyed<> instead of allocating raw pointers with the new operator. 2. Use std::initializer_list to initialize the static HashSet<String> when the list of supported mime types is static list of strings. 3. Use makeNeverDestroyed() to initialize the static HashSet<String> when the list of supported mime types is retrieved from a system call. 3. Replace the functions MIMETypeRegistry::getSupported...() with MIMETypeRegistry::supported...(). The functions whose names are MIMETypeRegistry::supported...() will be responsible of filling and validating their local NeverDestroyed<> and returning the underlaying HashSets. 4. As a preparation for landing 190454, the term UTI will be replaced by ImageSourceType. A new SPI will be added and adding UTI in its name does not seem appealing.
Created attachment 352990 [details] Patch
Created attachment 353000 [details] Patch
Created attachment 353011 [details] Patch
Comment on attachment 353011 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=353011&action=review > Source/WebCore/platform/MIMETypeRegistry.h:112 > + WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& supportedImageMIMETypes(); > + WEBCORE_EXPORT static HashSet<String, ASCIICaseInsensitiveHash>& supportedNonImageMIMETypes(); > + WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& supportedMediaMIMETypes(); > + WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& pdfMIMETypes(); > + WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& unsupportedTextMIMETypes(); I think static const HashSet<> reads better. Is there a reason supportedNonImageMIMETypes() doesn't return a const HashSet<>?
Created attachment 353037 [details] Patch
Comment on attachment 353011 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=353011&action=review >> Source/WebCore/platform/MIMETypeRegistry.h:112 >> + WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& unsupportedTextMIMETypes(); > > I think static const HashSet<> reads better. > > Is there a reason supportedNonImageMIMETypes() doesn't return a const HashSet<>? Yes. [WebView _unregisterViewClassAndRepresentationClassForMIMEType] [WebView _registerViewClass] [WebView registerViewClass] need to change it by adding and removing mime types.
Comment on attachment 353037 [details] Patch Clearing flags on attachment: 353037 Committed r237393: <https://trac.webkit.org/changeset/237393>
All reviewed patches have been landed. Closing bug.
<rdar://problem/45527724>