Diff
Modified: trunk/Source/WTF/ChangeLog (216838 => 216839)
--- trunk/Source/WTF/ChangeLog 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/ChangeLog 2017-05-14 07:31:49 UTC (rev 216839)
@@ -1,3 +1,27 @@
+2017-05-14 Chris Dumez <cdu...@apple.com>
+
+ Drop PassRefPtr class from WTF
+ https://bugs.webkit.org/show_bug.cgi?id=172091
+
+ Reviewed by Alex Christensen.
+
+ Drop PassRefPtr class from WTF as it is no longer used or needed.
+ Also drop RefPtr::release() for the same reasons.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/CrossThreadCopier.cpp:
+ * wtf/CrossThreadCopier.h:
+ * wtf/Forward.h:
+ * wtf/PassRefPtr.h: Removed.
+ * wtf/RefPtr.h:
+ (WTF::refIfNotNull):
+ (WTF::derefIfNotNull):
+ (WTF::RefPtr::RefPtr):
+ (WTF::RefPtr::release): Deleted.
+ * wtf/SizeLimits.cpp:
+ * wtf/Vector.h:
+
2017-05-13 Chris Dumez <cdu...@apple.com>
Stop using RefPtr::release()
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (216838 => 216839)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-05-14 07:31:49 UTC (rev 216839)
@@ -444,7 +444,6 @@
A8A472E5151A825B004123FF /* PageReservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageReservation.h; sourceTree = "<group>"; };
A8A472E6151A825B004123FF /* ParallelJobs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobs.h; sourceTree = "<group>"; };
A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobsLibdispatch.h; sourceTree = "<group>"; };
- A8A472ED151A825B004123FF /* PassRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassRefPtr.h; sourceTree = "<group>"; };
A8A472FB151A825B004123FF /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = "<group>"; };
A8A472FC151A825B004123FF /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = "<group>"; };
A8A472FD151A825B004123FF /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = "<group>"; };
@@ -877,7 +876,6 @@
0FEB3DD01BB7366B009D7AAD /* ParallelVectorIterator.h */,
0F824A641B7443A0002E345D /* ParkingLot.cpp */,
0F824A651B7443A0002E345D /* ParkingLot.h */,
- A8A472ED151A825B004123FF /* PassRefPtr.h */,
A876DBD7151816E500DADB95 /* Platform.h */,
E3200AB41E9A536D003B59D2 /* PlatformRegisters.h */,
DCEE21FE1CEA7551000C2396 /* PlatformUserPreferredLanguages.h */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (216838 => 216839)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2017-05-14 07:31:49 UTC (rev 216839)
@@ -95,7 +95,6 @@
ParallelJobsOpenMP.h
ParallelVectorIterator.h
ParkingLot.h
- PassRefPtr.h
Platform.h
PlatformRegisters.h
PrintStream.h
Modified: trunk/Source/WTF/wtf/CrossThreadCopier.cpp (216838 => 216839)
--- trunk/Source/WTF/wtf/CrossThreadCopier.cpp 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/wtf/CrossThreadCopier.cpp 2017-05-14 07:31:49 UTC (rev 216839)
@@ -43,17 +43,12 @@
};
COMPILE_ASSERT((std::is_same<
- PassRefPtr<CopierThreadSafeRefCountedTest>,
- CrossThreadCopier<PassRefPtr<CopierThreadSafeRefCountedTest>>::Type
- >::value),
- PassRefPtrTest);
-COMPILE_ASSERT((std::is_same<
- PassRefPtr<CopierThreadSafeRefCountedTest>,
+ RefPtr<CopierThreadSafeRefCountedTest>,
CrossThreadCopier<RefPtr<CopierThreadSafeRefCountedTest>>::Type
>::value),
RefPtrTest);
COMPILE_ASSERT((std::is_same<
- PassRefPtr<CopierThreadSafeRefCountedTest>,
+ RefPtr<CopierThreadSafeRefCountedTest>,
CrossThreadCopier<CopierThreadSafeRefCountedTest*>::Type
>::value),
RawPointerTest);
@@ -63,10 +58,6 @@
typedef int Type;
};
-template<typename T> struct CrossThreadCopierBase<false, false, PassRefPtr<T>> {
- typedef int Type;
-};
-
template<typename T> struct CrossThreadCopierBase<false, false, T*> {
typedef int Type;
};
@@ -75,7 +66,6 @@
class CopierRefCountedTest : public RefCounted<CopierRefCountedTest> {
};
-static_assert((std::is_same<int, CrossThreadCopier<PassRefPtr<CopierRefCountedTest>>::Type>::value), "CrossThreadCopier specialization improperly applied to PassRefPtr<> of a RefCounted (but not ThreadSafeRefCounted) type");
static_assert((std::is_same<int, CrossThreadCopier<RefPtr<CopierRefCountedTest>>::Type>::value), "CrossThreadCopier specialization improperly applied to RefPtr<> of a RefCounted (but not ThreadSafeRefCounted) type");
static_assert((std::is_same<int, CrossThreadCopier<CopierRefCountedTest*>::Type>::value), "CrossThreadCopier specialization improperly applied to raw pointer of a RefCounted (but not ThreadSafeRefCounted) type");
Modified: trunk/Source/WTF/wtf/CrossThreadCopier.h (216838 => 216839)
--- trunk/Source/WTF/wtf/CrossThreadCopier.h 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/wtf/CrossThreadCopier.h 2017-05-14 07:31:49 UTC (rev 216839)
@@ -33,7 +33,6 @@
#include <wtf/Assertions.h>
#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Threading.h>
#include <wtf/text/WTFString.h>
@@ -52,10 +51,6 @@
typedef T Type;
};
- template<typename T> struct RemovePointer<PassRefPtr<T>> {
- typedef T Type;
- };
-
template<typename T> struct IsEnumOrConvertibleToInteger {
static const bool value = std::is_integral<T>::value || std::is_enum<T>::value || std::is_convertible<T, long double>::value;
};
@@ -92,7 +87,7 @@
typedef typename CrossThreadCopierBaseHelper::RemovePointer<T>::Type RefCountedType;
static_assert(std::is_convertible<RefCountedType*, ThreadSafeRefCounted<RefCountedType>*>::value, "T is not convertible to ThreadSafeRefCounted!");
- typedef PassRefPtr<RefCountedType> Type;
+ typedef RefPtr<RefCountedType> Type;
static Type copy(const T& refPtr)
{
return refPtr;
Modified: trunk/Source/WTF/wtf/Forward.h (216838 => 216839)
--- trunk/Source/WTF/wtf/Forward.h 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/wtf/Forward.h 2017-05-14 07:31:49 UTC (rev 216839)
@@ -32,7 +32,6 @@
template<typename T> class LazyNeverDestroyed;
template<typename T> class NeverDestroyed;
template<typename T> class OptionSet;
-template<typename T> class PassRefPtr;
template<typename T> class Ref;
template<typename T> class RefPtr;
template<typename T> class StringBuffer;
@@ -65,7 +64,6 @@
using WTF::NeverDestroyed;
using WTF::OptionSet;
using WTF::OrdinalNumber;
-using WTF::PassRefPtr;
using WTF::PrintStream;
using WTF::Ref;
using WTF::RefPtr;
Deleted: trunk/Source/WTF/wtf/PassRefPtr.h (216838 => 216839)
--- trunk/Source/WTF/wtf/PassRefPtr.h 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/wtf/PassRefPtr.h 2017-05-14 07:31:49 UTC (rev 216839)
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef WTF_PassRefPtr_h
-#define WTF_PassRefPtr_h
-
-#include <wtf/Ref.h>
-
-namespace WTF {
-
- template<typename T> class RefPtr;
- template<typename T> class PassRefPtr;
-
- template<typename T> ALWAYS_INLINE void refIfNotNull(T* ptr)
- {
- if (LIKELY(ptr != nullptr))
- ptr->ref();
- }
-
- template<typename T> ALWAYS_INLINE void derefIfNotNull(T* ptr)
- {
- if (LIKELY(ptr != nullptr))
- ptr->deref();
- }
-
- template<typename T> class PassRefPtr {
- public:
- typedef T ValueType;
- typedef ValueType* PtrType;
-
- PassRefPtr() : m_ptr(nullptr) { }
- PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
- // It somewhat breaks the type system to allow transfer of ownership out of
- // a const PassRefPtr. However, it makes it much easier to work with PassRefPtr
- // temporaries, and we don't have a need to use real const PassRefPtrs anyway.
- PassRefPtr(const PassRefPtr& o) : m_ptr(o.leakRef()) { }
- template<typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.leakRef()) { }
-
- ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(std::exchange(m_ptr, nullptr)); }
-
- 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; }
-
- T* leakRef() const WARN_UNUSED_RETURN;
-
- T& operator*() const { return *m_ptr; }
- T* operator->() const { return m_ptr; }
-
- bool operator!() const { return !m_ptr; }
-
- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef T* (PassRefPtr::*UnspecifiedBoolType);
- operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::m_ptr : nullptr; }
-
- template<typename V, typename U> friend PassRefPtr<V> static_pointer_cast(const PassRefPtr<U>&);
-
- private:
- PassRefPtr& operator=(const PassRefPtr&) = delete;
-
- enum AdoptTag { Adopt };
- PassRefPtr(T* ptr, AdoptTag) : m_ptr(ptr) { }
-
- mutable T* m_ptr;
- };
-
- template<typename T> template<typename U> inline PassRefPtr<T>::PassRefPtr(const RefPtr<U>& o)
- : m_ptr(o.get())
- {
- T* ptr = m_ptr;
- refIfNotNull(ptr);
- }
-
- template<typename T> inline T* PassRefPtr<T>::leakRef() const
- {
- return std::exchange(m_ptr, nullptr);
- }
-
- template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, const PassRefPtr<U>& b)
- {
- return a.get() == b.get();
- }
-
- template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, const RefPtr<U>& b)
- {
- return a.get() == b.get();
- }
-
- template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const PassRefPtr<U>& b)
- {
- return a.get() == b.get();
- }
-
- template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, U* b)
- {
- return a.get() == b;
- }
-
- template<typename T, typename U> inline bool operator==(T* a, const PassRefPtr<U>& b)
- {
- return a == b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, const PassRefPtr<U>& b)
- {
- return a.get() != b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, const RefPtr<U>& b)
- {
- return a.get() != b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const PassRefPtr<U>& b)
- {
- return a.get() != b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, U* b)
- {
- return a.get() != b;
- }
-
- template<typename T, typename U> inline bool operator!=(T* a, const PassRefPtr<U>& b)
- {
- return a != b.get();
- }
-
- 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>> {
- static const bool value = true;
- };
-
-} // namespace WTF
-
-using WTF::PassRefPtr;
-using WTF::static_pointer_cast;
-
-#endif // WTF_PassRefPtr_h
Modified: trunk/Source/WTF/wtf/RefPtr.h (216838 => 216839)
--- trunk/Source/WTF/wtf/RefPtr.h 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/wtf/RefPtr.h 2017-05-14 07:31:49 UTC (rev 216839)
@@ -18,7 +18,7 @@
*
*/
-// RefPtr and PassRefPtr are documented at http://webkit.org/coding/RefPtr.html
+// RefPtr is documented at http://webkit.org/coding/RefPtr.html
#ifndef WTF_RefPtr_h
#define WTF_RefPtr_h
@@ -27,7 +27,7 @@
#include <utility>
#include <wtf/FastMalloc.h>
#include <wtf/GetPtr.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
namespace WTF {
@@ -34,6 +34,18 @@
template<typename T> class RefPtr;
template<typename T> RefPtr<T> adoptRef(T*);
+template<typename T> ALWAYS_INLINE void refIfNotNull(T* ptr)
+{
+ if (LIKELY(ptr != nullptr))
+ ptr->ref();
+}
+
+template<typename T> ALWAYS_INLINE void derefIfNotNull(T* ptr)
+{
+ if (LIKELY(ptr != nullptr))
+ ptr->deref();
+}
+
template<typename T> class RefPtr {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -49,10 +61,6 @@
ALWAYS_INLINE RefPtr(RefPtr&& o) : m_ptr(o.leakRef()) { }
template<typename U> RefPtr(RefPtr<U>&& o) : m_ptr(o.leakRef()) { }
-
- // See comments in PassRefPtr.h for an explanation of why this takes a const reference.
- template<typename U> RefPtr(const PassRefPtr<U>&);
-
template<typename U> RefPtr(Ref<U>&&);
// Hash table deleted values, which are only constructed and never copied or destroyed.
@@ -63,8 +71,6 @@
T* get() const { return m_ptr; }
- // 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; }
Ref<const T> releaseConstNonNull() { ASSERT(m_ptr); Ref<const T> tmp(adoptRef(*m_ptr)); m_ptr = nullptr; return tmp; }
@@ -82,9 +88,7 @@
RefPtr& operator=(const RefPtr&);
RefPtr& operator=(T*);
RefPtr& operator=(std::nullptr_t);
- RefPtr& operator=(const PassRefPtr<T>&);
template<typename U> RefPtr& operator=(const RefPtr<U>&);
- template<typename U> RefPtr& operator=(const PassRefPtr<U>&);
RefPtr& operator=(RefPtr&&);
template<typename U> RefPtr& operator=(RefPtr<U>&&);
template<typename U> RefPtr& operator=(Ref<U>&&);
@@ -109,11 +113,6 @@
T* m_ptr;
};
-template<typename T> template<typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o)
- : m_ptr(o.leakRef())
-{
-}
-
template<typename T> template<typename U> inline RefPtr<T>::RefPtr(Ref<U>&& reference)
: m_ptr(&reference.leakRef())
{
@@ -152,20 +151,6 @@
return *this;
}
-template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<T>& o)
-{
- RefPtr ptr = o;
- swap(ptr);
- return *this;
-}
-
-template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o)
-{
- RefPtr ptr = o;
- swap(ptr);
- return *this;
-}
-
template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr&& o)
{
RefPtr ptr = WTFMove(o);
Modified: trunk/Source/WTF/wtf/SizeLimits.cpp (216838 => 216839)
--- trunk/Source/WTF/wtf/SizeLimits.cpp 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/wtf/SizeLimits.cpp 2017-05-14 07:31:49 UTC (rev 216839)
@@ -33,7 +33,6 @@
#include <type_traits>
#include <utility>
#include <wtf/Assertions.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -54,7 +53,6 @@
};
#endif
-static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr should stay small!");
static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small!");
static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should stay small!");
Modified: trunk/Source/WTF/wtf/Vector.h (216838 => 216839)
--- trunk/Source/WTF/wtf/Vector.h 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Source/WTF/wtf/Vector.h 2017-05-14 07:31:49 UTC (rev 216839)
@@ -1188,9 +1188,6 @@
asanSetInitialBufferSizeTo(size());
}
-// Templatizing these is better than just letting the conversion happen implicitly,
-// because for instance it allows a PassRefPtr to be appended to a RefPtr vector
-// without refcount thrash.
template<typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity> template<typename U>
void Vector<T, inlineCapacity, OverflowHandler, minCapacity>::append(const U* data, size_t dataSize)
{
Modified: trunk/Tools/ChangeLog (216838 => 216839)
--- trunk/Tools/ChangeLog 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Tools/ChangeLog 2017-05-14 07:31:49 UTC (rev 216839)
@@ -1,3 +1,16 @@
+2017-05-14 Chris Dumez <cdu...@apple.com>
+
+ Drop PassRefPtr class from WTF
+ https://bugs.webkit.org/show_bug.cgi?id=172091
+
+ Reviewed by Alex Christensen.
+
+ Drop API test coverage.
+
+ * TestWebKitAPI/Tests/WTF/Ref.cpp:
+ (TestWebKitAPI::TEST):
+ (TestWebKitAPI::passWithPassRefPtr): Deleted.
+
2017-05-13 Eric Carlson <eric.carl...@apple.com>
[MediaStream] deviceId constraint doesn't work with getUserMedia
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Ref.cpp (216838 => 216839)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/Ref.cpp 2017-05-14 06:05:17 UTC (rev 216838)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Ref.cpp 2017-05-14 07:31:49 UTC (rev 216839)
@@ -102,11 +102,6 @@
return WTFMove(reference);
}
-static RefPtr<RefLogger> passWithPassRefPtr(PassRefPtr<RefLogger> reference)
-{
- return reference;
-}
-
TEST(WTF_Ref, ReturnValue)
{
DerivedRefLogger a("a");
@@ -136,12 +131,6 @@
ASSERT_STREQ("ref(a) deref(a) ", takeLogStr().c_str());
{
- RefPtr<RefLogger> ptr(passWithPassRefPtr(passWithRef(a)));
- ASSERT_EQ(&a, ptr.get());
- }
- ASSERT_STREQ("ref(a) deref(a) ", takeLogStr().c_str());
-
- {
RefPtr<DerivedRefLogger> ptr(&a);
RefPtr<RefLogger> ptr2(WTFMove(ptr));
ASSERT_EQ(nullptr, ptr.get());