Title: [170055] trunk
- Revision
- 170055
- Author
- [email protected]
- Date
- 2014-06-17 09:16:38 -0700 (Tue, 17 Jun 2014)
Log Message
String::isolatedCopy doesn’t return an isolated copy when used on an rvalue reference
https://bugs.webkit.org/show_bug.cgi?id=133968
Reviewed by Anders Carlsson.
Source/WTF:
Made the rvalue reference overload of isolatedCopy() non-const, so that std::move(*this) is
an rvalue reference that can be moved, rather than copied, into the returned String.
* wtf/text/WTFString.cpp:
(WTF::String::isolatedCopy):
* wtf/text/WTFString.h:
Tools:
* TestWebKitAPI/Tests/WTF/WTFString.cpp:
(TestWebKitAPI::TEST): Added a test that an isolated copy of an rvalue reference doesn’t
share an impl() with the original.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (170054 => 170055)
--- trunk/Source/WTF/ChangeLog 2014-06-17 13:29:53 UTC (rev 170054)
+++ trunk/Source/WTF/ChangeLog 2014-06-17 16:16:38 UTC (rev 170055)
@@ -1,3 +1,17 @@
+2014-06-17 Dan Bernstein <[email protected]>
+
+ String::isolatedCopy doesn’t return an isolated copy when used on an rvalue reference
+ https://bugs.webkit.org/show_bug.cgi?id=133968
+
+ Reviewed by Anders Carlsson.
+
+ Made the rvalue reference overload of isolatedCopy() non-const, so that std::move(*this) is
+ an rvalue reference that can be moved, rather than copied, into the returned String.
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::isolatedCopy):
+ * wtf/text/WTFString.h:
+
2014-06-15 Dan Bernstein <[email protected]>
iOS build fix after r169995.
Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (170054 => 170055)
--- trunk/Source/WTF/wtf/text/WTFString.cpp 2014-06-17 13:29:53 UTC (rev 170054)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp 2014-06-17 16:16:38 UTC (rev 170055)
@@ -688,7 +688,7 @@
return m_impl->isolatedCopy();
}
-String String::isolatedCopy() const &&
+String String::isolatedCopy() &&
{
if (isSafeToSendToAnotherThread()) {
// Since we know that our string is a temporary that will be destroyed
Modified: trunk/Source/WTF/wtf/text/WTFString.h (170054 => 170055)
--- trunk/Source/WTF/wtf/text/WTFString.h 2014-06-17 13:29:53 UTC (rev 170054)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2014-06-17 16:16:38 UTC (rev 170055)
@@ -373,7 +373,7 @@
#if COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS)
WTF_EXPORT_STRING_API String isolatedCopy() const &;
- WTF_EXPORT_STRING_API String isolatedCopy() const &&;
+ WTF_EXPORT_STRING_API String isolatedCopy() &&;
#else
WTF_EXPORT_STRING_API String isolatedCopy() const;
#endif
Modified: trunk/Tools/ChangeLog (170054 => 170055)
--- trunk/Tools/ChangeLog 2014-06-17 13:29:53 UTC (rev 170054)
+++ trunk/Tools/ChangeLog 2014-06-17 16:16:38 UTC (rev 170055)
@@ -1,3 +1,14 @@
+2014-06-17 Dan Bernstein <[email protected]>
+
+ String::isolatedCopy doesn’t return an isolated copy when used on an rvalue reference
+ https://bugs.webkit.org/show_bug.cgi?id=133968
+
+ Reviewed by Anders Carlsson.
+
+ * TestWebKitAPI/Tests/WTF/WTFString.cpp:
+ (TestWebKitAPI::TEST): Added a test that an isolated copy of an rvalue reference doesn’t
+ share an impl() with the original.
+
2014-06-17 Gyuyoung Kim <[email protected]>
[EFL][WK2] Skip failing EFL API tests
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp (170054 => 170055)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp 2014-06-17 13:29:53 UTC (rev 170054)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp 2014-06-17 16:16:38 UTC (rev 170055)
@@ -153,5 +153,11 @@
ASSERT_STREQ("résumé", testString.utf8().data());
}
+TEST(WTF, StringIsolatedCopy)
+{
+ String original = "1234";
+ auto copy = std::move(original).isolatedCopy();
+ ASSERT_FALSE(original.impl() == copy.impl());
+}
} // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes