Skip to content
  • benjamin@webkit.org's avatar
    Do not perform 8 to 16bits characters conversion when converting a WTFString to NSString/CFString · f3271352
    benjamin@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=90720
    
    Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-07-24
    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.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    f3271352