Title: [230082] trunk/Source/WebCore
Revision
230082
Author
dba...@webkit.org
Date
2018-03-29 14:49:25 -0700 (Thu, 29 Mar 2018)

Log Message

MIMETypeRegistry should return const HashSets
https://bugs.webkit.org/show_bug.cgi?id=184150

Reviewed by Per Arne Vollan.

Only getSupportedNonImageMIMETypes() needs to return a non-const HashSet so that
LegacyWebKit can modify the set of non-image MIME types.

* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::getSupportedImageMIMETypes):
(WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes):
(WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding):
(WebCore::MIMETypeRegistry::getSupportedMediaMIMETypes):
(WebCore::MIMETypeRegistry::getPDFMIMETypes):
(WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes):
* platform/MIMETypeRegistry.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230081 => 230082)


--- trunk/Source/WebCore/ChangeLog	2018-03-29 21:15:26 UTC (rev 230081)
+++ trunk/Source/WebCore/ChangeLog	2018-03-29 21:49:25 UTC (rev 230082)
@@ -1,3 +1,22 @@
+2018-03-29  Daniel Bates  <daba...@apple.com>
+
+        MIMETypeRegistry should return const HashSets
+        https://bugs.webkit.org/show_bug.cgi?id=184150
+
+        Reviewed by Per Arne Vollan.
+
+        Only getSupportedNonImageMIMETypes() needs to return a non-const HashSet so that
+        LegacyWebKit can modify the set of non-image MIME types.
+
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::MIMETypeRegistry::getSupportedImageMIMETypes):
+        (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes):
+        (WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding):
+        (WebCore::MIMETypeRegistry::getSupportedMediaMIMETypes):
+        (WebCore::MIMETypeRegistry::getPDFMIMETypes):
+        (WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes):
+        * platform/MIMETypeRegistry.h:
+
 2018-03-29  Brady Eidson  <beid...@apple.com>
 
         Update Service Worker feature status.

Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (230081 => 230082)


--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp	2018-03-29 21:15:26 UTC (rev 230081)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp	2018-03-29 21:49:25 UTC (rev 230082)
@@ -651,7 +651,7 @@
     return false;
 }
 
-HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSupportedImageMIMETypes()
+const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSupportedImageMIMETypes()
 {
     if (!supportedImageMIMETypes)
         initializeSupportedImageMIMETypes();
@@ -658,7 +658,7 @@
     return *supportedImageMIMETypes;
 }
 
-HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSupportedImageResourceMIMETypes()
+const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSupportedImageResourceMIMETypes()
 {
     if (!supportedImageResourceMIMETypes)
         initializeSupportedImageMIMETypes();
@@ -665,7 +665,7 @@
     return *supportedImageResourceMIMETypes;
 }
 
-HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSupportedImageMIMETypesForEncoding()
+const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSupportedImageMIMETypesForEncoding()
 {
     if (!supportedImageMIMETypesForEncoding)
         initializeSupportedImageMIMETypesForEncoding();
@@ -679,7 +679,7 @@
     return *supportedNonImageMIMETypes;
 }
 
-HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSupportedMediaMIMETypes()
+const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getSupportedMediaMIMETypes()
 {
     if (!supportedMediaMIMETypes)
         initializeSupportedMediaMIMETypes();
@@ -687,7 +687,7 @@
 }
 
 
-HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getPDFMIMETypes()
+const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getPDFMIMETypes()
 {
     if (!pdfMIMETypes)
         initializePDFMIMETypes();
@@ -694,7 +694,7 @@
     return *pdfMIMETypes;
 }
 
-HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getUnsupportedTextMIMETypes()
+const HashSet<String, ASCIICaseInsensitiveHash>& MIMETypeRegistry::getUnsupportedTextMIMETypes()
 {
     if (!unsupportedTextMIMETypes)
         initializeUnsupportedTextMIMETypes();

Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.h (230081 => 230082)


--- trunk/Source/WebCore/platform/MIMETypeRegistry.h	2018-03-29 21:15:26 UTC (rev 230081)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.h	2018-03-29 21:49:25 UTC (rev 230082)
@@ -106,14 +106,15 @@
 
     // FIXME: WebKit coding style says we should not have the word "get" in the names of these functions.
     // FIXME: Would be nice to find a way to avoid exposing these sets, even worse exposing non-const references.
-    WEBCORE_EXPORT static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedImageMIMETypes();
-    static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedImageResourceMIMETypes();
-    static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedImageMIMETypesForEncoding();
     WEBCORE_EXPORT static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedNonImageMIMETypes();
-    WEBCORE_EXPORT static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedMediaMIMETypes();
-    WEBCORE_EXPORT static HashSet<String, ASCIICaseInsensitiveHash>& getPDFMIMETypes();
-    WEBCORE_EXPORT static HashSet<String, ASCIICaseInsensitiveHash>& getUnsupportedTextMIMETypes();
 
+    WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedImageMIMETypes();
+    const static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedImageResourceMIMETypes();
+    const static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedImageMIMETypesForEncoding();
+    WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& getSupportedMediaMIMETypes();
+    WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& getPDFMIMETypes();
+    WEBCORE_EXPORT const static HashSet<String, ASCIICaseInsensitiveHash>& getUnsupportedTextMIMETypes();
+
     // FIXME: WebKit coding style says we should not have the word "get" in the name of this function.
     // FIXME: Unclear what the concept of a normalized MIME type is; currently it's a platform-specific notion.
     static String getNormalizedMIMEType(const String&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to