Rename StringImpl::getCharacters to StringImpl::characters
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Feb 2014 21:50:25 +0000 (21:50 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Feb 2014 21:50:25 +0000 (21:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=128205

Reviewed by Antti Koivisto.

Source/JavaScriptCore:

Update for WTF changes.

* runtime/JSStringJoiner.cpp:
(JSC::joinStrings):
* runtime/StringPrototype.cpp:
(JSC::splitStringByOneCharacterImpl):

Source/WebCore:

Update for WTF changes.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::createTextRuns):

Source/WTF:

This lets us use StringImpl::getCharacters for the upconverting version.
Also, change StringImpl::characters<UChar>() to call characters16() instead of deprecatedCharacters()
and audit all call sites to make sure we weren't relying on upconversion anywhere.

* wtf/text/AtomicString.cpp:
(WTF::findString):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::simplifyMatchedCharactersToSpace):
* wtf/text/StringImpl.h:
(WTF::StringImpl::characters<LChar>):
(WTF::StringImpl::characters<UChar>):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163401 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSStringJoiner.cpp
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/text/AtomicString.cpp
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WebCore/ChangeLog
Source/WebCore/rendering/SimpleLineLayout.cpp

index 1489a89..cafc421 100644 (file)
@@ -1,3 +1,17 @@
+2014-02-04  Anders Carlsson  <andersca@apple.com>
+
+        Rename StringImpl::getCharacters to StringImpl::characters
+        https://bugs.webkit.org/show_bug.cgi?id=128205
+
+        Reviewed by Antti Koivisto.
+
+        Update for WTF changes.
+
+        * runtime/JSStringJoiner.cpp:
+        (JSC::joinStrings):
+        * runtime/StringPrototype.cpp:
+        (JSC::splitStringByOneCharacterImpl):
+
 2014-02-04  Mark Hahnenberg  <mhahnenberg@apple.com>
 
         Fix a mismatch of uint64_t and size_t on 32-bit platforms.
index 7e20d21..9717946 100644 (file)
@@ -80,7 +80,7 @@ static inline PassRefPtr<StringImpl> joinStrings(const Vector<String>& strings,
     CharacterType* data;
     RefPtr<StringImpl> outputStringImpl = StringImpl::tryCreateUninitialized(outputLength, data);
     if (!outputStringImpl)
-        return PassRefPtr<StringImpl>();
+        return nullptr;
 
     const String firstString = strings.first();
     appendStringToData(data, firstString);
@@ -90,7 +90,7 @@ static inline PassRefPtr<StringImpl> joinStrings(const Vector<String>& strings,
         appendStringToData(data, strings[i]);
     }
 
-    ASSERT(data == (outputStringImpl->getCharacters<CharacterType>() + outputStringImpl->length()));
+    ASSERT(data == (outputStringImpl->characters<CharacterType>() + outputStringImpl->length()));
     return outputStringImpl.release();
 }
 
index d6a78bc..4c98327 100644 (file)
@@ -942,7 +942,7 @@ static ALWAYS_INLINE bool splitStringByOneCharacterImpl(ExecState* exec, JSArray
 {
     // 12. Let q = p.
     size_t matchPosition;
-    const CharacterType* characters = string->getCharacters<CharacterType>();
+    const CharacterType* characters = string->characters<CharacterType>();
     // 13. Repeat, while q != s
     //   a. Call SplitMatch(S, q, R) and let z be its MatchResult result.
     //   b. If z is failure, then let q = q+1.
index fb31725..62f85d8 100644 (file)
@@ -1,5 +1,24 @@
 2014-02-04  Anders Carlsson  <andersca@apple.com>
 
+        Rename StringImpl::getCharacters to StringImpl::characters
+        https://bugs.webkit.org/show_bug.cgi?id=128205
+
+        Reviewed by Antti Koivisto.
+
+        This lets us use StringImpl::getCharacters for the upconverting version.
+        Also, change StringImpl::characters<UChar>() to call characters16() instead of deprecatedCharacters()
+        and audit all call sites to make sure we weren't relying on upconversion anywhere.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::findString):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::simplifyMatchedCharactersToSpace):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::characters<LChar>):
+        (WTF::StringImpl::characters<UChar>):
+
+2014-02-04  Anders Carlsson  <andersca@apple.com>
+
         Rename equalNonNull to equal and make it take const StringImpl& instead
         https://bugs.webkit.org/show_bug.cgi?id=128206
 
index 5803dd0..6310eb6 100644 (file)
@@ -400,7 +400,7 @@ PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* string)
 template<typename CharacterType>
 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* stringImpl)
 {
-    HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stringImpl->getCharacters<CharacterType>(), stringImpl->length() };
+    HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stringImpl->characters<CharacterType>(), stringImpl->length() };
     return stringTable().find<HashAndCharactersTranslator<CharacterType>>(buffer);
 }
 
index 53960b5..0078c37 100644 (file)
@@ -817,7 +817,7 @@ inline PassRef<StringImpl> StringImpl::simplifyMatchedCharactersToSpace(UCharPre
 {
     StringBuffer<CharType> data(m_length);
 
-    const CharType* from = getCharacters<CharType>();
+    const CharType* from = characters<CharType>();
     const CharType* fromend = from + m_length;
     int outc = 0;
     bool changedToSpace = false;
index 9ebfdc4..2d35ed2 100644 (file)
@@ -453,7 +453,7 @@ public:
     }
 
     template <typename CharType>
-    ALWAYS_INLINE const CharType * getCharacters() const;
+    ALWAYS_INLINE const CharType *characters() const;
 
     size_t cost() const
     {
@@ -881,10 +881,10 @@ template <>
 ALWAYS_INLINE PassRef<StringImpl> StringImpl::constructInternal<UChar>(StringImpl* impl, unsigned length) { return adoptRef(*new (NotNull, impl) StringImpl(length)); }
 
 template <>
-ALWAYS_INLINE const LChar* StringImpl::getCharacters<LChar>() const { return characters8(); }
+ALWAYS_INLINE const LChar* StringImpl::characters<LChar>() const { return characters8(); }
 
 template <>
-ALWAYS_INLINE const UChar* StringImpl::getCharacters<UChar>() const { return deprecatedCharacters(); }
+ALWAYS_INLINE const UChar* StringImpl::characters<UChar>() const { return characters16(); }
 
 WTF_EXPORT_STRING_API bool equal(const StringImpl*, const StringImpl*);
 WTF_EXPORT_STRING_API bool equal(const StringImpl*, const LChar*);
index 54dd3e2..da8150e 100644 (file)
@@ -1,5 +1,17 @@
 2014-02-04  Anders Carlsson  <andersca@apple.com>
 
+        Rename StringImpl::getCharacters to StringImpl::characters
+        https://bugs.webkit.org/show_bug.cgi?id=128205
+
+        Reviewed by Antti Koivisto.
+
+        Update for WTF changes.
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::createTextRuns):
+
+2014-02-04  Anders Carlsson  <andersca@apple.com>
+
         Rename equalNonNull to equal and make it take const StringImpl& instead
         https://bugs.webkit.org/show_bug.cgi?id=128206
 
index 35a55f8..6d39751 100644 (file)
@@ -414,7 +414,7 @@ void createTextRuns(Layout::RunVector& runs, unsigned& lineCount, RenderBlockFlo
 {
     const Style style(flow.style());
 
-    const CharacterType* text = textRenderer.text()->getCharacters<CharacterType>();
+    const CharacterType* text = textRenderer.text()->characters<CharacterType>();
     const unsigned textLength = textRenderer.textLength();
 
     LayoutUnit borderAndPaddingBefore = flow.borderAndPaddingBefore();