Please sign in to comment.
Do not perform 8 to 16bits characters conversion when converting a WT…
…FString to NSString/CFString https://bugs.webkit.org/show_bug.cgi?id=90720 Patch by Benjamin Poulain <email@example.com> on 2012-08-16 Reviewed by Geoffrey Garen. In most String to CFString conversion, we should be able to use the "NoCopy" constructor and have a relatively cheap conversion from WTF::String to CFString. When the String is 8 bits, it was converted to 16 bits by getData16SlowCase() because of the call to String::characters(). This patch adds a path for creating a CFString from a 8bits string using CFStringCreateWithBytes. This is covered by existing tests. * platform/text/cf/StringCF.cpp: (WTF::String::createCFString): CFSTR() create static CFString, it is unecessary to retain it. * platform/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): The logic to avoid the StringWrapperCFAllocator has also been simplified. The allocator creation is now closer to where it is useful. The function CFStringCreateWithBytesNoCopy() does not necessarilly allocate a new string, it can reuse existing strings. In those cases, the allocator is not used. For that reason, the assertion regarding currentString is moved to the branch that always allocate new strings. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information...
Showing with 42 additions and 10 deletions.