WebKit Bugzilla
Attachment 343329 Details for
Bug 186924
: [Cocoa] reduce unnecessary use of .mm source files in WTF, spruce up some implementation details
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186924-20180622090728.patch (text/plain), 45.38 KB, created by
Darin Adler
on 2018-06-22 09:07:29 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-06-22 09:07:29 PDT
Size:
45.38 KB
patch
obsolete
>Subversion Revision: 233079 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 42022b3c7f11cac66dac1d1766527bc2b986d184..3be16a116c6b33ca8338bccb4454a2ca0d8ec446 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,34 @@ >+2018-06-22 Darin Adler <darin@apple.com> >+ >+ [Cocoa] reduce unnecessary use of .mm source files in WTF, spruce up some implementation details >+ https://bugs.webkit.org/show_bug.cgi?id=186924 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WTF.xcodeproj/project.pbxproj: Update for file and directory renames, file type changes, >+ and deletions. >+ >+ * wtf/MemoryPressureHandler.cpp: >+ (WTF::MemoryPressureHandler::holdOff): Deleted empty placeholder; this one is not needed. >+ >+ * wtf/PlatformMac.cmake: Update for file and directory renames, file type changes, >+ and deletions. >+ >+ * wtf/cocoa/CPUTimeCocoa.cpp: Renamed from Source/WTF/wtf/cocoa/CPUTimeCocoa.mm. >+ >+ * wtf/text/WTFString.h: Added a new inline version of the constructor that takes an NSString. >+ This is identical to the one that takes a CFStringRef, so no need to keep both. >+ >+ * wtf/text/cocoa/StringImplCocoa.mm: Renamed from Source/WTF/wtf/text/mac/StringImplMac.mm. >+ Also removed an unneeded include. >+ >+ * wtf/text/cocoa/StringViewCocoa.mm: Renamed from Source/WTF/wtf/text/mac/StringViewObjC.mm. >+ >+ * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: Renamed from >+ Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm. >+ >+ * wtf/text/mac/StringMac.mm: Removed. >+ > 2018-06-21 Carlos Garcia Campos <cgarcia@igalia.com> > > [GLIB] improve get_type() fast path in WEBKIT_DEFINE_TYPE >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index ef1b33b7fe0782f1d87405993f6f4106b1066e20..63cc2fa07c061d1e6d8ad5508b47ba65dc64bcb7 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -60,7 +60,7 @@ > 1C181C8F1D307AB800F5FA16 /* UTextProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C891D307AB800F5FA16 /* UTextProvider.cpp */; }; > 1C181C911D307AB800F5FA16 /* UTextProviderLatin1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C8B1D307AB800F5FA16 /* UTextProviderLatin1.cpp */; }; > 1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C8D1D307AB800F5FA16 /* UTextProviderUTF16.cpp */; }; >- 1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm */; }; >+ 1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */; }; > 1FA47C8A152502DA00568D1B /* WebCoreThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FA47C88152502DA00568D1B /* WebCoreThread.cpp */; }; > 2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; }; > 2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */; }; >@@ -82,14 +82,13 @@ > 7AF023B52061E17000A8EFD6 /* ProcessPrivilege.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF023B42061E16F00A8EFD6 /* ProcessPrivilege.cpp */; }; > 7AFEC6B11EB22B5900DADE36 /* UUID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AFEC6B01EB22B5900DADE36 /* UUID.cpp */; }; > 8134013815B092FD001FF0B8 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8134013615B092FD001FF0B8 /* Base64.cpp */; }; >- 93934BD318A1E8C300D0D6A1 /* StringViewObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */; }; >+ 93934BD318A1E8C300D0D6A1 /* StringViewCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD218A1E8C300D0D6A1 /* StringViewCocoa.mm */; }; > 93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */; }; > 93F1993E19D7958D00C2390B /* StringView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1993D19D7958D00C2390B /* StringView.cpp */; }; > 9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC70F04176C379D00101DEC /* AtomicStringTable.cpp */; }; > A3B725EC987446AD93F1A440 /* RandomDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8F597CA2A57417FBAB92FD6 /* RandomDevice.cpp */; }; > A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3E4DD911F3A803400DED0B4 /* TextStream.cpp */; }; >- A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F2182433A900A82E69 /* StringMac.mm */; }; >- A5BA15F51824348000A82E69 /* StringImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F41824348000A82E69 /* StringImplMac.mm */; }; >+ A5BA15F51824348000A82E69 /* StringImplCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F41824348000A82E69 /* StringImplCocoa.mm */; }; > A5BA15FA182435A600A82E69 /* AtomicStringImplCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */; }; > A5BA15FB182435A600A82E69 /* StringCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F8182435A600A82E69 /* StringCF.cpp */; }; > A5BA15FC182435A600A82E69 /* StringImplCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F9182435A600A82E69 /* StringImplCF.cpp */; }; >@@ -147,7 +146,7 @@ > E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15556F318A0CC18006F48FB /* CryptographicUtilities.cpp */; }; > E311FB171F0A568B003C08DE /* ThreadGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E311FB151F0A568B003C08DE /* ThreadGroup.cpp */; }; > E388886F20C9095100E632BC /* WorkerPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E388886D20C9095100E632BC /* WorkerPool.cpp */; }; >- E38C41251EB4E04C0042957D /* CPUTimeCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = E38C41241EB4E04C0042957D /* CPUTimeCocoa.mm */; }; >+ E38C41251EB4E04C0042957D /* CPUTimeCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38C41241EB4E04C0042957D /* CPUTimeCocoa.cpp */; }; > E38C41281EB4E0680042957D /* CPUTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38C41261EB4E0680042957D /* CPUTime.cpp */; }; > E38D6E271F5522E300A75CC4 /* StringBuilderJSON.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38D6E261F5522E300A75CC4 /* StringBuilderJSON.cpp */; }; > E3A32BC41FC830E2007D7E76 /* JSValueMalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3A32BC21FC830E2007D7E76 /* JSValueMalloc.cpp */; }; >@@ -313,7 +312,7 @@ > 1C181C8C1D307AB800F5FA16 /* UTextProviderLatin1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderLatin1.h; sourceTree = "<group>"; }; > 1C181C8D1D307AB800F5FA16 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = "<group>"; }; > 1C181C8E1D307AB800F5FA16 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = "<group>"; }; >- 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TextBreakIteratorInternalICUMac.mm; path = mac/TextBreakIteratorInternalICUMac.mm; sourceTree = "<group>"; }; >+ 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIteratorInternalICUCocoa.cpp; sourceTree = "<group>"; }; > 1CCDB1491E566626006C73C0 /* TextBreakIteratorCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextBreakIteratorCF.h; path = cf/TextBreakIteratorCF.h; sourceTree = "<group>"; }; > 1CCDB14D1E566898006C73C0 /* TextBreakIteratorICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorICU.h; sourceTree = "<group>"; }; > 1CCDB1511E566BC5006C73C0 /* CFStringSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CFStringSPI.h; path = cf/CFStringSPI.h; sourceTree = "<group>"; }; >@@ -405,7 +404,7 @@ > 83FBA93119DF459700F30ADB /* TypeCasts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeCasts.h; sourceTree = "<group>"; }; > 86F46F5F1A2840EE00CCBF22 /* RefCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCounter.h; sourceTree = "<group>"; }; > 933D63191FCB6AB90032ECD6 /* StringHasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHasher.h; sourceTree = "<group>"; }; >- 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringViewObjC.mm; path = mac/StringViewObjC.mm; sourceTree = "<group>"; }; >+ 93934BD218A1E8C300D0D6A1 /* StringViewCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringViewCocoa.mm; sourceTree = "<group>"; }; > 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringViewCF.cpp; path = cf/StringViewCF.cpp; sourceTree = "<group>"; }; > 93AC91A718942FC400244939 /* LChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LChar.h; sourceTree = "<group>"; }; > 93D191CF20CAECE800C51B8E /* FoundationSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FoundationSPI.h; sourceTree = "<group>"; }; >@@ -424,8 +423,7 @@ > A5098AFF1C169E0700087797 /* SandboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxSPI.h; sourceTree = "<group>"; }; > A5098B011C16A4F900087797 /* SecuritySPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecuritySPI.h; sourceTree = "<group>"; }; > A561F30F1DF2642100FF675D /* DeprecatedOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedOptional.h; sourceTree = "<group>"; }; >- A5BA15F2182433A900A82E69 /* StringMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringMac.mm; path = mac/StringMac.mm; sourceTree = "<group>"; }; >- A5BA15F41824348000A82E69 /* StringImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringImplMac.mm; path = mac/StringImplMac.mm; sourceTree = "<group>"; }; >+ A5BA15F41824348000A82E69 /* StringImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplCocoa.mm; sourceTree = "<group>"; }; > A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicStringImplCF.cpp; path = cf/AtomicStringImplCF.cpp; sourceTree = "<group>"; }; > A5BA15F8182435A600A82E69 /* StringCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringCF.cpp; path = cf/StringCF.cpp; sourceTree = "<group>"; }; > A5BA15F9182435A600A82E69 /* StringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringImplCF.cpp; path = cf/StringImplCF.cpp; sourceTree = "<group>"; }; >@@ -621,7 +619,7 @@ > E33D5F871FBED66700BF625E /* RecursableLambda.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecursableLambda.h; sourceTree = "<group>"; }; > E388886D20C9095100E632BC /* WorkerPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerPool.cpp; sourceTree = "<group>"; }; > E388886E20C9095100E632BC /* WorkerPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerPool.h; sourceTree = "<group>"; }; >- E38C41241EB4E04C0042957D /* CPUTimeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CPUTimeCocoa.mm; sourceTree = "<group>"; }; >+ E38C41241EB4E04C0042957D /* CPUTimeCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPUTimeCocoa.cpp; sourceTree = "<group>"; }; > E38C41261EB4E0680042957D /* CPUTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPUTime.cpp; sourceTree = "<group>"; }; > E38C41271EB4E0680042957D /* CPUTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPUTime.h; sourceTree = "<group>"; }; > E38D6E261F5522E300A75CC4 /* StringBuilderJSON.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilderJSON.cpp; sourceTree = "<group>"; }; >@@ -765,15 +763,14 @@ > name = Source; > sourceTree = "<group>"; > }; >- A5BA15F11824339F00A82E69 /* mac */ = { >+ A5BA15F11824339F00A82E69 /* cocoa */ = { > isa = PBXGroup; > children = ( >- A5BA15F41824348000A82E69 /* StringImplMac.mm */, >- A5BA15F2182433A900A82E69 /* StringMac.mm */, >- 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */, >- 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm */, >+ A5BA15F41824348000A82E69 /* StringImplCocoa.mm */, >+ 93934BD218A1E8C300D0D6A1 /* StringViewCocoa.mm */, >+ 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */, > ); >- name = mac; >+ path = cocoa; > sourceTree = "<group>"; > }; > A5BA15F61824359E00A82E69 /* cf */ = { >@@ -1180,8 +1177,8 @@ > isa = PBXGroup; > children = ( > A5BA15F61824359E00A82E69 /* cf */, >+ A5BA15F11824339F00A82E69 /* cocoa */, > 1C181C881D307AB800F5FA16 /* icu */, >- A5BA15F11824339F00A82E69 /* mac */, > A8A4731C151A825B004123FF /* ASCIIFastPath.h */, > A8A4731D151A825B004123FF /* AtomicString.cpp */, > A8A4731E151A825B004123FF /* AtomicString.h */, >@@ -1324,7 +1321,7 @@ > isa = PBXGroup; > children = ( > 1469419B16EAB10A0024E146 /* AutodrainedPool.cpp */, >- E38C41241EB4E04C0042957D /* CPUTimeCocoa.mm */, >+ E38C41241EB4E04C0042957D /* CPUTimeCocoa.cpp */, > 143DDE9520C8BC37007F76FA /* Entitlements.cpp */, > 143DDE9720C8BE99007F76FA /* Entitlements.h */, > 7A6EBA3320746C34004F9C44 /* MachSendRight.cpp */, >@@ -1463,7 +1460,7 @@ > 0F30CB5A1FCDF134004B5323 /* ConcurrentPtrHashSet.cpp in Sources */, > 0F8E85DB1FD485B000691889 /* CountingLock.cpp in Sources */, > E38C41281EB4E0680042957D /* CPUTime.cpp in Sources */, >- E38C41251EB4E04C0042957D /* CPUTimeCocoa.mm in Sources */, >+ E38C41251EB4E04C0042957D /* CPUTimeCocoa.cpp in Sources */, > 515F794E1CFC9F4A00CCED93 /* CrossThreadCopier.cpp in Sources */, > 517F82D71FD22F3000DA3DEA /* CrossThreadTaskHandler.cpp in Sources */, > A8A4739A151A825B004123FF /* CryptographicallyRandomNumber.cpp in Sources */, >@@ -1541,17 +1538,16 @@ > A5BA15FB182435A600A82E69 /* StringCF.cpp in Sources */, > A8A47440151A825B004123FF /* StringImpl.cpp in Sources */, > A5BA15FC182435A600A82E69 /* StringImplCF.cpp in Sources */, >- A5BA15F51824348000A82E69 /* StringImplMac.mm in Sources */, >- A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */, >+ A5BA15F51824348000A82E69 /* StringImplCocoa.mm in Sources */, > 0FDDBFA71666DFA300C55FEF /* StringPrintStream.cpp in Sources */, > 93F1993E19D7958D00C2390B /* StringView.cpp in Sources */, > 93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */, >- 93934BD318A1E8C300D0D6A1 /* StringViewObjC.mm in Sources */, >+ 93934BD318A1E8C300D0D6A1 /* StringViewCocoa.mm in Sources */, > A8A473B7151A825B004123FF /* strtod.cc in Sources */, > 52183012C99E476A84EEBEA8 /* SymbolImpl.cpp in Sources */, > 70A993FE1AD7151300FA615B /* SymbolRegistry.cpp in Sources */, > 1C181C7F1D3078DA00F5FA16 /* TextBreakIterator.cpp in Sources */, >- 1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm in Sources */, >+ 1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp in Sources */, > A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */, > E311FB171F0A568B003C08DE /* ThreadGroup.cpp in Sources */, > A8A4744A151A825B004123FF /* Threading.cpp in Sources */, >diff --git a/Source/WTF/wtf/MemoryPressureHandler.cpp b/Source/WTF/wtf/MemoryPressureHandler.cpp >index 832885358c7b498a072bb778f84ad87859544b18..caf388e29e3c1ef9e0e6ab9a2f6cea27fce41f32 100644 >--- a/Source/WTF/wtf/MemoryPressureHandler.cpp >+++ b/Source/WTF/wtf/MemoryPressureHandler.cpp >@@ -286,7 +286,6 @@ void MemoryPressureHandler::ReliefLogger::logMemoryUsageChange() > #if !PLATFORM(COCOA) && !OS(LINUX) && !OS(WINDOWS) > void MemoryPressureHandler::install() { } > void MemoryPressureHandler::uninstall() { } >-void MemoryPressureHandler::holdOff(Seconds) { } > void MemoryPressureHandler::respondToMemoryPressure(Critical, Synchronous) { } > void MemoryPressureHandler::platformReleaseMemory(Critical) { } > std::optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() { return std::nullopt; } >diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake >index 4d837a4471555431e22a794e9ead321302d7221f..f9b11448cf25c332f103755e9d3c47fc0d965cde 100644 >--- a/Source/WTF/wtf/PlatformMac.cmake >+++ b/Source/WTF/wtf/PlatformMac.cmake >@@ -41,8 +41,8 @@ list(APPEND WTF_SOURCES > cf/LanguageCF.cpp > cf/RunLoopCF.cpp > >- cocoa/AutodrainedPool.mm >- cocoa/CPUTimeCocoa.mm >+ cocoa/AutodrainedPool.cpp >+ cocoa/CPUTimeCocoa.cpp > cocoa/Entitlements.cpp > cocoa/MachSendRight.cpp > cocoa/MemoryFootprintCocoa.cpp >@@ -57,10 +57,9 @@ list(APPEND WTF_SOURCES > text/cf/StringImplCF.cpp > text/cf/StringViewCF.cpp > >- text/mac/StringImplMac.mm >- text/mac/StringMac.mm >- text/mac/StringViewObjC.mm >- text/mac/TextBreakIteratorInternalICUMac.mm >+ text/cocoa/StringImplCocoa.mm >+ text/cocoa/StringViewCocoa.mm >+ text/cocoa/TextBreakIteratorInternalICUMac.mm > ) > > list(APPEND WTF_PRIVATE_INCLUDE_DIRECTORIES >diff --git a/Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp b/Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..e42c7e11f6f5da25e23183a029378436f777b5f1 >--- /dev/null >+++ b/Source/WTF/wtf/cocoa/CPUTimeCocoa.cpp >@@ -0,0 +1,86 @@ >+/* >+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+#import "CPUTime.h" >+ >+#import "MachSendRight.h" >+#import <mach/mach.h> >+#import <mach/mach_time.h> >+#import <mach/task.h> >+#import <mach/task_info.h> >+#import <mach/thread_info.h> >+#import <sys/time.h> >+ >+namespace WTF { >+ >+static const int64_t microsecondsPerSecond = 1000000; >+ >+static int64_t timeValueToMicroseconds(const time_value_t& value) >+{ >+ int64_t result = value.seconds; >+ result *= microsecondsPerSecond; >+ result += value.microseconds; >+ return result; >+} >+ >+std::optional<CPUTime> CPUTime::get() >+{ >+ // Account for current threads. >+ task_thread_times_info threadInfoData; >+ mach_msg_type_number_t threadInfoCount = TASK_THREAD_TIMES_INFO_COUNT; >+ kern_return_t result = task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, reinterpret_cast<task_info_t>(&threadInfoData), &threadInfoCount); >+ if (result != KERN_SUCCESS) >+ return std::nullopt; >+ >+ int64_t userTime = timeValueToMicroseconds(threadInfoData.user_time); >+ int64_t systemTime = timeValueToMicroseconds(threadInfoData.system_time); >+ >+ // Account for termined threads. >+ task_basic_info taskInfoData; >+ mach_msg_type_number_t taskInfoCount = TASK_BASIC_INFO_COUNT; >+ result = task_info(mach_task_self(), TASK_BASIC_INFO, reinterpret_cast<task_info_t>(&taskInfoData), &taskInfoCount); >+ if (result != KERN_SUCCESS) >+ return std::nullopt; >+ >+ userTime += timeValueToMicroseconds(taskInfoData.user_time); >+ systemTime += timeValueToMicroseconds(taskInfoData.system_time); >+ >+ return CPUTime { MonotonicTime::now(), Seconds::fromMicroseconds(userTime), Seconds::fromMicroseconds(systemTime) }; >+} >+ >+Seconds CPUTime::forCurrentThread() >+{ >+ mach_msg_type_number_t infoCount = THREAD_BASIC_INFO_COUNT; >+ thread_basic_info_data_t info; >+ >+ auto threadPort = MachSendRight::adopt(mach_thread_self()); >+ auto ret = thread_info(threadPort.sendRight(), THREAD_BASIC_INFO, reinterpret_cast<thread_info_t>(&info), &infoCount); >+ RELEASE_ASSERT(ret == KERN_SUCCESS); >+ >+ return Seconds(info.user_time.seconds + info.system_time.seconds) + Seconds::fromMicroseconds(info.user_time.microseconds + info.system_time.microseconds); >+} >+ >+} >diff --git a/Source/WTF/wtf/cocoa/CPUTimeCocoa.mm b/Source/WTF/wtf/cocoa/CPUTimeCocoa.mm >deleted file mode 100644 >index e42c7e11f6f5da25e23183a029378436f777b5f1..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/cocoa/CPUTimeCocoa.mm >+++ /dev/null >@@ -1,86 +0,0 @@ >-/* >- * Copyright (C) 2017-2018 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#import "config.h" >-#import "CPUTime.h" >- >-#import "MachSendRight.h" >-#import <mach/mach.h> >-#import <mach/mach_time.h> >-#import <mach/task.h> >-#import <mach/task_info.h> >-#import <mach/thread_info.h> >-#import <sys/time.h> >- >-namespace WTF { >- >-static const int64_t microsecondsPerSecond = 1000000; >- >-static int64_t timeValueToMicroseconds(const time_value_t& value) >-{ >- int64_t result = value.seconds; >- result *= microsecondsPerSecond; >- result += value.microseconds; >- return result; >-} >- >-std::optional<CPUTime> CPUTime::get() >-{ >- // Account for current threads. >- task_thread_times_info threadInfoData; >- mach_msg_type_number_t threadInfoCount = TASK_THREAD_TIMES_INFO_COUNT; >- kern_return_t result = task_info(mach_task_self(), TASK_THREAD_TIMES_INFO, reinterpret_cast<task_info_t>(&threadInfoData), &threadInfoCount); >- if (result != KERN_SUCCESS) >- return std::nullopt; >- >- int64_t userTime = timeValueToMicroseconds(threadInfoData.user_time); >- int64_t systemTime = timeValueToMicroseconds(threadInfoData.system_time); >- >- // Account for termined threads. >- task_basic_info taskInfoData; >- mach_msg_type_number_t taskInfoCount = TASK_BASIC_INFO_COUNT; >- result = task_info(mach_task_self(), TASK_BASIC_INFO, reinterpret_cast<task_info_t>(&taskInfoData), &taskInfoCount); >- if (result != KERN_SUCCESS) >- return std::nullopt; >- >- userTime += timeValueToMicroseconds(taskInfoData.user_time); >- systemTime += timeValueToMicroseconds(taskInfoData.system_time); >- >- return CPUTime { MonotonicTime::now(), Seconds::fromMicroseconds(userTime), Seconds::fromMicroseconds(systemTime) }; >-} >- >-Seconds CPUTime::forCurrentThread() >-{ >- mach_msg_type_number_t infoCount = THREAD_BASIC_INFO_COUNT; >- thread_basic_info_data_t info; >- >- auto threadPort = MachSendRight::adopt(mach_thread_self()); >- auto ret = thread_info(threadPort.sendRight(), THREAD_BASIC_INFO, reinterpret_cast<thread_info_t>(&info), &infoCount); >- RELEASE_ASSERT(ret == KERN_SUCCESS); >- >- return Seconds(info.user_time.seconds + info.system_time.seconds) + Seconds::fromMicroseconds(info.user_time.microseconds + info.system_time.microseconds); >-} >- >-} >diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h >index 17e2c69eb99c320bc3902316bb1958b697be1b46..98b38aeeadc3dfa65793935b7f56d3509ab318f8 100644 >--- a/Source/WTF/wtf/text/WTFString.h >+++ b/Source/WTF/wtf/text/WTFString.h >@@ -319,7 +319,7 @@ public: > #endif > > #ifdef __OBJC__ >- WTF_EXPORT_PRIVATE String(NSString *); >+ String(NSString *); > > // This conversion converts the null string to an empty NSString rather than to nil. > // Given Cocoa idioms, this is a more useful default. Clients that need to preserve the >@@ -574,6 +574,11 @@ inline void String::clearImplIfNotShared() > > #ifdef __OBJC__ > >+inline String::String(NSString *string) >+ : String(reinterpret_cast<CFStringRef>(string)) >+{ >+} >+ > inline String::operator NSString *() const > { > if (!m_impl) >diff --git a/Source/WTF/wtf/text/cocoa/StringImplCocoa.mm b/Source/WTF/wtf/text/cocoa/StringImplCocoa.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..280f1810682144700bb7a892b8ce83e242ae0225 >--- /dev/null >+++ b/Source/WTF/wtf/text/cocoa/StringImplCocoa.mm >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ * >+ */ >+ >+#import "config.h" >+#import "StringImpl.h" >+ >+#import "RetainPtr.h" >+ >+namespace WTF { >+ >+StringImpl::operator NSString *() >+{ >+ return createCFString().bridgingAutorelease(); >+} >+ >+} >diff --git a/Source/WTF/wtf/text/cocoa/StringViewCocoa.mm b/Source/WTF/wtf/text/cocoa/StringViewCocoa.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..70cdbb0779b4b60ec8c4fd966fb158df993d187b >--- /dev/null >+++ b/Source/WTF/wtf/text/cocoa/StringViewCocoa.mm >@@ -0,0 +1,49 @@ >+/* >+ * Copyright (C) 2014 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+#import "StringView.h" >+ >+#import "RetainPtr.h" >+ >+namespace WTF { >+ >+RetainPtr<NSString> StringView::createNSString() const >+{ >+ if (is8Bit()) >+ return adoptNS([[NSString alloc] initWithBytes:const_cast<LChar*>(characters8()) length:length() encoding:NSISOLatin1StringEncoding]); >+ >+ return adoptNS([[NSString alloc] initWithCharacters:const_cast<UChar*>(characters16()) length:length()]); >+} >+ >+RetainPtr<NSString> StringView::createNSStringWithoutCopying() const >+{ >+ if (is8Bit()) >+ return adoptNS([[NSString alloc] initWithBytesNoCopy:const_cast<LChar*>(characters8()) length:length() encoding:NSISOLatin1StringEncoding freeWhenDone:NO]); >+ >+ return adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(characters16()) length:length() freeWhenDone:NO]); >+} >+ >+} >diff --git a/Source/WTF/wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp b/Source/WTF/wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..0cac4c9c56f364f885e77aac1528abb58a11cac0 >--- /dev/null >+++ b/Source/WTF/wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp >@@ -0,0 +1,117 @@ >+/* >+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ * >+ */ >+ >+#include "config.h" >+#include "TextBreakIteratorInternalICU.h" >+ >+#include "TextBreakIterator.h" >+#include <wtf/RetainPtr.h> >+ >+namespace WTF { >+ >+static Variant<TextBreakIteratorICU, TextBreakIteratorPlatform> mapModeToBackingIterator(StringView string, TextBreakIterator::Mode mode, const AtomicString& locale) >+{ >+ switch (mode) { >+ case TextBreakIterator::Mode::Line: >+ return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Line, locale.string().utf8().data()); >+ case TextBreakIterator::Mode::Caret: >+ return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Caret); >+ case TextBreakIterator::Mode::Delete: >+ return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Delete); >+ } >+} >+ >+TextBreakIterator::TextBreakIterator(StringView string, Mode mode, const AtomicString& locale) >+ : m_backing(mapModeToBackingIterator(string, mode, locale)) >+ , m_mode(mode) >+ , m_locale(locale) >+{ >+} >+ >+static const int maxLocaleStringLength = 32; >+ >+static inline RetainPtr<CFStringRef> textBreakLocalePreference() >+{ >+ RetainPtr<CFPropertyListRef> locale = adoptCF(CFPreferencesCopyValue(CFSTR("AppleTextBreakLocale"), >+ kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost)); >+ if (!locale || CFGetTypeID(locale.get()) != CFStringGetTypeID()) >+ return nullptr; >+ return static_cast<CFStringRef>(locale.get()); >+} >+ >+static RetainPtr<CFStringRef> topLanguagePreference() >+{ >+ RetainPtr<CFArrayRef> languagesArray = adoptCF(CFLocaleCopyPreferredLanguages()); >+ if (!languagesArray) >+ return nullptr; >+ if (!CFArrayGetCount(languagesArray.get())) >+ return nullptr; >+ return static_cast<CFStringRef>(CFArrayGetValueAtIndex(languagesArray.get(), 0)); >+} >+ >+static void getLocale(CFStringRef locale, char localeStringBuffer[maxLocaleStringLength]) >+{ >+ // Empty string means "root locale", and that is what we use if we can't get a preference. >+ localeStringBuffer[0] = 0; >+ if (!locale) >+ return; >+ CFStringGetCString(locale, localeStringBuffer, maxLocaleStringLength, kCFStringEncodingASCII); >+} >+ >+static void getSearchLocale(char localeStringBuffer[maxLocaleStringLength]) >+{ >+ getLocale(topLanguagePreference().get(), localeStringBuffer); >+} >+ >+const char* currentSearchLocaleID() >+{ >+ static char localeStringBuffer[maxLocaleStringLength]; >+ static bool gotSearchLocale = false; >+ if (!gotSearchLocale) { >+ getSearchLocale(localeStringBuffer); >+ gotSearchLocale = true; >+ } >+ return localeStringBuffer; >+} >+ >+static void getTextBreakLocale(char localeStringBuffer[maxLocaleStringLength]) >+{ >+ // If there is no text break locale, use the top language preference. >+ RetainPtr<CFStringRef> locale = textBreakLocalePreference(); >+ if (locale) { >+ if (RetainPtr<CFStringRef> canonicalLocale = adoptCF(CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, locale.get()))) >+ locale = canonicalLocale; >+ } else >+ locale = topLanguagePreference(); >+ getLocale(locale.get(), localeStringBuffer); >+} >+ >+const char* currentTextBreakLocaleID() >+{ >+ static char localeStringBuffer[maxLocaleStringLength]; >+ static bool gotTextBreakLocale = false; >+ if (!gotTextBreakLocale) { >+ getTextBreakLocale(localeStringBuffer); >+ gotTextBreakLocale = true; >+ } >+ return localeStringBuffer; >+} >+ >+} >diff --git a/Source/WTF/wtf/text/mac/StringImplMac.mm b/Source/WTF/wtf/text/mac/StringImplMac.mm >deleted file mode 100644 >index 7e1e4ff418720d17600bc6b74575ac0dad81051e..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/text/mac/StringImplMac.mm >+++ /dev/null >@@ -1,34 +0,0 @@ >-/* >- * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- * >- */ >- >-#import "config.h" >-#import "StringImpl.h" >- >-#import "ObjcRuntimeExtras.h" >-#import "RetainPtr.h" >- >-namespace WTF { >- >-StringImpl::operator NSString *() >-{ >- return createCFString().bridgingAutorelease(); >-} >- >-} >diff --git a/Source/WTF/wtf/text/mac/StringMac.mm b/Source/WTF/wtf/text/mac/StringMac.mm >deleted file mode 100644 >index 34e5c1a84fdd32779448309d48c1d908755ff1ed..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/text/mac/StringMac.mm >+++ /dev/null >@@ -1,51 +0,0 @@ >-/* >- * Copyright (C) 2006 Apple Inc. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- * >- */ >- >-#include "config.h" >-#include "WTFString.h" >- >-#include <CoreFoundation/CFString.h> >- >-namespace WTF { >- >-String::String(NSString *str) >-{ >- if (!str) >- return; >- >- CFIndex size = CFStringGetLength(reinterpret_cast<CFStringRef>(str)); >- if (size == 0) >- m_impl = StringImpl::empty(); >- else { >- Vector<LChar, 1024> lcharBuffer(size); >- CFIndex usedBufLen; >- CFIndex convertedsize = CFStringGetBytes(reinterpret_cast<CFStringRef>(str), CFRangeMake(0, size), kCFStringEncodingISOLatin1, 0, false, lcharBuffer.data(), size, &usedBufLen); >- if ((convertedsize == size) && (usedBufLen == size)) { >- m_impl = StringImpl::create(lcharBuffer.data(), size); >- return; >- } >- >- Vector<UChar, 1024> ucharBuffer(size); >- CFStringGetCharacters(reinterpret_cast<CFStringRef>(str), CFRangeMake(0, size), ucharBuffer.data()); >- m_impl = StringImpl::create(ucharBuffer.data(), size); >- } >-} >- >-} >diff --git a/Source/WTF/wtf/text/mac/StringViewObjC.mm b/Source/WTF/wtf/text/mac/StringViewObjC.mm >deleted file mode 100644 >index 70cdbb0779b4b60ec8c4fd966fb158df993d187b..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/text/mac/StringViewObjC.mm >+++ /dev/null >@@ -1,49 +0,0 @@ >-/* >- * Copyright (C) 2014 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#import "config.h" >-#import "StringView.h" >- >-#import "RetainPtr.h" >- >-namespace WTF { >- >-RetainPtr<NSString> StringView::createNSString() const >-{ >- if (is8Bit()) >- return adoptNS([[NSString alloc] initWithBytes:const_cast<LChar*>(characters8()) length:length() encoding:NSISOLatin1StringEncoding]); >- >- return adoptNS([[NSString alloc] initWithCharacters:const_cast<UChar*>(characters16()) length:length()]); >-} >- >-RetainPtr<NSString> StringView::createNSStringWithoutCopying() const >-{ >- if (is8Bit()) >- return adoptNS([[NSString alloc] initWithBytesNoCopy:const_cast<LChar*>(characters8()) length:length() encoding:NSISOLatin1StringEncoding freeWhenDone:NO]); >- >- return adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(characters16()) length:length() freeWhenDone:NO]); >-} >- >-} >diff --git a/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm b/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm >deleted file mode 100644 >index 0cac4c9c56f364f885e77aac1528abb58a11cac0..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm >+++ /dev/null >@@ -1,117 +0,0 @@ >-/* >- * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Library General Public >- * License as published by the Free Software Foundation; either >- * version 2 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Library General Public License for more details. >- * >- * You should have received a copy of the GNU Library General Public License >- * along with this library; see the file COPYING.LIB. If not, write to >- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- * Boston, MA 02110-1301, USA. >- * >- */ >- >-#include "config.h" >-#include "TextBreakIteratorInternalICU.h" >- >-#include "TextBreakIterator.h" >-#include <wtf/RetainPtr.h> >- >-namespace WTF { >- >-static Variant<TextBreakIteratorICU, TextBreakIteratorPlatform> mapModeToBackingIterator(StringView string, TextBreakIterator::Mode mode, const AtomicString& locale) >-{ >- switch (mode) { >- case TextBreakIterator::Mode::Line: >- return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Line, locale.string().utf8().data()); >- case TextBreakIterator::Mode::Caret: >- return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Caret); >- case TextBreakIterator::Mode::Delete: >- return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Delete); >- } >-} >- >-TextBreakIterator::TextBreakIterator(StringView string, Mode mode, const AtomicString& locale) >- : m_backing(mapModeToBackingIterator(string, mode, locale)) >- , m_mode(mode) >- , m_locale(locale) >-{ >-} >- >-static const int maxLocaleStringLength = 32; >- >-static inline RetainPtr<CFStringRef> textBreakLocalePreference() >-{ >- RetainPtr<CFPropertyListRef> locale = adoptCF(CFPreferencesCopyValue(CFSTR("AppleTextBreakLocale"), >- kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost)); >- if (!locale || CFGetTypeID(locale.get()) != CFStringGetTypeID()) >- return nullptr; >- return static_cast<CFStringRef>(locale.get()); >-} >- >-static RetainPtr<CFStringRef> topLanguagePreference() >-{ >- RetainPtr<CFArrayRef> languagesArray = adoptCF(CFLocaleCopyPreferredLanguages()); >- if (!languagesArray) >- return nullptr; >- if (!CFArrayGetCount(languagesArray.get())) >- return nullptr; >- return static_cast<CFStringRef>(CFArrayGetValueAtIndex(languagesArray.get(), 0)); >-} >- >-static void getLocale(CFStringRef locale, char localeStringBuffer[maxLocaleStringLength]) >-{ >- // Empty string means "root locale", and that is what we use if we can't get a preference. >- localeStringBuffer[0] = 0; >- if (!locale) >- return; >- CFStringGetCString(locale, localeStringBuffer, maxLocaleStringLength, kCFStringEncodingASCII); >-} >- >-static void getSearchLocale(char localeStringBuffer[maxLocaleStringLength]) >-{ >- getLocale(topLanguagePreference().get(), localeStringBuffer); >-} >- >-const char* currentSearchLocaleID() >-{ >- static char localeStringBuffer[maxLocaleStringLength]; >- static bool gotSearchLocale = false; >- if (!gotSearchLocale) { >- getSearchLocale(localeStringBuffer); >- gotSearchLocale = true; >- } >- return localeStringBuffer; >-} >- >-static void getTextBreakLocale(char localeStringBuffer[maxLocaleStringLength]) >-{ >- // If there is no text break locale, use the top language preference. >- RetainPtr<CFStringRef> locale = textBreakLocalePreference(); >- if (locale) { >- if (RetainPtr<CFStringRef> canonicalLocale = adoptCF(CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, locale.get()))) >- locale = canonicalLocale; >- } else >- locale = topLanguagePreference(); >- getLocale(locale.get(), localeStringBuffer); >-} >- >-const char* currentTextBreakLocaleID() >-{ >- static char localeStringBuffer[maxLocaleStringLength]; >- static bool gotTextBreakLocale = false; >- if (!gotTextBreakLocale) { >- getTextBreakLocale(localeStringBuffer); >- gotTextBreakLocale = true; >- } >- return localeStringBuffer; >-} >- >-}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
andersca
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186924
: 343329 |
344655
|
344660
|
344675