WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
190838
Cleanup: MIMETypeRegistry functions
https://bugs.webkit.org/show_bug.cgi?id=190838
Summary
Cleanup: MIMETypeRegistry functions
Said Abou-Hallawa
Reported
2018-10-23 12:24:05 PDT
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.
Attachments
Patch
(42.94 KB, patch)
2018-10-23 12:53 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(44.22 KB, patch)
2018-10-23 16:28 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(44.77 KB, patch)
2018-10-23 18:08 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(44.77 KB, patch)
2018-10-24 09:56 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Said Abou-Hallawa
Comment 1
2018-10-23 12:53:36 PDT
Created
attachment 352990
[details]
Patch
Said Abou-Hallawa
Comment 2
2018-10-23 16:28:21 PDT
Created
attachment 353000
[details]
Patch
Said Abou-Hallawa
Comment 3
2018-10-23 18:08:26 PDT
Created
attachment 353011
[details]
Patch
Simon Fraser (smfr)
Comment 4
2018-10-24 08:35:40 PDT
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<>?
Said Abou-Hallawa
Comment 5
2018-10-24 09:56:39 PDT
Created
attachment 353037
[details]
Patch
Said Abou-Hallawa
Comment 6
2018-10-24 11:21:59 PDT
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.
WebKit Commit Bot
Comment 7
2018-10-24 11:42:31 PDT
Comment on
attachment 353037
[details]
Patch Clearing flags on attachment: 353037 Committed
r237393
: <
https://trac.webkit.org/changeset/237393
>
WebKit Commit Bot
Comment 8
2018-10-24 11:42:33 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9
2018-10-24 11:44:43 PDT
<
rdar://problem/45527724
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug