Remove all uses of PassRefPtr in WTF
authorkrollin@apple.com <krollin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Jun 2016 01:31:17 +0000 (01:31 +0000)
committerkrollin@apple.com <krollin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Jun 2016 01:31:17 +0000 (01:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157596
<rdar://problem/26234391>

Reviewed by Chris Dumez.

Source/JavaScriptCore:

Update calls to interfaces that no longer take or return PassRefPtrs.

* runtime/JSString.cpp:
(JSC::JSRopeString::resolveRope):
* runtime/JSString.h:
(JSC::JSString::JSString):
(JSC::jsSubstring):
* runtime/PrivateName.h:
(JSC::PrivateName::PrivateName):
* runtime/SmallStrings.cpp:
(JSC::SmallStringsStorage::SmallStringsStorage):
* runtime/StringConstructor.cpp:
(JSC::stringFromCharCodeSlowCase):
* runtime/StringPrototype.cpp:
(JSC::jsSpliceSubstrings):
(JSC::jsSpliceSubstringsWithSeparators):
(JSC::replaceUsingStringSearch):
(JSC::repeatCharacter):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncLink):
(JSC::normalize):

Source/WebCore:

Update calls to interfaces that no longer take or return PassRefPtrs.

No new tests: no new functionality so changes are covered by existing
tests.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::formatNumberValue):
* dom/Document.cpp:
(WebCore::Document::displayStringModifiedByEncoding):
* xml/XPathGrammar.y:

Source/WTF:

Remove/update most interfaces that take or return PassRefPtrs.
Remaining references include those in non-Cocoa implementations and
those required for continued compatibility with modules that still use
PassRefPtrs (specifically: Forward.h, RefPtr interoperability,
SizeLimits.h, WorkQueue (Windows) DispatchQueueEfl,
DispatchWorkItemEfl, and PassRefPtr itself).

Update calls to interfaces that no longer take or return PassRefPtrs.

Update adoptRef(T*) to return a RefPtr instead of a PassRefPtr and
move it to RefPtr.h from PassRefPtr.h.

* wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::allocate):
* wtf/MetaAllocator.h:
* wtf/ParallelJobsGeneric.h:
(WTF::ParallelEnvironment::ThreadPrivate::create):
* wtf/text/AtomicStringImpl.cpp:
(WTF::HashAndUTF8CharactersTranslator::translate):
(WTF::SubstringTranslator::translate):
* wtf/text/CString.cpp:
(WTF::CStringBuffer::createUninitialized):
* wtf/text/CString.h:
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::reifyString):
(WTF::StringBuilder::resize):
(WTF::StringBuilder::reallocateBuffer<LChar>):
(WTF::StringBuilder::reallocateBuffer<UChar>):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::reallocateInternal):
(WTF::StringImpl::reallocate):
(WTF::StringImpl::create8BitIfPossible):
(WTF::StringImpl::createSymbol):
(WTF::StringImpl::createNullSymbol):
(WTF::StringImpl::convertToLowercaseWithoutLocale):
(WTF::StringImpl::convertToUppercaseWithoutLocale):
(WTF::StringImpl::convertToLowercaseWithLocale):
(WTF::StringImpl::convertToUppercaseWithLocale):
(WTF::StringImpl::convertASCIICase):
* wtf/text/StringImpl.h:
(WTF::StringImpl::StringImpl):
(WTF::StringImpl::createSubstringSharingImpl):
(WTF::StringImpl::tryCreateUninitialized):
(WTF::StringImpl::extractFoldedStringInSymbol):
* wtf/text/SymbolRegistry.cpp:
(WTF::SymbolRegistry::symbolForKey):
* wtf/text/WTFString.cpp:
(WTF::String::substringSharingImpl):
* wtf/text/WTFString.h:
(WTF::String::String): Deleted.
* wtf/text/cf/StringImplCF.cpp:

Tools:

Update calls to interfaces that no longer take or return PassRefPtrs.

* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::stringFromUTF8):
(TestWebKitAPI::TEST):

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

34 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp
Source/JavaScriptCore/runtime/JSString.cpp
Source/JavaScriptCore/runtime/JSString.h
Source/JavaScriptCore/runtime/PrivateName.h
Source/JavaScriptCore/runtime/SmallStrings.cpp
Source/JavaScriptCore/runtime/StringConstructor.cpp
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/MetaAllocator.cpp
Source/WTF/wtf/MetaAllocator.h
Source/WTF/wtf/ParallelJobsGeneric.h
Source/WTF/wtf/PassRefPtr.h
Source/WTF/wtf/RefPtr.h
Source/WTF/wtf/text/AtomicStringImpl.cpp
Source/WTF/wtf/text/CString.cpp
Source/WTF/wtf/text/CString.h
Source/WTF/wtf/text/StringBuilder.cpp
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/SymbolRegistry.cpp
Source/WTF/wtf/text/WTFString.cpp
Source/WTF/wtf/text/WTFString.h
Source/WTF/wtf/text/cf/StringImplCF.cpp
Source/WebCore/ChangeLog
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/platform/animation/TimingFunction.h
Source/WebKit2/Platform/IPC/HandleMessage.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp

index 0c9ded6..2631215 100644 (file)
@@ -1,3 +1,33 @@
+2016-06-07  Keith Rollin  <krollin@apple.com>
+
+        Remove all uses of PassRefPtr in WTF
+        https://bugs.webkit.org/show_bug.cgi?id=157596
+        <rdar://problem/26234391>
+
+        Reviewed by Chris Dumez.
+
+        Update calls to interfaces that no longer take or return PassRefPtrs.
+
+        * runtime/JSString.cpp:
+        (JSC::JSRopeString::resolveRope):
+        * runtime/JSString.h:
+        (JSC::JSString::JSString):
+        (JSC::jsSubstring):
+        * runtime/PrivateName.h:
+        (JSC::PrivateName::PrivateName):
+        * runtime/SmallStrings.cpp:
+        (JSC::SmallStringsStorage::SmallStringsStorage):
+        * runtime/StringConstructor.cpp:
+        (JSC::stringFromCharCodeSlowCase):
+        * runtime/StringPrototype.cpp:
+        (JSC::jsSpliceSubstrings):
+        (JSC::jsSpliceSubstringsWithSeparators):
+        (JSC::replaceUsingStringSearch):
+        (JSC::repeatCharacter):
+        (JSC::stringProtoFuncFontsize):
+        (JSC::stringProtoFuncLink):
+        (JSC::normalize):
+
 2016-06-07  Saam barati  <sbarati@apple.com>
 
         InvalidationPointInjectionPhase creates bogus InvalidationPoints that may even be inserted when it's not OK to exit
index dece24f..199cec5 100644 (file)
@@ -35,6 +35,7 @@
 #include "JSCInlines.h"
 #include "SlotVisitor.h"
 #include "Structure.h"
+#include <wtf/RefPtr.h>
 
 namespace JSC {
 
@@ -144,17 +145,13 @@ PassRefPtr<JITStubRoutine> createJITStubRoutine(
     
     if (codeBlockForExceptionHandlers) {
         RELEASE_ASSERT(JITCode::isOptimizingJIT(codeBlockForExceptionHandlers->jitType()));
-        return static_pointer_cast<JITStubRoutine>(
-            adoptRef(new GCAwareJITStubRoutineWithExceptionHandler(code, vm, owner, cells, codeBlockForExceptionHandlers, exceptionHandlerCallSiteIndex)));
+        return adoptRef(new GCAwareJITStubRoutineWithExceptionHandler(code, vm, owner, cells, codeBlockForExceptionHandlers, exceptionHandlerCallSiteIndex));
     }
 
-    if (cells.isEmpty()) {
-        return static_pointer_cast<JITStubRoutine>(
-            adoptRef(new GCAwareJITStubRoutine(code, vm)));
-    }
+    if (cells.isEmpty())
+        return adoptRef(new GCAwareJITStubRoutine(code, vm));
     
-    return static_pointer_cast<JITStubRoutine>(
-        adoptRef(new MarkingGCAwareJITStubRoutine(code, vm, owner, cells)));
+    return adoptRef(new MarkingGCAwareJITStubRoutine(code, vm, owner, cells));
 }
 
 } // namespace JSC
index ad8a67a..4f60374 100644 (file)
@@ -252,9 +252,9 @@ void JSRopeString::resolveRope(ExecState* exec) const
     
     if (is8Bit()) {
         LChar* buffer;
-        if (RefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
+        if (auto newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
             Heap::heap(this)->reportExtraMemoryAllocated(newImpl->cost());
-            m_value = newImpl.release();
+            m_value = WTFMove(newImpl);
         } else {
             outOfMemory(exec);
             return;
@@ -266,9 +266,9 @@ void JSRopeString::resolveRope(ExecState* exec) const
     }
 
     UChar* buffer;
-    if (RefPtr<StringImpl> newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
+    if (auto newImpl = StringImpl::tryCreateUninitialized(m_length, buffer)) {
         Heap::heap(this)->reportExtraMemoryAllocated(newImpl->cost());
-        m_value = newImpl.release();
+        m_value = WTFMove(newImpl);
     } else {
         outOfMemory(exec);
         return;
index 6082f67..27c2eb2 100644 (file)
@@ -93,7 +93,7 @@ private:
     JSString(VM& vm, PassRefPtr<StringImpl> value)
         : JSCell(vm, vm.stringStructure.get())
         , m_flags(0)
-        , m_value(value)
+        , m_value(RefPtr<StringImpl>(value))
     {
     }
 
@@ -603,7 +603,7 @@ inline JSString* jsSubstring(VM* vm, const String& s, unsigned offset, unsigned
         if (c <= maxSingleCharacterString)
             return vm->smallStrings.singleCharacterString(c);
     }
-    return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, length));
+    return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl(*s.impl(), offset, length));
 }
 
 inline JSString* jsOwnedString(VM* vm, const String& s)
index 85c139e..f0bc60d 100644 (file)
@@ -44,7 +44,7 @@ public:
 
     enum DescriptionTag { Description };
     explicit PrivateName(DescriptionTag, const String& description)
-        : m_uid(StringImpl::createSymbol(description.impl()))
+        : m_uid(StringImpl::createSymbol(*description.impl()))
     {
     }
 
index 9475186..105c0ef 100644 (file)
@@ -54,10 +54,10 @@ private:
 SmallStringsStorage::SmallStringsStorage()
 {
     LChar* characterBuffer = 0;
-    RefPtr<StringImpl> baseString = StringImpl::createUninitialized(singleCharacterStringCount, characterBuffer);
+    auto baseString = StringImpl::createUninitialized(singleCharacterStringCount, characterBuffer);
     for (unsigned i = 0; i < singleCharacterStringCount; ++i) {
         characterBuffer[i] = i;
-        m_reps[i] = AtomicStringImpl::add(PassRefPtr<StringImpl>(StringImpl::createSubstringSharingImpl(baseString, i, 1)).get());
+        m_reps[i] = AtomicStringImpl::add(StringImpl::createSubstringSharingImpl(baseString.get(), i, 1).ptr());
     }
 }
 
index d97c72a..db564bb 100644 (file)
@@ -70,10 +70,10 @@ static NEVER_INLINE JSValue stringFromCharCodeSlowCase(ExecState* exec)
 {
     unsigned length = exec->argumentCount();
     UChar* buf;
-    PassRefPtr<StringImpl> impl = StringImpl::createUninitialized(length, buf);
+    auto impl = StringImpl::createUninitialized(length, buf);
     for (unsigned i = 0; i < length; ++i)
         buf[i] = static_cast<UChar>(exec->uncheckedArgument(i).toUInt32(exec));
-    return jsString(exec, impl);
+    return jsString(exec, WTFMove(impl));
 }
 
 static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
index e7ecc82..93180f4 100644 (file)
@@ -294,7 +294,7 @@ static ALWAYS_INLINE JSValue jsSpliceSubstrings(ExecState* exec, JSString* sourc
         if (position <= 0 && length >= sourceSize)
             return sourceVal;
         // We could call String::substringSharingImpl(), but this would result in redundant checks.
-        return jsString(exec, StringImpl::createSubstringSharingImpl(source.impl(), std::max(0, position), std::min(sourceSize, length)));
+        return jsString(exec, StringImpl::createSubstringSharingImpl(*source.impl(), std::max(0, position), std::min(sourceSize, length)));
     }
 
     int totalLength = 0;
@@ -307,7 +307,7 @@ static ALWAYS_INLINE JSValue jsSpliceSubstrings(ExecState* exec, JSString* sourc
     if (source.is8Bit()) {
         LChar* buffer;
         const LChar* sourceData = source.characters8();
-        RefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(totalLength, buffer);
+        auto impl = StringImpl::tryCreateUninitialized(totalLength, buffer);
         if (!impl)
             return throwOutOfMemoryError(exec);
 
@@ -319,13 +319,13 @@ static ALWAYS_INLINE JSValue jsSpliceSubstrings(ExecState* exec, JSString* sourc
             }
         }
 
-        return jsString(exec, impl.release());
+        return jsString(exec, WTFMove(impl));
     }
 
     UChar* buffer;
     const UChar* sourceData = source.characters16();
 
-    RefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(totalLength, buffer);
+    auto impl = StringImpl::tryCreateUninitialized(totalLength, buffer);
     if (!impl)
         return throwOutOfMemoryError(exec);
 
@@ -337,7 +337,7 @@ static ALWAYS_INLINE JSValue jsSpliceSubstrings(ExecState* exec, JSString* sourc
         }
     }
 
-    return jsString(exec, impl.release());
+    return jsString(exec, WTFMove(impl));
 }
 
 static ALWAYS_INLINE JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, JSString* sourceVal, const String& source, const StringRange* substringRanges, int rangeCount, const String* separators, int separatorCount)
@@ -349,7 +349,7 @@ static ALWAYS_INLINE JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, J
         if (position <= 0 && length >= sourceSize)
             return sourceVal;
         // We could call String::substringSharingImpl(), but this would result in redundant checks.
-        return jsString(exec, StringImpl::createSubstringSharingImpl(source.impl(), std::max(0, position), std::min(sourceSize, length)));
+        return jsString(exec, StringImpl::createSubstringSharingImpl(*source.impl(), std::max(0, position), std::min(sourceSize, length)));
     }
 
     Checked<int, RecordOverflow> totalLength = 0;
@@ -371,7 +371,7 @@ static ALWAYS_INLINE JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, J
         LChar* buffer;
         const LChar* sourceData = source.characters8();
 
-        RefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(totalLength.unsafeGet(), buffer);
+        auto impl = StringImpl::tryCreateUninitialized(totalLength.unsafeGet(), buffer);
         if (!impl)
             return throwOutOfMemoryError(exec);
 
@@ -392,11 +392,11 @@ static ALWAYS_INLINE JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, J
             }
         }        
 
-        return jsString(exec, impl.release());
+        return jsString(exec, WTFMove(impl));
     }
 
     UChar* buffer;
-    RefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(totalLength.unsafeGet(), buffer);
+    auto impl = StringImpl::tryCreateUninitialized(totalLength.unsafeGet(), buffer);
     if (!impl)
         return throwOutOfMemoryError(exec);
 
@@ -423,7 +423,7 @@ static ALWAYS_INLINE JSValue jsSpliceSubstringsWithSeparators(ExecState* exec, J
         }
     }
 
-    return jsString(exec, impl.release());
+    return jsString(exec, WTFMove(impl));
 }
 
 static ALWAYS_INLINE EncodedJSValue removeUsingRegExpSearch(VM& vm, ExecState* exec, JSString* string, const String& source, RegExp* regExp)
@@ -722,14 +722,14 @@ static ALWAYS_INLINE EncodedJSValue replaceUsingStringSearch(VM&, ExecState* exe
         return JSValue::encode(jsUndefined());
 
     StringImpl* stringImpl = string.impl();
-    String leftPart(StringImpl::createSubstringSharingImpl(stringImpl, 0, matchStart));
+    String leftPart(StringImpl::createSubstringSharingImpl(*stringImpl, 0, matchStart));
 
     size_t matchEnd = matchStart + searchString.impl()->length();
     int ovector[2] = { static_cast<int>(matchStart),  static_cast<int>(matchEnd)};
     String middlePart = substituteBackreferences(replaceString, string, ovector, 0);
 
     size_t leftLength = stringImpl->length() - matchEnd;
-    String rightPart(StringImpl::createSubstringSharingImpl(stringImpl, matchEnd, leftLength));
+    String rightPart(StringImpl::createSubstringSharingImpl(*stringImpl, matchEnd, leftLength));
     return JSValue::encode(JSC::jsString(exec, leftPart, middlePart, rightPart));
 }
 
@@ -751,26 +751,26 @@ template <typename CharacterType>
 static inline JSValue repeatCharacter(ExecState* exec, CharacterType character, unsigned repeatCount)
 {
     CharacterType* buffer = nullptr;
-    RefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(repeatCount, buffer);
+    auto impl = StringImpl::tryCreateUninitialized(repeatCount, buffer);
     if (!impl)
         return throwOutOfMemoryError(exec);
 
     std::fill_n(buffer, repeatCount, character);
 
-    return jsString(exec, impl.release());
+    return jsString(exec, WTFMove(impl));
 }
 
 template <typename CharacterType>
 static inline JSString* repeatCharacter(ExecState& exec, CharacterType character, unsigned repeatCount)
 {
     CharacterType* buffer = nullptr;
-    RefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(repeatCount, buffer);
+    auto impl = StringImpl::tryCreateUninitialized(repeatCount, buffer);
     if (!impl)
         return throwOutOfMemoryError(&exec), nullptr;
 
     std::fill_n(buffer, repeatCount, character);
 
-    return jsString(&exec, impl.release());
+    return jsString(&exec, WTFMove(impl));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncRepeatCharacter(ExecState* exec)
@@ -1572,7 +1572,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
         unsigned bufferSize = 22 + stringSize;
         // FIXME: Should we have an 8-bit version of this code path too? Or maybe only an 8-bit version?
         UChar* buffer;
-        PassRefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(bufferSize, buffer);
+        auto impl = StringImpl::tryCreateUninitialized(bufferSize, buffer);
         if (!impl)
             return JSValue::encode(jsUndefined());
         buffer[0] = '<';
@@ -1598,7 +1598,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec)
         buffer[19 + stringSize] = 'n';
         buffer[20 + stringSize] = 't';
         buffer[21 + stringSize] = '>';
-        return JSValue::encode(jsNontrivialString(exec, impl));
+        return JSValue::encode(jsNontrivialString(exec, WTFMove(impl)));
     }
 
     String fontSize = a0.toWTFString(exec);
@@ -1641,7 +1641,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
     unsigned bufferSize = 15 + linkTextSize + stringSize;
     // FIXME: Should we have an 8-bit version of this code path too? Or maybe only an 8-bit version?
     UChar* buffer;
-    PassRefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(bufferSize, buffer);
+    auto impl = StringImpl::tryCreateUninitialized(bufferSize, buffer);
     if (!impl)
         return JSValue::encode(jsUndefined());
     buffer[0] = '<';
@@ -1661,7 +1661,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec)
     buffer[12 + linkTextSize + stringSize] = '/';
     buffer[13 + linkTextSize + stringSize] = 'a';
     buffer[14 + linkTextSize + stringSize] = '>';
-    return JSValue::encode(jsNontrivialString(exec, impl));
+    return JSValue::encode(jsNontrivialString(exec, WTFMove(impl)));
 }
 
 enum {
@@ -1878,7 +1878,7 @@ static JSValue normalize(ExecState* exec, const UChar* source, size_t sourceLeng
     }
 
     UChar* buffer = nullptr;
-    RefPtr<StringImpl> impl = StringImpl::tryCreateUninitialized(normalizedStringLength, buffer);
+    auto impl = StringImpl::tryCreateUninitialized(normalizedStringLength, buffer);
     if (!impl)
         return throwOutOfMemoryError(exec);
 
@@ -1887,7 +1887,7 @@ static JSValue normalize(ExecState* exec, const UChar* source, size_t sourceLeng
     if (U_FAILURE(status))
         return throwTypeError(exec);
 
-    return jsString(exec, impl.release());
+    return jsString(exec, WTFMove(impl));
 }
 
 EncodedJSValue JSC_HOST_CALL stringProtoFuncNormalize(ExecState* exec)
index 9ae2555..cf3b32a 100644 (file)
@@ -1,3 +1,63 @@
+2016-06-07  Keith Rollin  <krollin@apple.com>
+
+        Remove all uses of PassRefPtr in WTF
+        https://bugs.webkit.org/show_bug.cgi?id=157596
+        <rdar://problem/26234391>
+
+        Reviewed by Chris Dumez.
+
+        Remove/update most interfaces that take or return PassRefPtrs.
+        Remaining references include those in non-Cocoa implementations and
+        those required for continued compatibility with modules that still use
+        PassRefPtrs (specifically: Forward.h, RefPtr interoperability,
+        SizeLimits.h, WorkQueue (Windows) DispatchQueueEfl,
+        DispatchWorkItemEfl, and PassRefPtr itself).
+
+        Update calls to interfaces that no longer take or return PassRefPtrs.
+
+        Update adoptRef(T*) to return a RefPtr instead of a PassRefPtr and
+        move it to RefPtr.h from PassRefPtr.h.
+
+        * wtf/MetaAllocator.cpp:
+        (WTF::MetaAllocator::allocate):
+        * wtf/MetaAllocator.h:
+        * wtf/ParallelJobsGeneric.h:
+        (WTF::ParallelEnvironment::ThreadPrivate::create):
+        * wtf/text/AtomicStringImpl.cpp:
+        (WTF::HashAndUTF8CharactersTranslator::translate):
+        (WTF::SubstringTranslator::translate):
+        * wtf/text/CString.cpp:
+        (WTF::CStringBuffer::createUninitialized):
+        * wtf/text/CString.h:
+        * wtf/text/StringBuilder.cpp:
+        (WTF::StringBuilder::reifyString):
+        (WTF::StringBuilder::resize):
+        (WTF::StringBuilder::reallocateBuffer<LChar>):
+        (WTF::StringBuilder::reallocateBuffer<UChar>):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::reallocateInternal):
+        (WTF::StringImpl::reallocate):
+        (WTF::StringImpl::create8BitIfPossible):
+        (WTF::StringImpl::createSymbol):
+        (WTF::StringImpl::createNullSymbol):
+        (WTF::StringImpl::convertToLowercaseWithoutLocale):
+        (WTF::StringImpl::convertToUppercaseWithoutLocale):
+        (WTF::StringImpl::convertToLowercaseWithLocale):
+        (WTF::StringImpl::convertToUppercaseWithLocale):
+        (WTF::StringImpl::convertASCIICase):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::StringImpl):
+        (WTF::StringImpl::createSubstringSharingImpl):
+        (WTF::StringImpl::tryCreateUninitialized):
+        (WTF::StringImpl::extractFoldedStringInSymbol):
+        * wtf/text/SymbolRegistry.cpp:
+        (WTF::SymbolRegistry::symbolForKey):
+        * wtf/text/WTFString.cpp:
+        (WTF::String::substringSharingImpl):
+        * wtf/text/WTFString.h:
+        (WTF::String::String): Deleted.
+        * wtf/text/cf/StringImplCF.cpp:
+
 2016-06-07  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [JSC] Do not allocate unnecessary UTF-8 string for encodeXXX functions
index dd06592..6e44b67 100644 (file)
@@ -148,12 +148,12 @@ MetaAllocator::MetaAllocator(size_t allocationGranule, size_t pageSize)
     ASSERT(static_cast<size_t>(1) << m_logAllocationGranule == m_allocationGranule);
 }
 
-PassRefPtr<MetaAllocatorHandle> MetaAllocator::allocate(size_t sizeInBytes, void* ownerUID)
+RefPtr<MetaAllocatorHandle> MetaAllocator::allocate(size_t sizeInBytes, void* ownerUID)
 {
     LockHolder locker(&m_lock);
 
     if (!sizeInBytes)
-        return 0;
+        return nullptr;
     
     sizeInBytes = roundUp(sizeInBytes);
     
@@ -164,7 +164,7 @@ PassRefPtr<MetaAllocatorHandle> MetaAllocator::allocate(size_t sizeInBytes, void
         
         start = allocateNewSpace(numberOfPages);
         if (!start)
-            return 0;
+            return nullptr;
         
         ASSERT(numberOfPages >= requestedNumberOfPages);
         
@@ -186,12 +186,12 @@ PassRefPtr<MetaAllocatorHandle> MetaAllocator::allocate(size_t sizeInBytes, void
     m_numAllocations++;
 #endif
 
-    MetaAllocatorHandle* handle = new MetaAllocatorHandle(this, start, sizeInBytes, ownerUID);
+    auto handle = adoptRef(*new MetaAllocatorHandle(this, start, sizeInBytes, ownerUID));
 
     if (UNLIKELY(!!m_tracker))
-        m_tracker->notify(handle);
+        m_tracker->notify(handle.ptr());
 
-    return adoptRef(handle);
+    return WTFMove(handle);
 }
 
 MetaAllocator::Statistics MetaAllocator::currentStatistics()
index 9dd375c..873901b 100644 (file)
@@ -68,7 +68,7 @@ public:
     
     WTF_EXPORT_PRIVATE virtual ~MetaAllocator();
     
-    WTF_EXPORT_PRIVATE PassRefPtr<MetaAllocatorHandle> allocate(size_t sizeInBytes, void* ownerUID);
+    WTF_EXPORT_PRIVATE RefPtr<MetaAllocatorHandle> allocate(size_t sizeInBytes, void* ownerUID);
 
     void trackAllocations(MetaAllocatorTracker* tracker)
     {
index 3e2e29d..52f4799 100644 (file)
@@ -66,9 +66,9 @@ public:
 
         void waitForFinish();
 
-        static PassRefPtr<ThreadPrivate> create()
+        static Ref<ThreadPrivate> create()
         {
-            return adoptRef(new ThreadPrivate());
+            return adoptRef(*new ThreadPrivate());
         }
 
         static void workerThread(void*);
index ceb5287..089192b 100644 (file)
 #ifndef WTF_PassRefPtr_h
 #define WTF_PassRefPtr_h
 
-#include <wtf/GetPtr.h>
 #include <wtf/Ref.h>
 
 namespace WTF {
 
     template<typename T> class RefPtr;
     template<typename T> class PassRefPtr;
-    template<typename T> PassRefPtr<T> adoptRef(T*);
 
     template<typename T> ALWAYS_INLINE void refIfNotNull(T* ptr)
     {
@@ -59,6 +57,7 @@ namespace WTF {
 
         template<typename U> PassRefPtr(const RefPtr<U>&);
         template<typename U> PassRefPtr(Ref<U>&& reference) : m_ptr(&reference.leakRef()) { }
+        template<typename U> PassRefPtr(RefPtr<U>&& reference) : m_ptr(reference.leakRef()) { }
 
         T* get() const { return m_ptr; }
 
@@ -73,7 +72,7 @@ namespace WTF {
         typedef T* (PassRefPtr::*UnspecifiedBoolType);
         operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::m_ptr : nullptr; }
 
-        friend PassRefPtr adoptRef<T>(T*);
+        template<typename V, typename U> friend PassRefPtr<V> static_pointer_cast(const PassRefPtr<U>&);
 
     private:
         PassRefPtr& operator=(const PassRefPtr&) = delete;
@@ -145,16 +144,10 @@ namespace WTF {
     { 
         return a != b.get(); 
     }
-    
-    template<typename T> inline PassRefPtr<T> adoptRef(T* p)
-    {
-        adopted(p);
-        return PassRefPtr<T>(p, PassRefPtr<T>::Adopt);
-    }
 
-    template<typename T, typename U> inline PassRefPtr<T> static_pointer_cast(const PassRefPtr<U>& p) 
-    { 
-        return adoptRef(static_cast<T*>(p.leakRef())); 
+    template<typename V, typename U> inline PassRefPtr<V> static_pointer_cast(const PassRefPtr<U>& p)
+    {
+        return PassRefPtr<V>(static_cast<V*>(p.leakRef()), PassRefPtr<V>::Adopt);
     }
 
     template <typename T> struct IsSmartPtr<PassRefPtr<T>> {
@@ -164,7 +157,6 @@ namespace WTF {
 } // namespace WTF
 
 using WTF::PassRefPtr;
-using WTF::adoptRef;
 using WTF::static_pointer_cast;
 
 #endif // WTF_PassRefPtr_h
index ed51ee6..de47b66 100644 (file)
@@ -31,6 +31,9 @@
 
 namespace WTF {
 
+template<typename T> class RefPtr;
+template<typename T> RefPtr<T> adoptRef(T*);
+
 enum HashTableDeletedValueType { HashTableDeletedValue };
 
 template<typename T> class RefPtr {
@@ -62,7 +65,8 @@ public:
 
     T* get() const { return m_ptr; }
     
-    PassRefPtr<T> release() { PassRefPtr<T> tmp = adoptRef(m_ptr); m_ptr = nullptr; return tmp; }
+    // FIXME: Remove release() and change all call sites to call WTFMove().
+    RefPtr<T> release() { RefPtr<T> tmp = adoptRef(m_ptr); m_ptr = nullptr; return tmp; }
     Ref<T> releaseNonNull() { ASSERT(m_ptr); Ref<T> tmp(adoptRef(*m_ptr)); m_ptr = nullptr; return tmp; }
 
     T* leakRef() WARN_UNUSED_RETURN;
@@ -98,6 +102,11 @@ public:
 #endif
 
 private:
+    friend RefPtr adoptRef<T>(T*);
+
+    enum AdoptTag { Adopt };
+    RefPtr(T* ptr, AdoptTag) : m_ptr(ptr) { }
+
     T* m_ptr;
 };
 
@@ -228,9 +237,16 @@ template <typename T> struct IsSmartPtr<RefPtr<T>> {
     static const bool value = true;
 };
 
+template<typename T> inline RefPtr<T> adoptRef(T* p)
+{
+    adopted(p);
+    return RefPtr<T>(p, RefPtr<T>::Adopt);
+}
+
 } // namespace WTF
 
 using WTF::RefPtr;
+using WTF::adoptRef;
 using WTF::static_pointer_cast;
 
 #endif // WTF_RefPtr_h
index 909533c..ac60b63 100644 (file)
@@ -219,7 +219,7 @@ struct HashAndUTF8CharactersTranslator {
     static void translate(StringImpl*& location, const HashAndUTF8Characters& buffer, unsigned hash)
     {
         UChar* target;
-        RefPtr<StringImpl> newString = StringImpl::createUninitialized(buffer.utf16Length, target);
+        auto newString = StringImpl::createUninitialized(buffer.utf16Length, target);
 
         bool isAllASCII;
         const char* source = buffer.characters;
@@ -229,7 +229,7 @@ struct HashAndUTF8CharactersTranslator {
         if (isAllASCII)
             newString = StringImpl::create(buffer.characters, buffer.length);
 
-        location = newString.leakRef();
+        location = &newString.leakRef();
         location->setHash(hash);
         location->setIsAtomic(true);
     }
@@ -284,7 +284,7 @@ struct SubstringLocation {
 struct SubstringTranslator {
     static void translate(StringImpl*& location, const SubstringLocation& buffer, unsigned hash)
     {
-        location = &StringImpl::createSubstringSharingImpl(buffer.baseString, buffer.start, buffer.length).leakRef();
+        location = &StringImpl::createSubstringSharingImpl(*buffer.baseString, buffer.start, buffer.length).leakRef();
         location->setHash(hash);
         location->setIsAtomic(true);
     }
index d1f186b..21b37eb 100644 (file)
 
 namespace WTF {
 
-PassRefPtr<CStringBuffer> CStringBuffer::createUninitialized(size_t length)
+Ref<CStringBuffer> CStringBuffer::createUninitialized(size_t length)
 {
     RELEASE_ASSERT(length < (std::numeric_limits<unsigned>::max() - sizeof(CStringBuffer)));
 
     // The +1 is for the terminating null character.
     size_t size = sizeof(CStringBuffer) + length + 1;
     CStringBuffer* stringBuffer = static_cast<CStringBuffer*>(fastMalloc(size));
-    return adoptRef(new (NotNull, stringBuffer) CStringBuffer(length));
+    return adoptRef(*new (NotNull, stringBuffer) CStringBuffer(length));
 }
 
 CString::CString(const char* str)
@@ -76,7 +76,7 @@ char* CString::mutableData()
         return 0;
     return m_buffer->mutableData();
 }
-    
+
 CString CString::newUninitialized(size_t length, char*& characterBuffer)
 {
     CString result;
index 29d3b0e..4d8d803 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <wtf/HashFunctions.h>
 #include <wtf/HashTraits.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 
 namespace WTF {
@@ -43,7 +43,7 @@ public:
 private:
     friend class CString;
 
-    static PassRefPtr<CStringBuffer> createUninitialized(size_t length);
+    static Ref<CStringBuffer> createUninitialized(size_t length);
 
     CStringBuffer(size_t length) : m_length(length) { }
     char* mutableData() { return reinterpret_cast_ptr<char*>(this + 1); }
index 1d6ae62..fc18c42 100644 (file)
@@ -59,7 +59,7 @@ void StringBuilder::reifyString() const
     if (m_length == m_buffer->length())
         m_string = m_buffer.get();
     else
-        m_string = StringImpl::createSubstringSharingImpl(m_buffer, 0, m_length);
+        m_string = StringImpl::createSubstringSharingImpl(*m_buffer, 0, m_length);
 }
 
 void StringBuilder::resize(unsigned newSize)
@@ -88,7 +88,7 @@ void StringBuilder::resize(unsigned newSize)
     ASSERT(m_length == m_string.length());
     ASSERT(newSize < m_string.length());
     m_length = newSize;
-    m_string = StringImpl::createSubstringSharingImpl(m_string.impl(), 0, newSize);
+    m_string = StringImpl::createSubstringSharingImpl(*m_string.impl(), 0, newSize);
 }
 
 // Allocate a new 8 bit buffer, copying in currentCharacters (these may come from either m_string
@@ -147,7 +147,7 @@ void StringBuilder::reallocateBuffer<LChar>(unsigned requiredLength)
     ASSERT(m_buffer->is8Bit());
     
     if (m_buffer->hasOneRef())
-        m_buffer = StringImpl::reallocate(m_buffer.release(), requiredLength, m_bufferCharacters8);
+        m_buffer = StringImpl::reallocate(m_buffer.releaseNonNull(), requiredLength, m_bufferCharacters8);
     else
         allocateBuffer(m_buffer->characters8(), requiredLength);
 }
@@ -162,7 +162,7 @@ void StringBuilder::reallocateBuffer<UChar>(unsigned requiredLength)
     if (m_buffer->is8Bit())
         allocateBufferUpConvert(m_buffer->characters8(), requiredLength);
     else if (m_buffer->hasOneRef())
-        m_buffer = StringImpl::reallocate(m_buffer.release(), requiredLength, m_bufferCharacters16);
+        m_buffer = StringImpl::reallocate(m_buffer.releaseNonNull(), requiredLength, m_bufferCharacters16);
     else
         allocateBuffer(m_buffer->characters16(), requiredLength);
 }
index fc16274..2d0da35 100644 (file)
@@ -204,8 +204,8 @@ Ref<StringImpl> StringImpl::createUninitialized(unsigned length, UChar*& data)
 }
 
 template <typename CharType>
-inline Ref<StringImpl> StringImpl::reallocateInternal(PassRefPtr<StringImpl> originalString, unsigned length, CharType*& data)
-{   
+inline Ref<StringImpl> StringImpl::reallocateInternal(Ref<StringImpl>&& originalString, unsigned length, CharType*& data)
+{
     ASSERT(originalString->hasOneRef());
     ASSERT(originalString->bufferOwnership() == BufferInternal);
 
@@ -219,22 +219,22 @@ inline Ref<StringImpl> StringImpl::reallocateInternal(PassRefPtr<StringImpl> ori
         CRASH();
 
     originalString->~StringImpl();
-    StringImpl* string = static_cast<StringImpl*>(fastRealloc(originalString.leakRef(), allocationSize<CharType>(length)));
+    auto* string = static_cast<StringImpl*>(fastRealloc(&originalString.leakRef(), allocationSize<CharType>(length)));
 
     data = string->tailPointer<CharType>();
     return constructInternal<CharType>(string, length);
 }
 
-Ref<StringImpl> StringImpl::reallocate(PassRefPtr<StringImpl> originalString, unsigned length, LChar*& data)
+Ref<StringImpl> StringImpl::reallocate(Ref<StringImpl>&& originalString, unsigned length, LChar*& data)
 {
     ASSERT(originalString->is8Bit());
-    return reallocateInternal(originalString, length, data);
+    return reallocateInternal(WTFMove(originalString), length, data);
 }
 
-Ref<StringImpl> StringImpl::reallocate(PassRefPtr<StringImpl> originalString, unsigned length, UChar*& data)
+Ref<StringImpl> StringImpl::reallocate(Ref<StringImpl>&& originalString, unsigned length, UChar*& data)
 {
     ASSERT(!originalString->is8Bit());
-    return reallocateInternal(originalString, length, data);
+    return reallocateInternal(WTFMove(originalString), length, data);
 }
 
 template <typename CharType>
@@ -265,7 +265,7 @@ Ref<StringImpl> StringImpl::create8BitIfPossible(const UChar* characters, unsign
         return *empty();
 
     LChar* data;
-    RefPtr<StringImpl> string = createUninitializedInternalNonEmpty(length, data);
+    auto string = createUninitializedInternalNonEmpty(length, data);
 
     for (size_t i = 0; i < length; ++i) {
         if (characters[i] & 0xff00)
@@ -273,7 +273,7 @@ Ref<StringImpl> StringImpl::create8BitIfPossible(const UChar* characters, unsign
         data[i] = static_cast<LChar>(characters[i]);
     }
 
-    return string.releaseNonNull();
+    return string;
 }
 
 Ref<StringImpl> StringImpl::create8BitIfPossible(const UChar* string)
@@ -291,24 +291,24 @@ Ref<StringImpl> StringImpl::create(const LChar* string)
     return create(string, length);
 }
 
-Ref<SymbolImpl> StringImpl::createSymbol(PassRefPtr<StringImpl> rep)
+Ref<SymbolImpl> StringImpl::createSymbol(StringImpl& rep)
 {
-    StringImpl* ownerRep = (rep->bufferOwnership() == BufferSubstring) ? rep->substringBuffer() : rep.get();
+    auto* ownerRep = (rep.bufferOwnership() == BufferSubstring) ? rep.substringBuffer() : &rep;
 
     // We allocate a buffer that contains
     // 1. the StringImpl struct
     // 2. the pointer to the owner string
     // 3. the pointer to the symbol registry
     // 4. the placeholder for symbol aware hash value (allocated size is pointer size, but only 4 bytes are used)
-    StringImpl* stringImpl = static_cast<StringImpl*>(fastMalloc(allocationSize<StringImpl*>(3)));
-    if (rep->is8Bit())
-        return adoptRef(static_cast<SymbolImpl&>(*new (NotNull, stringImpl) StringImpl(CreateSymbol, rep->m_data8, rep->length(), ownerRep)));
-    return adoptRef(static_cast<SymbolImpl&>(*new (NotNull, stringImpl) StringImpl(CreateSymbol, rep->m_data16, rep->length(), ownerRep)));
+    auto* stringImpl = static_cast<StringImpl*>(fastMalloc(allocationSize<StringImpl*>(3)));
+    if (rep.is8Bit())
+        return adoptRef(static_cast<SymbolImpl&>(*new (NotNull, stringImpl) StringImpl(CreateSymbol, rep.m_data8, rep.length(), *ownerRep)));
+    return adoptRef(static_cast<SymbolImpl&>(*new (NotNull, stringImpl) StringImpl(CreateSymbol, rep.m_data16, rep.length(), *ownerRep)));
 }
 
 Ref<SymbolImpl> StringImpl::createNullSymbol()
 {
-    return createSymbol(null());
+    return createSymbol(*null());
 }
 
 bool StringImpl::containsOnlyWhitespace()
@@ -427,19 +427,19 @@ SlowPath:
 
     // Do a slower implementation for cases that include non-ASCII characters.
     UChar* data16;
-    RefPtr<StringImpl> newImpl = createUninitializedInternalNonEmpty(m_length, data16);
+    auto newImpl = createUninitializedInternalNonEmpty(m_length, data16);
 
     UErrorCode status = U_ZERO_ERROR;
     int32_t realLength = u_strToLower(data16, length, m_data16, m_length, "", &status);
     if (U_SUCCESS(status) && realLength == length)
-        return newImpl.releaseNonNull();
+        return newImpl;
 
     newImpl = createUninitialized(realLength, data16);
     status = U_ZERO_ERROR;
     u_strToLower(data16, realLength, m_data16, m_length, "", &status);
     if (U_FAILURE(status))
         return *this;
-    return newImpl.releaseNonNull();
+    return newImpl;
 }
 
 Ref<StringImpl> StringImpl::convertToUppercaseWithoutLocale()
@@ -455,7 +455,7 @@ Ref<StringImpl> StringImpl::convertToUppercaseWithoutLocale()
 
     if (is8Bit()) {
         LChar* data8;
-        RefPtr<StringImpl> newImpl = createUninitialized(m_length, data8);
+        auto newImpl = createUninitialized(m_length, data8);
         
         // Do a faster loop for the case where all the characters are ASCII.
         unsigned ored = 0;
@@ -472,7 +472,7 @@ Ref<StringImpl> StringImpl::convertToUppercaseWithoutLocale()
 #endif
         }
         if (!(ored & ~0x7F))
-            return newImpl.releaseNonNull();
+            return newImpl;
 
         // Do a slower implementation for cases that include non-ASCII Latin-1 characters.
         int numberSharpSCharacters = 0;
@@ -494,7 +494,7 @@ Ref<StringImpl> StringImpl::convertToUppercaseWithoutLocale()
         }
 
         if (!numberSharpSCharacters)
-            return newImpl.releaseNonNull();
+            return newImpl;
 
         // We have numberSSCharacters sharp-s characters, but none of the other special characters.
         newImpl = createUninitialized(m_length + numberSharpSCharacters, data8);
@@ -512,7 +512,7 @@ Ref<StringImpl> StringImpl::convertToUppercaseWithoutLocale()
             }
         }
 
-        return newImpl.releaseNonNull();
+        return newImpl;
     }
 
 upconvert:
@@ -520,7 +520,7 @@ upconvert:
     const UChar* source16 = upconvertedCharacters;
 
     UChar* data16;
-    RefPtr<StringImpl> newImpl = createUninitialized(m_length, data16);
+    auto newImpl = createUninitialized(m_length, data16);
     
     // Do a faster loop for the case where all the characters are ASCII.
     unsigned ored = 0;
@@ -530,19 +530,19 @@ upconvert:
         data16[i] = toASCIIUpper(c);
     }
     if (!(ored & ~0x7F))
-        return newImpl.releaseNonNull();
+        return newImpl;
 
     // Do a slower implementation for cases that include non-ASCII characters.
     UErrorCode status = U_ZERO_ERROR;
     int32_t realLength = u_strToUpper(data16, length, source16, m_length, "", &status);
     if (U_SUCCESS(status) && realLength == length)
-        return newImpl.releaseNonNull();
+        return newImpl;
     newImpl = createUninitialized(realLength, data16);
     status = U_ZERO_ERROR;
     u_strToUpper(data16, realLength, source16, m_length, "", &status);
     if (U_FAILURE(status))
         return *this;
-    return newImpl.releaseNonNull();
+    return newImpl;
 }
 
 static inline bool needsTurkishCasingRules(const AtomicString& localeIdentifier)
@@ -578,17 +578,17 @@ Ref<StringImpl> StringImpl::convertToLowercaseWithLocale(const AtomicString& loc
     auto upconvertedCharacters = StringView(*this).upconvertedCharacters();
     const UChar* source16 = upconvertedCharacters;
     UChar* data16;
-    RefPtr<StringImpl> newString = createUninitialized(length, data16);
+    auto newString = createUninitialized(length, data16);
     UErrorCode status = U_ZERO_ERROR;
     int realLength = u_strToLower(data16, length, source16, length, "tr", &status);
     if (U_SUCCESS(status) && realLength == length)
-        return newString.releaseNonNull();
+        return newString;
     newString = createUninitialized(realLength, data16);
     status = U_ZERO_ERROR;
     u_strToLower(data16, realLength, source16, length, "tr", &status);
     if (U_FAILURE(status))
         return *this;
-    return newString.releaseNonNull();
+    return newString;
 }
 
 Ref<StringImpl> StringImpl::convertToUppercaseWithLocale(const AtomicString& localeIdentifier)
@@ -609,17 +609,17 @@ Ref<StringImpl> StringImpl::convertToUppercaseWithLocale(const AtomicString& loc
     auto upconvertedCharacters = StringView(*this).upconvertedCharacters();
     const UChar* source16 = upconvertedCharacters;
     UChar* data16;
-    RefPtr<StringImpl> newString = createUninitialized(length, data16);
+    auto newString = createUninitialized(length, data16);
     UErrorCode status = U_ZERO_ERROR;
     int realLength = u_strToUpper(data16, length, source16, length, "tr", &status);
     if (U_SUCCESS(status) && realLength == length)
-        return newString.releaseNonNull();
+        return newString;
     newString = createUninitialized(realLength, data16);
     status = U_ZERO_ERROR;
     u_strToUpper(data16, realLength, source16, length, "tr", &status);
     if (U_FAILURE(status))
         return *this;
-    return newString.releaseNonNull();
+    return newString;
 }
 
 Ref<StringImpl> StringImpl::foldCase()
@@ -721,7 +721,7 @@ ALWAYS_INLINE Ref<StringImpl> StringImpl::convertASCIICase(StringImpl& impl, con
 
 SlowPath:
     CharacterType* newData;
-    Ref<StringImpl> newImpl = createUninitializedInternalNonEmpty(length, newData);
+    auto newImpl = createUninitializedInternalNonEmpty(length, newData);
     for (unsigned i = 0; i < failingIndex; ++i)
         newData[i] = data[i];
     for (unsigned i = failingIndex; i < length; ++i)
index 4a69ddc..53484fe 100644 (file)
@@ -265,7 +265,7 @@ private:
     }
 
     // Used to create new strings that are a substring of an existing 8-bit StringImpl (BufferSubstring)
-    StringImpl(const LChar* characters, unsigned length, PassRefPtr<StringImpl> base)
+    StringImpl(const LChar* characters, unsigned length, Ref<StringImpl>&& base)
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data8(characters)
@@ -276,13 +276,13 @@ private:
         ASSERT(m_length);
         ASSERT(base->bufferOwnership() != BufferSubstring);
 
-        substringBuffer() = base.leakRef();
+        substringBuffer() = &base.leakRef();
 
         STRING_STATS_ADD_8BIT_STRING2(m_length, true);
     }
 
     // Used to create new strings that are a substring of an existing 16-bit StringImpl (BufferSubstring)
-    StringImpl(const UChar* characters, unsigned length, PassRefPtr<StringImpl> base)
+    StringImpl(const UChar* characters, unsigned length, Ref<StringImpl>&& base)
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data16(characters)
@@ -293,14 +293,14 @@ private:
         ASSERT(m_length);
         ASSERT(base->bufferOwnership() != BufferSubstring);
 
-        substringBuffer() = base.leakRef();
+        substringBuffer() = &base.leakRef();
 
         STRING_STATS_ADD_16BIT_STRING2(m_length, true);
     }
 
     enum CreateSymbolTag { CreateSymbol };
     // Used to create new symbol strings that holds existing 8-bit [[Description]] string as a substring buffer (BufferSubstring).
-    StringImpl(CreateSymbolTag, const LChar* characters, unsigned length, PassRefPtr<StringImpl> base)
+    StringImpl(CreateSymbolTag, const LChar* characters, unsigned length, Ref<StringImpl>&& base)
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data8(characters)
@@ -310,7 +310,7 @@ private:
         ASSERT(m_data8);
         ASSERT(base->bufferOwnership() != BufferSubstring);
 
-        substringBuffer() = base.leakRef();
+        substringBuffer() = &base.leakRef();
         symbolRegistry() = nullptr;
         hashForSymbol() = nextHashForSymbol();
 
@@ -318,7 +318,7 @@ private:
     }
 
     // Used to create new symbol strings that holds existing 16-bit [[Description]] string as a substring buffer (BufferSubstring).
-    StringImpl(CreateSymbolTag, const UChar* characters, unsigned length, PassRefPtr<StringImpl> base)
+    StringImpl(CreateSymbolTag, const UChar* characters, unsigned length, Ref<StringImpl>&& base)
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data16(characters)
@@ -328,7 +328,7 @@ private:
         ASSERT(m_data16);
         ASSERT(base->bufferOwnership() != BufferSubstring);
 
-        substringBuffer() = base.leakRef();
+        substringBuffer() = &base.leakRef();
         symbolRegistry() = nullptr;
         hashForSymbol() = nextHashForSymbol();
 
@@ -352,21 +352,20 @@ public:
     WTF_EXPORT_STRING_API static Ref<StringImpl> create(const LChar*);
     ALWAYS_INLINE static Ref<StringImpl> create(const char* s) { return create(reinterpret_cast<const LChar*>(s)); }
 
-    static ALWAYS_INLINE Ref<StringImpl> createSubstringSharingImpl(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
+    static ALWAYS_INLINE Ref<StringImpl> createSubstringSharingImpl(StringImpl& rep, unsigned offset, unsigned length)
     {
-        ASSERT(rep);
-        ASSERT(length <= rep->length());
+        ASSERT(length <= rep.length());
 
         if (!length)
             return *empty();
 
-        StringImpl* ownerRep = (rep->bufferOwnership() == BufferSubstring) ? rep->substringBuffer() : rep.get();
+        auto* ownerRep = ((rep.bufferOwnership() == BufferSubstring) ? rep.substringBuffer() : &rep);
 
         // We allocate a buffer that contains both the StringImpl struct as well as the pointer to the owner string.
-        StringImpl* stringImpl = static_cast<StringImpl*>(fastMalloc(allocationSize<StringImpl*>(1)));
-        if (rep->is8Bit())
-            return adoptRef(*new (NotNull, stringImpl) StringImpl(rep->m_data8 + offset, length, ownerRep));
-        return adoptRef(*new (NotNull, stringImpl) StringImpl(rep->m_data16 + offset, length, ownerRep));
+        auto* stringImpl = static_cast<StringImpl*>(fastMalloc(allocationSize<StringImpl*>(1)));
+        if (rep.is8Bit())
+            return adoptRef(*new (NotNull, stringImpl) StringImpl(rep.m_data8 + offset, length, *ownerRep));
+        return adoptRef(*new (NotNull, stringImpl) StringImpl(rep.m_data16 + offset, length, *ownerRep));
     }
 
     template<unsigned charactersCount>
@@ -387,21 +386,21 @@ public:
 
     WTF_EXPORT_STRING_API static Ref<StringImpl> createUninitialized(unsigned length, LChar*& data);
     WTF_EXPORT_STRING_API static Ref<StringImpl> createUninitialized(unsigned length, UChar*& data);
-    template <typename T> static ALWAYS_INLINE PassRefPtr<StringImpl> tryCreateUninitialized(unsigned length, T*& output)
+    template <typename T> static ALWAYS_INLINE RefPtr<StringImpl> tryCreateUninitialized(unsigned length, T*& output)
     {
         if (!length) {
-            output = 0;
+            output = nullptr;
             return empty();
         }
 
         if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(T))) {
-            output = 0;
-            return 0;
+            output = nullptr;
+            return nullptr;
         }
         StringImpl* resultImpl;
         if (!tryFastMalloc(allocationSize<T>(length)).getValue(resultImpl)) {
-            output = 0;
-            return 0;
+            output = nullptr;
+            return nullptr;
         }
         output = resultImpl->tailPointer<T>();
 
@@ -409,13 +408,13 @@ public:
     }
 
     WTF_EXPORT_STRING_API static Ref<SymbolImpl> createNullSymbol();
-    WTF_EXPORT_STRING_API static Ref<SymbolImpl> createSymbol(PassRefPtr<StringImpl> rep);
+    WTF_EXPORT_STRING_API static Ref<SymbolImpl> createSymbol(StringImpl& rep);
 
-    // Reallocate the StringImpl. The originalString must be only owned by the PassRefPtr,
+    // Reallocate the StringImpl. The originalString must be only owned by the Ref,
     // and the buffer ownership must be BufferInternal. Just like the input pointer of realloc(),
     // the originalString can't be used after this function.
-    static Ref<StringImpl> reallocate(PassRefPtr<StringImpl> originalString, unsigned length, LChar*& data);
-    static Ref<StringImpl> reallocate(PassRefPtr<StringImpl> originalString, unsigned length, UChar*& data);
+    static Ref<StringImpl> reallocate(Ref<StringImpl>&& originalString, unsigned length, LChar*& data);
+    static Ref<StringImpl> reallocate(Ref<StringImpl>&& originalString, unsigned length, UChar*& data);
 
     static unsigned flagsOffset() { return OBJECT_OFFSETOF(StringImpl, m_hashAndFlags); }
     static unsigned flagIs8Bit() { return s_hashFlag8BitBuffer; }
@@ -765,7 +764,7 @@ public:
         ASSERT(bufferOwnership() == BufferSubstring);
         ASSERT(substringBuffer());
         ASSERT(!substringBuffer()->isSymbol());
-        return createSubstringSharingImpl(this, 0, length());
+        return createSubstringSharingImpl(*this, 0, length());
     }
 
     SymbolRegistry* const& symbolRegistry() const
@@ -860,7 +859,7 @@ private:
     template <typename CharType> static Ref<StringImpl> constructInternal(StringImpl*, unsigned);
     template <typename CharType> static Ref<StringImpl> createUninitializedInternal(unsigned, CharType*&);
     template <typename CharType> static Ref<StringImpl> createUninitializedInternalNonEmpty(unsigned, CharType*&);
-    template <typename CharType> static Ref<StringImpl> reallocateInternal(PassRefPtr<StringImpl>, unsigned, CharType*&);
+    template <typename CharType> static Ref<StringImpl> reallocateInternal(Ref<StringImpl>&&, unsigned, CharType*&);
     template <typename CharType> static Ref<StringImpl> createInternal(const CharType*, unsigned);
     WTF_EXPORT_PRIVATE NEVER_INLINE unsigned hashSlowCase() const;
     WTF_EXPORT_PRIVATE static unsigned nextHashForSymbol();
index aad135f..64ea1ca 100644 (file)
@@ -40,7 +40,7 @@ Ref<SymbolImpl> SymbolRegistry::symbolForKey(const String& rep)
     if (!addResult.isNewEntry)
         return *static_cast<SymbolImpl*>(addResult.iterator->impl());
 
-    Ref<SymbolImpl> symbol = StringImpl::createSymbol(rep.impl());
+    auto symbol = StringImpl::createSymbol(*rep.impl());
     symbol->symbolRegistry() = this;
     *addResult.iterator = SymbolRegistryKey(&symbol.get());
     return symbol;
index f31aac7..fb60400 100644 (file)
@@ -332,7 +332,7 @@ String String::substringSharingImpl(unsigned offset, unsigned length) const
 
     if (!offset && length == stringLength)
         return *this;
-    return String(StringImpl::createSubstringSharingImpl(m_impl, offset, length));
+    return String(StringImpl::createSubstringSharingImpl(*m_impl, offset, length));
 }
 
 String String::convertToASCIILowercase() const
index f71f2c0..e839bdb 100644 (file)
@@ -107,7 +107,6 @@ public:
     // Construct a string referencing an existing StringImpl.
     String(StringImpl&);
     String(StringImpl*);
-    String(PassRefPtr<StringImpl>);
     String(Ref<StringImpl>&&);
     String(RefPtr<StringImpl>&&);
 
@@ -531,11 +530,6 @@ inline String::String(StringImpl* impl)
 {
 }
 
-inline String::String(PassRefPtr<StringImpl> impl)
-    : m_impl(impl)
-{
-}
-
 inline String::String(Ref<StringImpl>&& impl)
     : m_impl(WTFMove(impl))
 {
index 7bad9a7..53f4983 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <wtf/MainThread.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/Threading.h>
 
index 05f9209..c754724 100644 (file)
@@ -1,3 +1,22 @@
+2016-06-07  Keith Rollin  <krollin@apple.com>
+
+        Remove all uses of PassRefPtr in WTF
+        https://bugs.webkit.org/show_bug.cgi?id=157596
+        <rdar://problem/26234391>
+
+        Reviewed by Chris Dumez.
+
+        Update calls to interfaces that no longer take or return PassRefPtrs.
+
+        No new tests: no new functionality so changes are covered by existing
+        tests.
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::formatNumberValue):
+        * dom/Document.cpp:
+        (WebCore::Document::displayStringModifiedByEncoding):
+        * xml/XPathGrammar.y:
+
 2016-06-07  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Text-decoration-style: dashed / dotted rendered as solid
index 682800f..d345187 100644 (file)
@@ -1044,7 +1044,7 @@ NEVER_INLINE Ref<StringImpl> CSSPrimitiveValue::formatNumberValue(const char* su
 
     unsigned bufferLength = decimal.bufferLengthForStringDecimal() + suffixLength;
     LChar* buffer;
-    Ref<StringImpl> string = StringImpl::createUninitialized(bufferLength, buffer);
+    auto string = StringImpl::createUninitialized(bufferLength, buffer);
 
     unsigned length = decimal.toStringDecimal(buffer, bufferLength);
 
index 4ee54a7..cd496cc 100644 (file)
@@ -5510,7 +5510,7 @@ void Document::windowScreenDidChange(PlatformDisplayID displayID)
 String Document::displayStringModifiedByEncoding(const String& str) const
 {
     if (m_decoder)
-        return m_decoder->encoding().displayString(str.impl());
+        return m_decoder->encoding().displayString(str.impl()).get();
     return str;
 }
 
index 2d711ac..7c09197 100644 (file)
@@ -1836,7 +1836,7 @@ WebGLGetInfo WebGL2RenderingContext::getParameter(GC3Denum pname, ExceptionCode&
     case GraphicsContext3D::COLOR_WRITEMASK:
         return getBooleanArrayParameter(pname);
     case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS:
-        return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size()).release());
+        return WebGLGetInfo(PassRefPtr<Uint32Array>(Uint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size())));
     case GraphicsContext3D::CULL_FACE:
         return getBooleanParameter(pname);
     case GraphicsContext3D::CULL_FACE_MODE:
index e956713..2a5aab1 100644 (file)
@@ -955,7 +955,7 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode&
     case GraphicsContext3D::COLOR_WRITEMASK:
         return getBooleanArrayParameter(pname);
     case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS:
-        return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size()).release());
+        return WebGLGetInfo(PassRefPtr<Uint32Array>(Uint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size())));
     case GraphicsContext3D::CULL_FACE:
         return getBooleanParameter(pname);
     case GraphicsContext3D::CULL_FACE_MODE:
index b0010b6..48f7f97 100644 (file)
@@ -2510,7 +2510,7 @@ WebGLGetInfo WebGLRenderingContextBase::getUniform(WebGLProgram* program, const
             m_context->getUniformfv(objectOrZero(program), location, value);
         if (length == 1)
             return WebGLGetInfo(value[0]);
-        return WebGLGetInfo(Float32Array::create(value, length).release());
+        return WebGLGetInfo(PassRefPtr<Float32Array>(Float32Array::create(value, length)));
     }
     case GraphicsContext3D::INT: {
         GC3Dint value[4] = {0};
@@ -2520,7 +2520,7 @@ WebGLGetInfo WebGLRenderingContextBase::getUniform(WebGLProgram* program, const
             m_context->getUniformiv(objectOrZero(program), location, value);
         if (length == 1)
             return WebGLGetInfo(value[0]);
-        return WebGLGetInfo(Int32Array::create(value, length).release());
+        return WebGLGetInfo(PassRefPtr<Int32Array>(Int32Array::create(value, length)));
     }
     case GraphicsContext3D::BOOL: {
         GC3Dint value[4] = {0};
@@ -2616,7 +2616,7 @@ WebGLGetInfo WebGLRenderingContextBase::getVertexAttrib(GC3Duint index, GC3Denum
     case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_TYPE:
         return WebGLGetInfo(state.type);
     case GraphicsContext3D::CURRENT_VERTEX_ATTRIB:
-        return WebGLGetInfo(Float32Array::create(m_vertexAttribValue[index].value, 4).release());
+        return WebGLGetInfo(PassRefPtr<Float32Array>(Float32Array::create(m_vertexAttribValue[index].value, 4)));
     default:
         synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getVertexAttrib", "invalid parameter name");
         return WebGLGetInfo();
@@ -3964,7 +3964,7 @@ WebGLGetInfo WebGLRenderingContextBase::getWebGLFloatArrayParameter(GC3Denum pna
     default:
         notImplemented();
     }
-    return WebGLGetInfo(Float32Array::create(value, length).release());
+    return WebGLGetInfo(PassRefPtr<Float32Array>(Float32Array::create(value, length)));
 }
 
 WebGLGetInfo WebGLRenderingContextBase::getWebGLIntArrayParameter(GC3Denum pname)
@@ -3983,7 +3983,7 @@ WebGLGetInfo WebGLRenderingContextBase::getWebGLIntArrayParameter(GC3Denum pname
     default:
         notImplemented();
     }
-    return WebGLGetInfo(Int32Array::create(value, length).release());
+    return WebGLGetInfo(PassRefPtr<Int32Array>(Int32Array::create(value, length)));
 }
 
 bool WebGLRenderingContextBase::checkTextureCompleteness(const char* functionName, bool prepareToDraw)
index 4a571d4..f5e6616 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
index 2ce083d..c08a3da 100644 (file)
@@ -141,7 +141,7 @@ void handleMessageDelayed(Connection& connection, MessageDecoder& decoder, std::
     }
 
     RefPtr<typename T::DelayedReply> delayedReply = adoptRef(new typename T::DelayedReply(&connection, WTFMove(replyEncoder)));
-    callMemberFunction(WTFMove(arguments), delayedReply.release(), object, function);
+    callMemberFunction(WTFMove(arguments), PassRefPtr<typename T::DelayedReply>(WTFMove(delayedReply)), object, function);
 }
 
 } // namespace IPC
index 618166a..1a510a8 100644 (file)
@@ -1,3 +1,17 @@
+2016-06-07  Keith Rollin  <krollin@apple.com>
+
+        Remove all uses of PassRefPtr in WTF
+        https://bugs.webkit.org/show_bug.cgi?id=157596
+        <rdar://problem/26234391>
+
+        Reviewed by Chris Dumez.
+
+        Update calls to interfaces that no longer take or return PassRefPtrs.
+
+        * TestWebKitAPI/Tests/WTF/StringImpl.cpp:
+        (TestWebKitAPI::stringFromUTF8):
+        (TestWebKitAPI::TEST):
+
 2016-06-07  Per Arne Vollan  <pvollan@apple.com>
 
         [Win] Imported markup insertion test is failing.
index 8cd6c09..9849dec 100644 (file)
@@ -33,14 +33,14 @@ namespace TestWebKitAPI {
 TEST(WTF, StringImplCreationFromLiteral)
 {
     // Constructor using the template to determine the size.
-    RefPtr<StringImpl> stringWithTemplate = StringImpl::createFromLiteral("Template Literal");
+    auto stringWithTemplate = StringImpl::createFromLiteral("Template Literal");
     ASSERT_EQ(strlen("Template Literal"), stringWithTemplate->length());
     ASSERT_TRUE(equal(stringWithTemplate.get(), "Template Literal"));
     ASSERT_TRUE(stringWithTemplate->is8Bit());
 
     // Constructor taking the size explicitely.
     const char* programmaticStringData = "Explicit Size Literal";
-    RefPtr<StringImpl> programmaticString = StringImpl::createFromLiteral(programmaticStringData, strlen(programmaticStringData));
+    auto programmaticString = StringImpl::createFromLiteral(programmaticStringData, strlen(programmaticStringData));
     ASSERT_EQ(strlen(programmaticStringData), programmaticString->length());
     ASSERT_TRUE(equal(programmaticString.get(), programmaticStringData));
     ASSERT_EQ(programmaticStringData, reinterpret_cast<const char*>(programmaticString->characters8()));
@@ -48,7 +48,7 @@ TEST(WTF, StringImplCreationFromLiteral)
 
     // Constructor without explicit size.
     const char* stringWithoutLengthLiteral = "No Size Literal";
-    RefPtr<StringImpl> programmaticStringNoLength = StringImpl::createFromLiteral(stringWithoutLengthLiteral);
+    auto programmaticStringNoLength = StringImpl::createFromLiteral(stringWithoutLengthLiteral);
     ASSERT_EQ(strlen(stringWithoutLengthLiteral), programmaticStringNoLength->length());
     ASSERT_TRUE(equal(programmaticStringNoLength.get(), stringWithoutLengthLiteral));
     ASSERT_EQ(stringWithoutLengthLiteral, reinterpret_cast<const char*>(programmaticStringNoLength->characters8()));
@@ -57,7 +57,7 @@ TEST(WTF, StringImplCreationFromLiteral)
 
 TEST(WTF, StringImplReplaceWithLiteral)
 {
-    RefPtr<StringImpl> testStringImpl = StringImpl::createFromLiteral("1224");
+    auto testStringImpl = StringImpl::createFromLiteral("1224");
     ASSERT_TRUE(testStringImpl->is8Bit());
 
     // Cases for 8Bit source.
@@ -101,225 +101,225 @@ TEST(WTF, StringImplReplaceWithLiteral)
 
 TEST(WTF, StringImplEqualIgnoringASCIICaseBasic)
 {
-    RefPtr<StringImpl> a = StringImpl::createFromLiteral("aBcDeFG");
-    RefPtr<StringImpl> b = StringImpl::createFromLiteral("ABCDEFG");
-    RefPtr<StringImpl> c = StringImpl::createFromLiteral("abcdefg");
+    auto a = StringImpl::createFromLiteral("aBcDeFG");
+    auto b = StringImpl::createFromLiteral("ABCDEFG");
+    auto c = StringImpl::createFromLiteral("abcdefg");
     const char d[] = "aBcDeFG";
-    RefPtr<StringImpl> empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
-    RefPtr<StringImpl> shorter = StringImpl::createFromLiteral("abcdef");
-    RefPtr<StringImpl> different = StringImpl::createFromLiteral("abcrefg");
+    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
+    auto shorter = StringImpl::createFromLiteral("abcdef");
+    auto different = StringImpl::createFromLiteral("abcrefg");
 
     // Identity.
-    ASSERT_TRUE(equalIgnoringASCIICase(a.get(), a.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(b.get(), b.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(c.get(), c.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(a.get(), d));
-    ASSERT_TRUE(equalIgnoringASCIICase(b.get(), d));
-    ASSERT_TRUE(equalIgnoringASCIICase(c.get(), d));
+    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), a.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(b.ptr(), b.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(c.ptr(), c.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), d));
+    ASSERT_TRUE(equalIgnoringASCIICase(b.ptr(), d));
+    ASSERT_TRUE(equalIgnoringASCIICase(c.ptr(), d));
 
     // Transitivity.
-    ASSERT_TRUE(equalIgnoringASCIICase(a.get(), b.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(b.get(), c.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(a.get(), c.get()));
+    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), b.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(b.ptr(), c.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), c.ptr()));
 
     // Negative cases.
-    ASSERT_FALSE(equalIgnoringASCIICase(a.get(), empty.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(b.get(), empty.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(c.get(), empty.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(a.get(), shorter.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(b.get(), shorter.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(c.get(), shorter.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(a.get(), different.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(b.get(), different.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(c.get(), different.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(empty.get(), d));
-    ASSERT_FALSE(equalIgnoringASCIICase(shorter.get(), d));
-    ASSERT_FALSE(equalIgnoringASCIICase(different.get(), d));
+    ASSERT_FALSE(equalIgnoringASCIICase(a.ptr(), empty.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(b.ptr(), empty.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(c.ptr(), empty.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(a.ptr(), shorter.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(b.ptr(), shorter.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(c.ptr(), shorter.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(a.ptr(), different.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(b.ptr(), different.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(c.ptr(), different.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(empty.ptr(), d));
+    ASSERT_FALSE(equalIgnoringASCIICase(shorter.ptr(), d));
+    ASSERT_FALSE(equalIgnoringASCIICase(different.ptr(), d));
 }
 
 TEST(WTF, StringImplEqualIgnoringASCIICaseWithNull)
 {
-    RefPtr<StringImpl> reference = StringImpl::createFromLiteral("aBcDeFG");
+    auto reference = StringImpl::createFromLiteral("aBcDeFG");
     StringImpl* nullStringImpl = nullptr;
-    ASSERT_FALSE(equalIgnoringASCIICase(nullStringImpl, reference.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(reference.get(), nullStringImpl));
+    ASSERT_FALSE(equalIgnoringASCIICase(nullStringImpl, reference.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(reference.ptr(), nullStringImpl));
     ASSERT_TRUE(equalIgnoringASCIICase(nullStringImpl, nullStringImpl));
 }
 
 TEST(WTF, StringImplEqualIgnoringASCIICaseWithEmpty)
 {
-    RefPtr<StringImpl> a = StringImpl::create(reinterpret_cast<const LChar*>(""));
-    RefPtr<StringImpl> b = StringImpl::create(reinterpret_cast<const LChar*>(""));
-    ASSERT_TRUE(equalIgnoringASCIICase(a.get(), b.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(b.get(), a.get()));
+    auto a = StringImpl::create(reinterpret_cast<const LChar*>(""));
+    auto b = StringImpl::create(reinterpret_cast<const LChar*>(""));
+    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), b.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(b.ptr(), a.ptr()));
 }
 
-static RefPtr<StringImpl> stringFromUTF8(const char* characters)
+static Ref<StringImpl> stringFromUTF8(const char* characters)
 {
-    return String::fromUTF8(characters).impl();
+    return String::fromUTF8(characters).releaseImpl().releaseNonNull();
 }
 
 TEST(WTF, StringImplEqualIgnoringASCIICaseWithLatin1Characters)
 {
-    RefPtr<StringImpl> a = stringFromUTF8("aBcéeFG");
-    RefPtr<StringImpl> b = stringFromUTF8("ABCÉEFG");
-    RefPtr<StringImpl> c = stringFromUTF8("ABCéEFG");
-    RefPtr<StringImpl> d = stringFromUTF8("abcéefg");
+    auto a = stringFromUTF8("aBcéeFG");
+    auto b = stringFromUTF8("ABCÉEFG");
+    auto c = stringFromUTF8("ABCéEFG");
+    auto d = stringFromUTF8("abcéefg");
     const char e[] = "aBcéeFG";
 
     // Identity.
-    ASSERT_TRUE(equalIgnoringASCIICase(a.get(), a.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(b.get(), b.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(c.get(), c.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(d.get(), d.get()));
+    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), a.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(b.ptr(), b.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(c.ptr(), c.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(d.ptr(), d.ptr()));
 
     // All combination.
-    ASSERT_FALSE(equalIgnoringASCIICase(a.get(), b.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(a.get(), c.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(a.get(), d.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(b.get(), c.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(b.get(), d.get()));
-    ASSERT_TRUE(equalIgnoringASCIICase(c.get(), d.get()));
-    ASSERT_FALSE(equalIgnoringASCIICase(a.get(), e));
-    ASSERT_FALSE(equalIgnoringASCIICase(b.get(), e));
-    ASSERT_FALSE(equalIgnoringASCIICase(c.get(), e));
-    ASSERT_FALSE(equalIgnoringASCIICase(d.get(), e));
+    ASSERT_FALSE(equalIgnoringASCIICase(a.ptr(), b.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), c.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), d.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(b.ptr(), c.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(b.ptr(), d.ptr()));
+    ASSERT_TRUE(equalIgnoringASCIICase(c.ptr(), d.ptr()));
+    ASSERT_FALSE(equalIgnoringASCIICase(a.ptr(), e));
+    ASSERT_FALSE(equalIgnoringASCIICase(b.ptr(), e));
+    ASSERT_FALSE(equalIgnoringASCIICase(c.ptr(), e));
+    ASSERT_FALSE(equalIgnoringASCIICase(d.ptr(), e));
 }
 
 TEST(WTF, StringImplFindIgnoringASCIICaseBasic)
 {
-    RefPtr<StringImpl> referenceA = stringFromUTF8("aBcéeFG");
-    RefPtr<StringImpl> referenceB = stringFromUTF8("ABCÉEFG");
+    auto referenceA = stringFromUTF8("aBcéeFG");
+    auto referenceB = stringFromUTF8("ABCÉEFG");
 
     // Search the exact string.
-    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(referenceA.get()));
-    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(referenceB.get()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(referenceA.ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(referenceB.ptr()));
 
     // A and B are distinct by the non-ascii character é/É.
-    EXPECT_EQ(static_cast<size_t>(notFound), referenceA->findIgnoringASCIICase(referenceB.get()));
-    EXPECT_EQ(static_cast<size_t>(notFound), referenceB->findIgnoringASCIICase(referenceA.get()));
+    EXPECT_EQ(static_cast<size_t>(notFound), referenceA->findIgnoringASCIICase(referenceB.ptr()));
+    EXPECT_EQ(static_cast<size_t>(notFound), referenceB->findIgnoringASCIICase(referenceA.ptr()));
 
     // Find the prefix.
-    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("a").get()));
-    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(stringFromUTF8("abcé").get()));
-    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("A").get()));
-    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(stringFromUTF8("ABCé").get()));
-    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("a").get()));
-    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(stringFromUTF8("abcÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("A").get()));
-    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(stringFromUTF8("ABCÉ").get()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("a").ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(stringFromUTF8("abcé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("A").ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceA->findIgnoringASCIICase(stringFromUTF8("ABCé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("a").ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(stringFromUTF8("abcÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("A").ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), referenceB->findIgnoringASCIICase(stringFromUTF8("ABCÉ").ptr()));
 
     // Not a prefix.
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("x").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("accé").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("abcÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("X").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("ABDé").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("ABCÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("y").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("accÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("abcé").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("Y").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("ABdÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("ABCé").get()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("x").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("accé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("abcÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("X").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("ABDé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("ABCÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("y").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("accÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("abcé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("Y").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("ABdÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("ABCé").ptr()));
 
     // Find the infix.
-    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("cée").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("ée").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("cé").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("c").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("é").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("Cée").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("éE").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("Cé").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("C").get()));
-
-    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("cÉe").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("Ée").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("cÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("c").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("É").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("CÉe").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("ÉE").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("CÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("C").get()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("cée").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("ée").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("cé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("c").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("é").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("Cée").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("éE").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("Cé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceA->findIgnoringASCIICase(stringFromUTF8("C").ptr()));
+
+    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("cÉe").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("Ée").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("cÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("c").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("É").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("CÉe").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("ÉE").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("CÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(2), referenceB->findIgnoringASCIICase(stringFromUTF8("C").ptr()));
 
     // Not an infix.
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("céd").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("Ée").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("bé").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("x").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("É").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("CÉe").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("éd").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("CÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("Y").get()));
-
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("cée").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("Éc").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("cé").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("W").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("é").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("bÉe").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("éE").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("BÉ").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("z").get()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("céd").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("Ée").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("bé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("x").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("É").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("CÉe").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("éd").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("CÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("Y").ptr()));
+
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("cée").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("Éc").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("cé").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("W").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("é").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("bÉe").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("éE").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("BÉ").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("z").ptr()));
 
     // Find the suffix.
-    EXPECT_EQ(static_cast<size_t>(6), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("g").get()));
-    EXPECT_EQ(static_cast<size_t>(4), referenceA->findIgnoringASCIICase(stringFromUTF8("efg").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("éefg").get()));
-    EXPECT_EQ(static_cast<size_t>(6), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("G").get()));
-    EXPECT_EQ(static_cast<size_t>(4), referenceA->findIgnoringASCIICase(stringFromUTF8("EFG").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("éEFG").get()));
-
-    EXPECT_EQ(static_cast<size_t>(6), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("g").get()));
-    EXPECT_EQ(static_cast<size_t>(4), referenceB->findIgnoringASCIICase(stringFromUTF8("efg").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("Éefg").get()));
-    EXPECT_EQ(static_cast<size_t>(6), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("G").get()));
-    EXPECT_EQ(static_cast<size_t>(4), referenceB->findIgnoringASCIICase(stringFromUTF8("EFG").get()));
-    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("ÉEFG").get()));
+    EXPECT_EQ(static_cast<size_t>(6), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("g").ptr()));
+    EXPECT_EQ(static_cast<size_t>(4), referenceA->findIgnoringASCIICase(stringFromUTF8("efg").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("éefg").ptr()));
+    EXPECT_EQ(static_cast<size_t>(6), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("G").ptr()));
+    EXPECT_EQ(static_cast<size_t>(4), referenceA->findIgnoringASCIICase(stringFromUTF8("EFG").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceA->findIgnoringASCIICase(stringFromUTF8("éEFG").ptr()));
+
+    EXPECT_EQ(static_cast<size_t>(6), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("g").ptr()));
+    EXPECT_EQ(static_cast<size_t>(4), referenceB->findIgnoringASCIICase(stringFromUTF8("efg").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("Éefg").ptr()));
+    EXPECT_EQ(static_cast<size_t>(6), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("G").ptr()));
+    EXPECT_EQ(static_cast<size_t>(4), referenceB->findIgnoringASCIICase(stringFromUTF8("EFG").ptr()));
+    EXPECT_EQ(static_cast<size_t>(3), referenceB->findIgnoringASCIICase(stringFromUTF8("ÉEFG").ptr()));
 
     // Not a suffix.
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("X").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("edg").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("Éefg").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("w").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("dFG").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("ÉEFG").get()));
-
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("Z").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("ffg").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("éefg").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("r").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("EgG").get()));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("éEFG").get()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("X").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("edg").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("Éefg").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(StringImpl::createFromLiteral("w").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("dFG").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceA->findIgnoringASCIICase(stringFromUTF8("ÉEFG").ptr()));
+
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("Z").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("ffg").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("éefg").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(StringImpl::createFromLiteral("r").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("EgG").ptr()));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), referenceB->findIgnoringASCIICase(stringFromUTF8("éEFG").ptr()));
 }
 
 TEST(WTF, StringImplFindIgnoringASCIICaseWithValidOffset)
 {
-    RefPtr<StringImpl> reference = stringFromUTF8("ABCÉEFGaBcéeFG");
-    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(stringFromUTF8("ABC").get(), 0));
-    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(stringFromUTF8("ABC").get(), 1));
-    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").get(), 0));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").get(), 1));
-    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(stringFromUTF8("ABCé").get(), 0));
-    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(stringFromUTF8("ABCé").get(), 1));
+    auto reference = stringFromUTF8("ABCÉEFGaBcéeFG");
+    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(stringFromUTF8("ABC").ptr(), 0));
+    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(stringFromUTF8("ABC").ptr(), 1));
+    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").ptr(), 0));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").ptr(), 1));
+    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(stringFromUTF8("ABCé").ptr(), 0));
+    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(stringFromUTF8("ABCé").ptr(), 1));
 }
 
 TEST(WTF, StringImplFindIgnoringASCIICaseWithInvalidOffset)
 {
-    RefPtr<StringImpl> reference = stringFromUTF8("ABCÉEFGaBcéeFG");
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABC").get(), 15));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABC").get(), 16));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").get(), 17));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").get(), 42));
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").get(), std::numeric_limits<unsigned>::max()));
+    auto reference = stringFromUTF8("ABCÉEFGaBcéeFG");
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABC").ptr(), 15));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABC").ptr(), 16));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").ptr(), 17));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").ptr(), 42));
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(stringFromUTF8("ABCÉ").ptr(), std::numeric_limits<unsigned>::max()));
 }
 
 TEST(WTF, StringImplFindIgnoringASCIICaseOnNull)
 {
-    RefPtr<StringImpl> reference = stringFromUTF8("ABCÉEFG");
+    auto reference = stringFromUTF8("ABCÉEFG");
     EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(nullptr));
     EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(nullptr, 0));
     EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(nullptr, 3));
@@ -331,97 +331,97 @@ TEST(WTF, StringImplFindIgnoringASCIICaseOnNull)
 
 TEST(WTF, StringImplFindIgnoringASCIICaseOnEmpty)
 {
-    RefPtr<StringImpl> reference = stringFromUTF8("ABCÉEFG");
-    RefPtr<StringImpl> empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
-    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(empty.get()));
-    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(empty.get(), 0));
-    EXPECT_EQ(static_cast<size_t>(3), reference->findIgnoringASCIICase(empty.get(), 3));
-    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(empty.get(), 7));
-    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(empty.get(), 8));
-    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(empty.get(), 42));
-    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(empty.get(), std::numeric_limits<unsigned>::max()));
+    auto reference = stringFromUTF8("ABCÉEFG");
+    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
+    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(empty.ptr()));
+    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(empty.ptr(), 0));
+    EXPECT_EQ(static_cast<size_t>(3), reference->findIgnoringASCIICase(empty.ptr(), 3));
+    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(empty.ptr(), 7));
+    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(empty.ptr(), 8));
+    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(empty.ptr(), 42));
+    EXPECT_EQ(static_cast<size_t>(7), reference->findIgnoringASCIICase(empty.ptr(), std::numeric_limits<unsigned>::max()));
 }
 
 TEST(WTF, StringImplFindIgnoringASCIICaseWithPatternLongerThanReference)
 {
-    RefPtr<StringImpl> reference = stringFromUTF8("ABCÉEFG");
-    RefPtr<StringImpl> pattern = stringFromUTF8("XABCÉEFG");
-    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(pattern.get()));
-    EXPECT_EQ(static_cast<size_t>(1), pattern->findIgnoringASCIICase(reference.get()));
+    auto reference = stringFromUTF8("ABCÉEFG");
+    auto pattern = stringFromUTF8("XABCÉEFG");
+    EXPECT_EQ(static_cast<size_t>(WTF::notFound), reference->findIgnoringASCIICase(pattern.ptr()));
+    EXPECT_EQ(static_cast<size_t>(1), pattern->findIgnoringASCIICase(reference.ptr()));
 }
 
 TEST(WTF, StringImplStartsWithIgnoringASCIICaseBasic)
 {
-    RefPtr<StringImpl> reference = stringFromUTF8("aBcéX");
-    RefPtr<StringImpl> referenceEquivalent = stringFromUTF8("AbCéx");
+    auto reference = stringFromUTF8("aBcéX");
+    auto referenceEquivalent = stringFromUTF8("AbCéx");
 
     // Identity.
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(reference.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*reference.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(referenceEquivalent.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*referenceEquivalent.get()));
-    ASSERT_TRUE(referenceEquivalent->startsWithIgnoringASCIICase(reference.get()));
-    ASSERT_TRUE(referenceEquivalent->startsWithIgnoringASCIICase(*reference.get()));
-    ASSERT_TRUE(referenceEquivalent->startsWithIgnoringASCIICase(referenceEquivalent.get()));
-    ASSERT_TRUE(referenceEquivalent->startsWithIgnoringASCIICase(*referenceEquivalent.get()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(reference.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*reference.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(referenceEquivalent.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*referenceEquivalent.ptr()));
+    ASSERT_TRUE(referenceEquivalent->startsWithIgnoringASCIICase(reference.ptr()));
+    ASSERT_TRUE(referenceEquivalent->startsWithIgnoringASCIICase(*reference.ptr()));
+    ASSERT_TRUE(referenceEquivalent->startsWithIgnoringASCIICase(referenceEquivalent.ptr()));
+    ASSERT_TRUE(referenceEquivalent->startsWithIgnoringASCIICase(*referenceEquivalent.ptr()));
 
     // Proper prefixes.
-    RefPtr<StringImpl> aLower = StringImpl::createFromLiteral("a");
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(aLower.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*aLower.get()));
-    RefPtr<StringImpl> aUpper = StringImpl::createFromLiteral("A");
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(aUpper.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*aUpper.get()));
-
-    RefPtr<StringImpl> abcLower = StringImpl::createFromLiteral("abc");
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(abcLower.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*abcLower.get()));
-    RefPtr<StringImpl> abcUpper = StringImpl::createFromLiteral("ABC");
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(abcUpper.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*abcUpper.get()));
-
-    RefPtr<StringImpl> abcAccentLower = stringFromUTF8("abcé");
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(abcAccentLower.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*abcAccentLower.get()));
-    RefPtr<StringImpl> abcAccentUpper = stringFromUTF8("ABCé");
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(abcAccentUpper.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*abcAccentUpper.get()));
+    auto aLower = StringImpl::createFromLiteral("a");
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(aLower.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*aLower.ptr()));
+    auto aUpper = StringImpl::createFromLiteral("A");
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(aUpper.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*aUpper.ptr()));
+
+    auto abcLower = StringImpl::createFromLiteral("abc");
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(abcLower.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*abcLower.ptr()));
+    auto abcUpper = StringImpl::createFromLiteral("ABC");
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(abcUpper.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*abcUpper.ptr()));
+
+    auto abcAccentLower = stringFromUTF8("abcé");
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(abcAccentLower.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*abcAccentLower.ptr()));
+    auto abcAccentUpper = stringFromUTF8("ABCé");
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(abcAccentUpper.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*abcAccentUpper.ptr()));
 
     // Negative cases.
-    RefPtr<StringImpl> differentFirstChar = stringFromUTF8("bBcéX");
-    RefPtr<StringImpl> differentFirstCharProperPrefix = stringFromUTF8("CBcé");
-    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(differentFirstChar.get()));
-    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(*differentFirstChar.get()));
-    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(differentFirstCharProperPrefix.get()));
-    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(*differentFirstCharProperPrefix.get()));
-
-    RefPtr<StringImpl> uppercaseAccent = stringFromUTF8("aBcÉX");
-    RefPtr<StringImpl> uppercaseAccentProperPrefix = stringFromUTF8("aBcÉX");
-    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(uppercaseAccent.get()));
-    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(*uppercaseAccent.get()));
-    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(uppercaseAccentProperPrefix.get()));
-    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(*uppercaseAccentProperPrefix.get()));
+    auto differentFirstChar = stringFromUTF8("bBcéX");
+    auto differentFirstCharProperPrefix = stringFromUTF8("CBcé");
+    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(differentFirstChar.ptr()));
+    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(*differentFirstChar.ptr()));
+    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(differentFirstCharProperPrefix.ptr()));
+    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(*differentFirstCharProperPrefix.ptr()));
+
+    auto uppercaseAccent = stringFromUTF8("aBcÉX");
+    auto uppercaseAccentProperPrefix = stringFromUTF8("aBcÉX");
+    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(uppercaseAccent.ptr()));
+    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(*uppercaseAccent.ptr()));
+    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(uppercaseAccentProperPrefix.ptr()));
+    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(*uppercaseAccentProperPrefix.ptr()));
 }
 
 TEST(WTF, StringImplStartsWithIgnoringASCIICaseWithNull)
 {
-    RefPtr<StringImpl> reference = StringImpl::createFromLiteral("aBcDeFG");
+    auto reference = StringImpl::createFromLiteral("aBcDeFG");
     ASSERT_FALSE(reference->startsWithIgnoringASCIICase(nullptr));
 
-    RefPtr<StringImpl> empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
+    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     ASSERT_FALSE(empty->startsWithIgnoringASCIICase(nullptr));
 }
 
 TEST(WTF, StringImplStartsWithIgnoringASCIICaseWithEmpty)
 {
-    RefPtr<StringImpl> reference = StringImpl::createFromLiteral("aBcDeFG");
-    RefPtr<StringImpl> empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(empty.get()));
-    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*empty.get()));
-    ASSERT_TRUE(empty->startsWithIgnoringASCIICase(empty.get()));
-    ASSERT_TRUE(empty->startsWithIgnoringASCIICase(*empty.get()));
-    ASSERT_FALSE(empty->startsWithIgnoringASCIICase(reference.get()));
-    ASSERT_FALSE(empty->startsWithIgnoringASCIICase(*reference.get()));
+    auto reference = StringImpl::createFromLiteral("aBcDeFG");
+    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(empty.ptr()));
+    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*empty.ptr()));
+    ASSERT_TRUE(empty->startsWithIgnoringASCIICase(empty.ptr()));
+    ASSERT_TRUE(empty->startsWithIgnoringASCIICase(*empty.ptr()));
+    ASSERT_FALSE(empty->startsWithIgnoringASCIICase(reference.ptr()));
+    ASSERT_FALSE(empty->startsWithIgnoringASCIICase(*reference.ptr()));
 }
 
 TEST(WTF, StartsWithLettersIgnoringASCIICase)
@@ -441,102 +441,102 @@ TEST(WTF, StartsWithLettersIgnoringASCIICase)
 
 TEST(WTF, StringImplEndsWithIgnoringASCIICaseBasic)
 {
-    RefPtr<StringImpl> reference = stringFromUTF8("XÉCbA");
-    RefPtr<StringImpl> referenceEquivalent = stringFromUTF8("xÉcBa");
+    auto reference = stringFromUTF8("XÉCbA");
+    auto referenceEquivalent = stringFromUTF8("xÉcBa");
 
     // Identity.
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(reference.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*reference.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(referenceEquivalent.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*referenceEquivalent.get()));
-    ASSERT_TRUE(referenceEquivalent->endsWithIgnoringASCIICase(reference.get()));
-    ASSERT_TRUE(referenceEquivalent->endsWithIgnoringASCIICase(*reference.get()));
-    ASSERT_TRUE(referenceEquivalent->endsWithIgnoringASCIICase(referenceEquivalent.get()));
-    ASSERT_TRUE(referenceEquivalent->endsWithIgnoringASCIICase(*referenceEquivalent.get()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(reference.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*reference.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(referenceEquivalent.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*referenceEquivalent.ptr()));
+    ASSERT_TRUE(referenceEquivalent->endsWithIgnoringASCIICase(reference.ptr()));
+    ASSERT_TRUE(referenceEquivalent->endsWithIgnoringASCIICase(*reference.ptr()));
+    ASSERT_TRUE(referenceEquivalent->endsWithIgnoringASCIICase(referenceEquivalent.ptr()));
+    ASSERT_TRUE(referenceEquivalent->endsWithIgnoringASCIICase(*referenceEquivalent.ptr()));
 
     // Proper suffixes.
-    RefPtr<StringImpl> aLower = StringImpl::createFromLiteral("a");
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(aLower.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*aLower.get()));
-    RefPtr<StringImpl> aUpper = StringImpl::createFromLiteral("a");
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(aUpper.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*aUpper.get()));
-
-    RefPtr<StringImpl> abcLower = StringImpl::createFromLiteral("cba");
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(abcLower.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*abcLower.get()));
-    RefPtr<StringImpl> abcUpper = StringImpl::createFromLiteral("CBA");
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(abcUpper.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*abcUpper.get()));
-
-    RefPtr<StringImpl> abcAccentLower = stringFromUTF8("Écba");
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(abcAccentLower.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*abcAccentLower.get()));
-    RefPtr<StringImpl> abcAccentUpper = stringFromUTF8("ÉCBA");
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(abcAccentUpper.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*abcAccentUpper.get()));
+    auto aLower = StringImpl::createFromLiteral("a");
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(aLower.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*aLower.ptr()));
+    auto aUpper = StringImpl::createFromLiteral("a");
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(aUpper.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*aUpper.ptr()));
+
+    auto abcLower = StringImpl::createFromLiteral("cba");
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(abcLower.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*abcLower.ptr()));
+    auto abcUpper = StringImpl::createFromLiteral("CBA");
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(abcUpper.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*abcUpper.ptr()));
+
+    auto abcAccentLower = stringFromUTF8("Écba");
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(abcAccentLower.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*abcAccentLower.ptr()));
+    auto abcAccentUpper = stringFromUTF8("ÉCBA");
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(abcAccentUpper.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*abcAccentUpper.ptr()));
 
     // Negative cases.
-    RefPtr<StringImpl> differentLastChar = stringFromUTF8("XÉCbB");
-    RefPtr<StringImpl> differentLastCharProperSuffix = stringFromUTF8("ÉCbb");
-    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(differentLastChar.get()));
-    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(*differentLastChar.get()));
-    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(differentLastCharProperSuffix.get()));
-    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(*differentLastCharProperSuffix.get()));
-
-    RefPtr<StringImpl> lowercaseAccent = stringFromUTF8("aBcéX");
-    RefPtr<StringImpl> loweraseAccentProperSuffix = stringFromUTF8("aBcéX");
-    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(lowercaseAccent.get()));
-    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(*lowercaseAccent.get()));
-    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(loweraseAccentProperSuffix.get()));
-    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(*loweraseAccentProperSuffix.get()));
+    auto differentLastChar = stringFromUTF8("XÉCbB");
+    auto differentLastCharProperSuffix = stringFromUTF8("ÉCbb");
+    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(differentLastChar.ptr()));
+    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(*differentLastChar.ptr()));
+    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(differentLastCharProperSuffix.ptr()));
+    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(*differentLastCharProperSuffix.ptr()));
+
+    auto lowercaseAccent = stringFromUTF8("aBcéX");
+    auto loweraseAccentProperSuffix = stringFromUTF8("aBcéX");
+    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(lowercaseAccent.ptr()));
+    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(*lowercaseAccent.ptr()));
+    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(loweraseAccentProperSuffix.ptr()));
+    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(*loweraseAccentProperSuffix.ptr()));
 }
 
 TEST(WTF, StringImplEndsWithIgnoringASCIICaseWithNull)
 {
-    RefPtr<StringImpl> reference = StringImpl::createFromLiteral("aBcDeFG");
+    auto reference = StringImpl::createFromLiteral("aBcDeFG");
     ASSERT_FALSE(reference->endsWithIgnoringASCIICase(nullptr));
 
-    RefPtr<StringImpl> empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
+    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     ASSERT_FALSE(empty->endsWithIgnoringASCIICase(nullptr));
 }
 
 TEST(WTF, StringImplEndsWithIgnoringASCIICaseWithEmpty)
 {
-    RefPtr<StringImpl> reference = StringImpl::createFromLiteral("aBcDeFG");
-    RefPtr<StringImpl> empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(empty.get()));
-    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*empty.get()));
-    ASSERT_TRUE(empty->endsWithIgnoringASCIICase(empty.get()));
-    ASSERT_TRUE(empty->endsWithIgnoringASCIICase(*empty.get()));
-    ASSERT_FALSE(empty->endsWithIgnoringASCIICase(reference.get()));
-    ASSERT_FALSE(empty->endsWithIgnoringASCIICase(*reference.get()));
+    auto reference = StringImpl::createFromLiteral("aBcDeFG");
+    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(empty.ptr()));
+    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*empty.ptr()));
+    ASSERT_TRUE(empty->endsWithIgnoringASCIICase(empty.ptr()));
+    ASSERT_TRUE(empty->endsWithIgnoringASCIICase(*empty.ptr()));
+    ASSERT_FALSE(empty->endsWithIgnoringASCIICase(reference.ptr()));
+    ASSERT_FALSE(empty->endsWithIgnoringASCIICase(*reference.ptr()));
 }
 
 TEST(WTF, StringImplCreateNullSymbol)
 {
-    RefPtr<StringImpl> reference = StringImpl::createNullSymbol();
+    auto reference = StringImpl::createNullSymbol();
     ASSERT_TRUE(reference->isSymbol());
     ASSERT_TRUE(reference->isNullSymbol());
     ASSERT_FALSE(reference->isAtomic());
     ASSERT_EQ(0u, reference->length());
-    ASSERT_TRUE(equal(reference.get(), ""));
+    ASSERT_TRUE(equal(reference.ptr(), ""));
 }
 
 TEST(WTF, StringImplCreateSymbol)
 {
-    RefPtr<StringImpl> original = stringFromUTF8("original");
-    RefPtr<StringImpl> reference = StringImpl::createSymbol(original);
+    auto original = stringFromUTF8("original");
+    auto reference = StringImpl::createSymbol(original);
     ASSERT_TRUE(reference->isSymbol());
     ASSERT_FALSE(reference->isNullSymbol());
     ASSERT_FALSE(reference->isAtomic());
     ASSERT_FALSE(original->isSymbol());
     ASSERT_FALSE(original->isAtomic());
     ASSERT_EQ(original->length(), reference->length());
-    ASSERT_TRUE(equal(reference.get(), "original"));
+    ASSERT_TRUE(equal(reference.ptr(), "original"));
 
-    RefPtr<StringImpl> empty = stringFromUTF8("");
-    RefPtr<StringImpl> emptyReference = StringImpl::createSymbol(empty);
+    auto empty = stringFromUTF8("");
+    auto emptyReference = StringImpl::createSymbol(empty);
     ASSERT_TRUE(emptyReference->isSymbol());
     ASSERT_FALSE(emptyReference->isNullSymbol());
     ASSERT_FALSE(emptyReference->isAtomic());
@@ -544,17 +544,17 @@ TEST(WTF, StringImplCreateSymbol)
     ASSERT_FALSE(empty->isNullSymbol());
     ASSERT_TRUE(empty->isAtomic());
     ASSERT_EQ(empty->length(), emptyReference->length());
-    ASSERT_TRUE(equal(emptyReference.get(), ""));
+    ASSERT_TRUE(equal(emptyReference.ptr(), ""));
 }
 
 TEST(WTF, StringImplSymbolToAtomicString)
 {
-    RefPtr<StringImpl> original = stringFromUTF8("original");
-    RefPtr<StringImpl> reference = StringImpl::createSymbol(original);
+    auto original = stringFromUTF8("original");
+    auto reference = StringImpl::createSymbol(original);
     ASSERT_TRUE(reference->isSymbol());
     ASSERT_FALSE(reference->isAtomic());
 
-    RefPtr<StringImpl> atomic = AtomicStringImpl::add(reference.get());
+    auto atomic = AtomicStringImpl::add(reference.ptr());
     ASSERT_TRUE(atomic->isAtomic());
     ASSERT_FALSE(atomic->isSymbol());
     ASSERT_TRUE(reference->isSymbol());
@@ -563,11 +563,11 @@ TEST(WTF, StringImplSymbolToAtomicString)
 
 TEST(WTF, StringImplNullSymbolToAtomicString)
 {
-    RefPtr<StringImpl> reference = StringImpl::createNullSymbol();
+    auto reference = StringImpl::createNullSymbol();
     ASSERT_TRUE(reference->isSymbol());
     ASSERT_FALSE(reference->isAtomic());
 
-    RefPtr<StringImpl> atomic = AtomicStringImpl::add(reference.get());
+    auto atomic = AtomicStringImpl::add(reference.ptr());
     ASSERT_TRUE(atomic->isAtomic());
     ASSERT_FALSE(atomic->isSymbol());
     ASSERT_TRUE(reference->isSymbol());