Title: [157563] trunk
- Revision
- 157563
- Author
- akl...@apple.com
- Date
- 2013-10-17 00:55:09 -0700 (Thu, 17 Oct 2013)
Log Message
Make it possible to assign a PassRef to a RefPtr.
<https://webkit.org/b/122943>
Source/WTF:
We have to use std::move when constructing a RefPtr from a PassRef
since there is no copy constructor for the latter.
Reviewed by Antti Koivisto.
Tools:
Added a small API test for RefPtr=(PassRef) so we know this code
will compile (and work.)
Reviewed by Antti Koivisto.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (157562 => 157563)
--- trunk/Source/WTF/ChangeLog 2013-10-17 07:46:22 UTC (rev 157562)
+++ trunk/Source/WTF/ChangeLog 2013-10-17 07:55:09 UTC (rev 157563)
@@ -1,3 +1,13 @@
+2013-10-17 Andreas Kling <akl...@apple.com>
+
+ Make it possible to assign a PassRef to a RefPtr.
+ <https://webkit.org/b/122943>
+
+ We have to use std::move when constructing a RefPtr from a PassRef
+ since there is no copy constructor for the latter.
+
+ Reviewed by Antti Koivisto.
+
2013-10-16 Ryuan Choi <ryuan.c...@samsung.com>
Unreviewed build fix attempt on EFL port after r157520 and r157523
Modified: trunk/Source/WTF/wtf/RefPtr.h (157562 => 157563)
--- trunk/Source/WTF/wtf/RefPtr.h 2013-10-17 07:46:22 UTC (rev 157562)
+++ trunk/Source/WTF/wtf/RefPtr.h 2013-10-17 07:55:09 UTC (rev 157563)
@@ -156,7 +156,7 @@
template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(PassRef<U> reference)
{
- RefPtr ptr = reference;
+ RefPtr ptr = std::move(reference);
swap(ptr);
return *this;
}
Modified: trunk/Tools/ChangeLog (157562 => 157563)
--- trunk/Tools/ChangeLog 2013-10-17 07:46:22 UTC (rev 157562)
+++ trunk/Tools/ChangeLog 2013-10-17 07:55:09 UTC (rev 157563)
@@ -1,3 +1,13 @@
+2013-10-17 Andreas Kling <akl...@apple.com>
+
+ Make it possible to assign a PassRef to a RefPtr.
+ <https://webkit.org/b/122943>
+
+ Added a small API test for RefPtr=(PassRef) so we know this code
+ will compile (and work.)
+
+ Reviewed by Antti Koivisto.
+
2013-10-16 Filip Pizlo <fpi...@apple.com>
We need test coverage for just the Baseline JIT
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp (157562 => 157563)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp 2013-10-17 07:46:22 UTC (rev 157562)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/RefPtr.cpp 2013-10-17 07:55:09 UTC (rev 157563)
@@ -116,6 +116,19 @@
ASSERT_STREQ("ref(a) deref(a) ", takeLogStr().c_str());
}
+TEST(WTF_RefPtr, AssignPassRefToRefPtr)
+{
+ DerivedRefLogger a("a");
+ {
+ PassRef<RefLogger> passRef(a);
+ RefPtr<RefLogger> ptr = std::move(passRef);
+ ASSERT_EQ(&a, ptr.get());
+ ptr.release();
+ ASSERT_EQ(nullptr, ptr.get());
+ }
+ ASSERT_STREQ("ref(a) deref(a) ", takeLogStr().c_str());
+}
+
TEST(WTF_RefPtr, Adopt)
{
DerivedRefLogger a("a");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes