Title: [158213] trunk/Source/WTF
Revision
158213
Author
[email protected]
Date
2013-10-29 13:02:06 -0700 (Tue, 29 Oct 2013)

Log Message

StringImpl::adopt() should return PassRef.
<https://webkit.org/b/123456>

Make the StringImpl::adopt() functions return a PassRef<StringImpl>.

Reviewed by Anders Carlsson.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (158212 => 158213)


--- trunk/Source/WTF/ChangeLog	2013-10-29 19:52:06 UTC (rev 158212)
+++ trunk/Source/WTF/ChangeLog	2013-10-29 20:02:06 UTC (rev 158213)
@@ -1,3 +1,12 @@
+2013-10-29  Andreas Kling  <[email protected]>
+
+        StringImpl::adopt() should return PassRef.
+        <https://webkit.org/b/123456>
+
+        Make the StringImpl::adopt() functions return a PassRef<StringImpl>.
+
+        Reviewed by Anders Carlsson.
+
 2013-10-29  Jinwoo Song  <[email protected]>
 
         Re-enable simple line layout for EFL

Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (158212 => 158213)


--- trunk/Source/WTF/wtf/text/StringImpl.cpp	2013-10-29 19:52:06 UTC (rev 158212)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp	2013-10-29 20:02:06 UTC (rev 158213)
@@ -1989,20 +1989,20 @@
     return U_LEFT_TO_RIGHT;
 }
 
-PassRefPtr<StringImpl> StringImpl::adopt(StringBuffer<LChar>& buffer)
+PassRef<StringImpl> StringImpl::adopt(StringBuffer<LChar>& buffer)
 {
-unsigned length = buffer.length();
-if (!length)
-    return empty();
-return adoptRef(new StringImpl(buffer.release(), length));
+    unsigned length = buffer.length();
+    if (!length)
+        return *empty();
+    return adoptRef(*new StringImpl(buffer.release(), length));
 }
 
-PassRefPtr<StringImpl> StringImpl::adopt(StringBuffer<UChar>& buffer)
+PassRef<StringImpl> StringImpl::adopt(StringBuffer<UChar>& buffer)
 {
     unsigned length = buffer.length();
     if (!length)
-        return empty();
-    return adoptRef(new StringImpl(buffer.release(), length));
+        return *empty();
+    return adoptRef(*new StringImpl(buffer.release(), length));
 }
 
 size_t StringImpl::sizeInBytes() const

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (158212 => 158213)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2013-10-29 19:52:06 UTC (rev 158212)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2013-10-29 20:02:06 UTC (rev 158213)
@@ -435,19 +435,19 @@
     static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data8); }
 
     template<typename CharType, size_t inlineCapacity, typename OverflowHandler>
-    static PassRefPtr<StringImpl> adopt(Vector<CharType, inlineCapacity, OverflowHandler>& vector)
+    static PassRef<StringImpl> adopt(Vector<CharType, inlineCapacity, OverflowHandler>& vector)
     {
         if (size_t size = vector.size()) {
             ASSERT(vector.data());
             if (size > std::numeric_limits<unsigned>::max())
                 CRASH();
-            return adoptRef(new StringImpl(vector.releaseBuffer(), size));
+            return adoptRef(*new StringImpl(vector.releaseBuffer(), size));
         }
-        return empty();
+        return *empty();
     }
 
-    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> adopt(StringBuffer<UChar>&);
-    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> adopt(StringBuffer<LChar>&);
+    WTF_EXPORT_STRING_API static PassRef<StringImpl> adopt(StringBuffer<UChar>&);
+    WTF_EXPORT_STRING_API static PassRef<StringImpl> adopt(StringBuffer<LChar>&);
 
     unsigned length() const { return m_length; }
     bool is8Bit() const { return m_hashAndFlags & s_hashFlag8BitBuffer; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to