Changeset 257745 in webkit
- Timestamp:
- Mar 2, 2020 3:58:56 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r257739 r257745 1 2020-03-02 Jacob Uphoff <jacob_uphoff@apple.com> 2 3 Unreviewed, rolling out r257725. 4 5 This commit caused 10 API tests to fail 6 7 Reverted changeset: 8 9 "[Cocoa] Mapping from MIME type to UTI type should be done in 10 the UI process" 11 https://bugs.webkit.org/show_bug.cgi?id=208415 12 https://trac.webkit.org/changeset/257725 13 1 14 2020-03-02 Andres Gonzalez <andresg_22@apple.com> 2 15 -
trunk/Source/WebCore/platform/network/mac/UTIUtilities.h
r257725 r257745 24 24 */ 25 25 26 #pragma once 26 #ifndef UTIUtilities_h 27 #define UTIUtilities_h 27 28 28 #include <wtf/text/WTFString.h> 29 #import <wtf/Forward.h> 30 #import <wtf/RetainPtr.h> 29 31 30 32 namespace WebCore { 31 32 33 WEBCORE_EXPORT String MIMETypeFromUTI(const String&); 33 34 String MIMETypeFromUTITree(const String&); 34 35 WEBCORE_EXPORT String UTIFromMIMEType(const String&); 35 36 bool isDeclaredUTI(const String&); 37 } 36 38 37 WEBCORE_EXPORT void setUTIFromMIMETypeMap(HashMap<String, String>&&); 38 WEBCORE_EXPORT const HashMap<String, String>& createUTIFromMIMETypeMap(); 39 WEBCORE_EXPORT const Vector<String>& mimeTypes(); 40 } 39 #endif // UTIUtilities_h -
trunk/Source/WebCore/platform/network/mac/UTIUtilities.mm
r257725 r257745 40 40 #define ADDITIONAL_UTI_MAPPINGS 41 41 #endif 42 43 #define EMPTY_MIME_TYPE_STRING "emptyMimeType"_s44 42 45 43 namespace WebCore { … … 116 114 } 117 115 118 static Optional<HashMap<String, String>>& mapUTIFromMIMEType()119 {120 static NeverDestroyed<Optional<HashMap<String, String>>> map;121 return map;122 }123 124 116 struct UTIFromMIMETypeCachePolicy : TinyLRUCachePolicy<String, String> { 125 117 public: 126 static String createValueForKey(const String& mimeType)118 static String createValueForKey(const String& key) 127 119 { 128 String key = mimeType;129 if (mapUTIFromMIMEType().hasValue()) {130 if (key.isEmpty())131 key = EMPTY_MIME_TYPE_STRING;132 const auto& it = mapUTIFromMIMEType()->find(key);133 if (it != mapUTIFromMIMEType()->end())134 return it->value;135 WTFLogAlways("UTI for MIME type %s not found.", key.utf8().data());136 ASSERT_NOT_REACHED();137 }138 120 auto type = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, key.createCFString().get(), 0)); 139 121 if (type) … … 143 125 }; 144 126 145 static TinyLRUCache<String, String, 16, UTIFromMIMETypeCachePolicy>& cacheUTIFromMimeType()146 {147 static NeverDestroyed<TinyLRUCache<String, String, 16, UTIFromMIMETypeCachePolicy>> cache;148 return cache;149 }150 151 127 String UTIFromMIMEType(const String& mimeType) 152 128 { 153 129 ASSERT(isMainThread()); 154 return cacheUTIFromMimeType().get(mimeType); 130 static NeverDestroyed<TinyLRUCache<String, String, 16, UTIFromMIMETypeCachePolicy>> cache; 131 return cache.get().get(mimeType); 155 132 } 156 133 … … 160 137 } 161 138 162 const Vector<String>& mimeTypes()163 {164 static NeverDestroyed<Vector<String>> mimeTypes = std::initializer_list<String> {165 "application/ogg"_s,166 "audio/ogg"_s,167 "video/ogg"_s,168 "application/annodex"_s,169 "audio/annodex"_s,170 "video/annodex"_s,171 "audio/speex"_s,172 "video/webm"_s,173 "audio/webm"_s,174 "audio/mpeg"_s,175 "video/mpeg"_s,176 "application/vnd.apple.mpegurl"_s,177 "application/mpegurl"_s,178 "application/x-mpegurl"_s,179 "audio/mpegurl"_s,180 "audio/x-mpegurl"_s,181 "audio/mpegurl"_s,182 "video/x-m4v"_s,183 "audio/x-m4a"_s,184 "audio/x-m4b"_s,185 "audio/x-m4p"_s,186 "video/mp4"_s,187 "audio/mp4"_s,188 "audio/mp3"_s,189 "audio/x-mp3"_s,190 "audio/x-mpeg"_s,191 "video/x-mpeg2"_s,192 "video/mpeg2"_s,193 "video/m2ts"_s,194 "video/x-m2ts"_s,195 "audio/3gpp"_s,196 "audio/3gpp2"_s,197 "application/x-mpeg"_s,198 "audio/aac"_s,199 "audio/x-aac"_s,200 "audio/x-caf"_s,201 "audio/x-gsm"_s,202 "audio/x-wav"_s,203 "audio/vnd.wave"_s,204 "audio/wav"_s,205 206 "image/gif"_s,207 "image/jpeg"_s,208 "image/png"_s,209 210 "multipart/x-folder"_s,211 212 "text/html"_s,213 "text/plain"_s,214 };215 return mimeTypes;216 };217 218 const HashMap<String, String>& createUTIFromMIMETypeMap()219 {220 static NeverDestroyed<HashMap<String, String>> map = [] {221 HashMap<String, String> cache;222 for (auto mimeType : mimeTypes())223 cache.add(mimeType, UTIFromMIMEType(mimeType));224 cache.add(EMPTY_MIME_TYPE_STRING, UTIFromMIMEType(emptyString()));225 return cache;226 }();227 return map;228 139 } 229 230 void setUTIFromMIMETypeMap(HashMap<String, String>&& map)231 {232 mapUTIFromMIMEType() = WTFMove(map);233 }234 235 } -
trunk/Source/WebCore/testing/Internals.cpp
r257725 r257745 5475 5475 return emptyString(); 5476 5476 } 5477 5478 String Internals::getUTIFromMIMEType(const String& mimeType)5479 {5480 return emptyString();5481 }5482 5477 #endif 5483 5478 -
trunk/Source/WebCore/testing/Internals.h
r257725 r257745 939 939 String mediaMIMETypeForExtension(const String& extension); 940 940 941 String getUTIFromMIMEType(const String& mimeType);942 943 941 bool supportsPictureInPicture(); 944 942 -
trunk/Source/WebCore/testing/Internals.idl
r257725 r257745 847 847 848 848 DOMString mediaMIMETypeForExtension(DOMString extension); 849 850 DOMString getUTIFromMIMEType(DOMString mimeType); 851 849 852 850 boolean supportsPictureInPicture(); 853 851 }; -
trunk/Source/WebCore/testing/Internals.mm
r257725 r257745 35 35 #import "MediaPlayerPrivate.h" 36 36 #import "Range.h" 37 #import "UTIUtilities.h"38 37 #import <AVFoundation/AVPlayer.h> 39 38 #import <wtf/cocoa/NSURLExtras.h> … … 102 101 } 103 102 104 String Internals::getUTIFromMIMEType(const String& mimeType)105 {106 return UTIFromMIMEType(mimeType);107 103 } 108 109 } -
trunk/Source/WebKit/ChangeLog
r257740 r257745 1 2020-03-02 Jacob Uphoff <jacob_uphoff@apple.com> 2 3 Unreviewed, rolling out r257725. 4 5 This commit caused 10 API tests to fail 6 7 Reverted changeset: 8 9 "[Cocoa] Mapping from MIME type to UTI type should be done in 10 the UI process" 11 https://bugs.webkit.org/show_bug.cgi?id=208415 12 https://trac.webkit.org/changeset/257725 13 1 14 2020-03-02 Megan Gardner <megan_gardner@apple.com> 2 15 -
trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp
r257725 r257745 172 172 encoder << systemHasBattery; 173 173 encoder << mimeTypesMap; 174 encoder << mapUTIFromMIMEType;175 174 #endif 176 175 … … 462 461 return false; 463 462 parameters.mimeTypesMap = WTFMove(*mimeTypesMap); 464 465 Optional<HashMap<String, String>> mapUTIFromMIMEType;466 decoder >> mapUTIFromMIMEType;467 if (!mapUTIFromMIMEType)468 return false;469 parameters.mapUTIFromMIMEType = WTFMove(*mapUTIFromMIMEType);470 463 #endif 471 464 -
trunk/Source/WebKit/Shared/WebProcessCreationParameters.h
r257725 r257745 214 214 bool systemHasBattery { false }; 215 215 Optional<HashMap<String, Vector<String>, ASCIICaseInsensitiveHash>> mimeTypesMap; 216 HashMap<String, String> mapUTIFromMIMEType;217 216 #endif 218 217 -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r257725 r257745 57 57 #import <WebCore/RuntimeApplicationChecks.h> 58 58 #import <WebCore/SharedBuffer.h> 59 #import <WebCore/UTIUtilities.h>60 59 #import <objc/runtime.h> 61 60 #import <pal/spi/cf/CFNetworkSPI.h> … … 408 407 } 409 408 parameters.systemHasBattery = systemHasBattery(); 410 parameters.mimeTypesMap = commonMimeTypesMap();411 parameters.mapUTIFromMIMEType = createUTIFromMIMETypeMap();412 409 #endif 413 410 … … 418 415 parameters.contentFilterExtensionHandle = WTFMove(handle); 419 416 } 417 parameters.mimeTypesMap = commonMimeTypesMap(); 420 418 #endif 421 419 -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r257725 r257745 68 68 #import <WebCore/RuntimeApplicationChecks.h> 69 69 #import <WebCore/SWContextManager.h> 70 #import <WebCore/UTIUtilities.h>71 70 #import <algorithm> 72 71 #import <dispatch/dispatch.h> … … 276 275 if (parameters.mimeTypesMap) 277 276 overriddenMimeTypesMap() = WTFMove(parameters.mimeTypesMap); 278 279 setUTIFromMIMETypeMap(WTFMove(parameters.mapUTIFromMIMEType));280 277 #endif 281 278 -
trunk/Tools/ChangeLog
r257743 r257745 1 2020-03-02 Jacob Uphoff <jacob_uphoff@apple.com> 2 3 Unreviewed, rolling out r257725. 4 5 This commit caused 10 API tests to fail 6 7 Reverted changeset: 8 9 "[Cocoa] Mapping from MIME type to UTI type should be done in 10 the UI process" 11 https://bugs.webkit.org/show_bug.cgi?id=208415 12 https://trac.webkit.org/changeset/257725 13 1 14 2020-03-02 Saam Barati <sbarati@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r257725 r257745 884 884 C15CBB3F23FB177A00300CC7 /* PreferenceChanges.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */; }; 885 885 C1692DCA23D10DAE006E88F7 /* Battery.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1692DC923D10DAE006E88F7 /* Battery.mm */; }; 886 C194E31D2409DF43002939ED /* UTIFromMIMEType.mm in Sources */ = {isa = PBXBuildFile; fileRef = C194E31C2409DF43002939ED /* UTIFromMIMEType.mm */; };887 886 C20F88A72295B96700D610FA /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C20F88A62295B96700D610FA /* CoreText.framework */; }; 888 887 C22FA32B228F8708009D7988 /* TextWidth.mm in Sources */ = {isa = PBXBuildFile; fileRef = C22FA32A228F8708009D7988 /* TextWidth.mm */; }; … … 2450 2449 C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PreferenceChanges.mm; sourceTree = "<group>"; }; 2451 2450 C1692DC923D10DAE006E88F7 /* Battery.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Battery.mm; sourceTree = "<group>"; }; 2452 C194E31C2409DF43002939ED /* UTIFromMIMEType.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UTIFromMIMEType.mm; sourceTree = "<group>"; };2453 2451 C1D8EE212028E8E3008EB141 /* WebProcessTerminate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessTerminate.mm; sourceTree = "<group>"; }; 2454 2452 C20F88A62295B96700D610FA /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; }; … … 2903 2901 E325C90623E3870200BC7D3B /* PictureInPictureSupport.mm */, 2904 2902 C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */, 2905 C194E31C2409DF43002939ED /* UTIFromMIMEType.mm */,2906 2903 0F139E751A423A5300F590F5 /* WeakObjCPtr.mm */, 2907 2904 ); … … 5100 5097 7CCE7F181A411AE600447C4C /* UserMessage.cpp in Sources */, 5101 5098 2EB242B821D4140B0055C1C0 /* UseSelectionAsFindString.mm in Sources */, 5102 C194E31D2409DF43002939ED /* UTIFromMIMEType.mm in Sources */,5103 5099 7C83E03A1D0A602700FEBCF3 /* UtilitiesCocoa.mm in Sources */, 5104 5100 7C83E0C61D0A654E00FEBCF3 /* VideoControlsManager.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.