AtomicString(CFStringRef) shouldn't unconditionally create a StringImpl
authorAnders Carlsson <andersca@apple.com>
Mon, 29 Oct 2012 23:22:32 +0000 (23:22 +0000)
committerAnders Carlsson <andersca@apple.com>
Mon, 29 Oct 2012 23:22:32 +0000 (23:22 +0000)
commit188f9706e3f0b8d66680f6cacd2ecf4b7017b75e
tree75e5bb3d7e9d0a76339caf5f90e49f7759954a48
parenta9e290e3562c5c2fbc340f47eb67d53f98711816
AtomicString(CFStringRef) shouldn't unconditionally create a StringImpl
https://bugs.webkit.org/show_bug.cgi?id=100701

Reviewed by Dan Bernstein.

Source/WebCore:

* WebCore.exp.in:
Export AtomicString::add(CFStringRef).

* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
Add AtomicStringCF.cpp

* platform/text/cf/AtomicStringCF.cpp: Added.
(WTF::AtomicString::add):
When trying to add the atomic string to the table, first try to get a Latin-1 pointer
from the string. Second, try to get a Unicode pointer from the string.
If that also fails, copy the string to a temporary unicode buffer and add it from there.

* platform/text/cf/HyphenationCF.cpp:
(WebCore::::createValueForKey):
Update for AtomicString::createCFString being removed.

Source/WTF:

* wtf/text/AtomicString.h:
(WTF::AtomicString::AtomicString):
Change the constructors that take a CFStringRef and an NSString * to call AtomicString::add(CFStringRef)
and remove AtomicString::createCFString.

(WTF::AtomicString::add):
Add new member function declaration. The definition is in a new file in WebCore, AtomicStringCF.cpp.
Also, fix the overload of add that takes a const char* to call the right other overload instead of itself.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132858 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/text/AtomicString.h
Source/WebCore/ChangeLog
Source/WebCore/Target.pri
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/text/cf/AtomicStringCF.cpp [new file with mode: 0644]
Source/WebCore/platform/text/cf/HyphenationCF.cpp