Changeset 121923 in webkit
- Timestamp:
- Jul 5, 2012 1:19:08 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r121921 r121923 1 2012-07-05 Yongjun Zhang <yongjun_zhang@apple.com> 2 3 Code refactoring: move mimeTypeFromUTITree to a separate file. 4 https://bugs.webkit.org/show_bug.cgi?id=90619 5 6 We should move UTI handling related code to a separate file. 7 8 Reviewed by David Kilzer. 9 10 * WebCore.xcodeproj/project.pbxproj: Add UTIUtilities.h/UTIUtilities.mm to xcode project, and drive-by fix 11 that happened when editing the Xcode project file. 12 * platform/network/mac/UTIUtilities.h: Added. 13 (WebCore): 14 * platform/network/mac/UTIUtilities.mm: Added. move mimeTypeFromUTITree to UTIUtilities.mm. 15 (WebCore): 16 (WebCore::mimeTypeFromUTITree): 17 * platform/network/mac/WebCoreURLResponse.mm: include UTIUtilities.h to use mimeTypeFromUTITree. 18 (WebCore): 19 1 20 2012-07-05 Leandro Gracia Gil <leandrogracia@chromium.org> 2 21 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r121900 r121923 670 670 1F3C3BEB135CAF3C00B8C1AC /* MediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F3C3BE9135CAF3C00B8C1AC /* MediaControls.h */; }; 671 671 1F3F19531499CA7600A5AEA7 /* PODFreeListArena.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F3F19521499CA7600A5AEA7 /* PODFreeListArena.h */; settings = {ATTRIBUTES = (Private, ); }; }; 672 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */; }; 673 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */; }; 672 674 20D629261253690B00081543 /* InspectorInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20D629241253690B00081543 /* InspectorInstrumentation.cpp */; }; 673 675 20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 20D629251253690B00081543 /* InspectorInstrumentation.h */; }; … … 7655 7657 1F3C3BE9135CAF3C00B8C1AC /* MediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControls.h; sourceTree = "<group>"; }; 7656 7658 1F3F19521499CA7600A5AEA7 /* PODFreeListArena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PODFreeListArena.h; sourceTree = "<group>"; }; 7659 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTIUtilities.h; sourceTree = "<group>"; }; 7660 1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UTIUtilities.mm; sourceTree = "<group>"; }; 7657 7661 20D629241253690B00081543 /* InspectorInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInstrumentation.cpp; sourceTree = "<group>"; }; 7658 7662 20D629251253690B00081543 /* InspectorInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentation.h; sourceTree = "<group>"; }; … … 7952 7956 3314ACEA10892086000F0E56 /* JSExceptionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExceptionBase.h; sourceTree = "<group>"; }; 7953 7957 333F704E0FB49CA2008E12A6 /* Notification.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Notification.idl; path = Modules/notifications/Notification.idl; sourceTree = "<group>"; }; 7954 333F704F0FB49CA2008E12A6 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notification.h; path = Modules/notifications/Notification.h; sourceTree = "<group>"; };7958 333F704F0FB49CA2008E12A6 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notification.h; path = Modules/notifications/Notification.h; sourceTree = "<group>"; }; 7955 7959 33503C9910179A74003B47E1 /* NotificationClient.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = NotificationClient.h; path = Modules/notifications/NotificationClient.h; sourceTree = "<group>"; }; 7956 7960 33503C9F10179AD7003B47E1 /* JSNotification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotification.cpp; sourceTree = "<group>"; }; … … 15428 15432 514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */, 15429 15433 514C764B0CE9234E007EF3CD /* ResourceResponseMac.mm */, 15434 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */, 15435 1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */, 15430 15436 37F818FB0D657606005E1F05 /* WebCoreURLResponse.h */, 15431 15437 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */, … … 25173 25179 4F32BB1B14FA85E800F6C1A3 /* MemoryInstrumentation.h in Headers */, 25174 25180 A882DA231593848D000115ED /* CSSToStyleMap.h in Headers */, 25181 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */, 25175 25182 ); 25176 25183 runOnlyForDeploymentPostprocessing = 0; … … 28166 28173 9712A611150090CE0048AF10 /* WorkerContextIndexedDatabase.cpp in Sources */, 28167 28174 97F8E665151D4A4B00D2D181 /* WorkerContextNotifications.cpp in Sources */, 28168 A8CCBB4C151F833B00AB7CE9 /* WorkerContextWebDatabase.cpp in Sources */, F34742E01343631F00531BC2 /* WorkerDebuggerAgent.cpp in Sources */, 28175 A8CCBB4C151F833B00AB7CE9 /* WorkerContextWebDatabase.cpp in Sources */, 28176 F34742E01343631F00531BC2 /* WorkerDebuggerAgent.cpp in Sources */, 28169 28177 A3E2643014748991005A8588 /* WorkerEventQueue.cpp in Sources */, 28170 28178 F36E07A41358A8BE00AACBC9 /* WorkerInspectorController.cpp in Sources */, … … 28226 28234 50987C26157D676D00BDA835 /* CustomFilterGlobalContext.cpp in Sources */, 28227 28235 A882DA201593846A000115ED /* CSSToStyleMap.cpp in Sources */, 28236 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */, 28228 28237 ); 28229 28238 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm
r95901 r121923 31 31 32 32 #import "MIMETypeRegistry.h" 33 #import "UTIUtilities.h" 33 34 #import "WebCoreSystemInterface.h" 34 35 #import <wtf/Assertions.h> … … 448 449 } 449 450 450 static RetainPtr<CFStringRef> mimeTypeFromUTITree(CFStringRef uti)451 {452 // Check if this UTI has a MIME type.453 RetainPtr<CFStringRef> mimeType(AdoptCF, UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType));454 if (mimeType)455 return mimeType.get();456 457 // If not, walk the ancestory of this UTI via its "ConformsTo" tags and return the first MIME type we find.458 RetainPtr<CFDictionaryRef> decl(AdoptCF, UTTypeCopyDeclaration(uti));459 if (!decl)460 return nil;461 CFTypeRef value = CFDictionaryGetValue(decl.get(), kUTTypeConformsToKey);462 if (!value)463 return nil;464 CFTypeID typeID = CFGetTypeID(value);465 466 if (typeID == CFStringGetTypeID())467 return mimeTypeFromUTITree((CFStringRef)value);468 469 if (typeID == CFArrayGetTypeID()) {470 CFArrayRef newTypes = (CFArrayRef)value;471 CFIndex count = CFArrayGetCount(newTypes);472 for (CFIndex i = 0; i < count; ++i) {473 CFTypeRef object = CFArrayGetValueAtIndex(newTypes, i);474 if (CFGetTypeID(object) != CFStringGetTypeID())475 continue;476 477 if (RetainPtr<CFStringRef> mimeType = mimeTypeFromUTITree((CFStringRef)object))478 return mimeType;479 }480 }481 482 return nil;483 }484 485 451 void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse) 486 452 {
Note: See TracChangeset
for help on using the changeset viewer.