Title: [154537] trunk/Source/WTF
- Revision
- 154537
- Author
- [email protected]
- Date
- 2013-08-23 21:07:07 -0700 (Fri, 23 Aug 2013)
Log Message
Revert r153637.
It didn't work with ARC like it said it would. We'll need to take a slightly different approach.
Rubber-stamped by Anders Carlsson.
* wtf/RetainPtr.h:
(WTF::RetainPtr::RetainPtr):
(WTF::RetainPtr::~RetainPtr):
(WTF::RetainPtr::operator UnspecifiedBoolType):
(WTF::::RetainPtr):
(WTF::::clear):
(WTF::=):
(WTF::adoptCF):
(WTF::adoptNS):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (154536 => 154537)
--- trunk/Source/WTF/ChangeLog 2013-08-24 00:30:38 UTC (rev 154536)
+++ trunk/Source/WTF/ChangeLog 2013-08-24 04:07:07 UTC (rev 154537)
@@ -1,3 +1,21 @@
+2013-08-21 Mark Rowe <[email protected]>
+
+ Revert r153637.
+
+ It didn't work with ARC like it said it would. We'll need to take a slightly different approach.
+
+ Rubber-stamped by Anders Carlsson.
+
+ * wtf/RetainPtr.h:
+ (WTF::RetainPtr::RetainPtr):
+ (WTF::RetainPtr::~RetainPtr):
+ (WTF::RetainPtr::operator UnspecifiedBoolType):
+ (WTF::::RetainPtr):
+ (WTF::::clear):
+ (WTF::=):
+ (WTF::adoptCF):
+ (WTF::adoptNS):
+
2013-08-23 Brent Fulgham <[email protected]>
[Windows] Unreviewed build correction after r154513.
Modified: trunk/Source/WTF/wtf/RetainPtr.h (154536 => 154537)
--- trunk/Source/WTF/wtf/RetainPtr.h 2013-08-24 00:30:38 UTC (rev 154536)
+++ trunk/Source/WTF/wtf/RetainPtr.h 2013-08-24 04:07:07 UTC (rev 154537)
@@ -51,28 +51,8 @@
enum AdoptCFTag { AdoptCF };
enum AdoptNSTag { AdoptNS };
-
-#if USE(CF)
- inline void retain(CFTypeRef ptr) { CFRetain(ptr); }
- inline void release(CFTypeRef ptr) { CFRelease(ptr); }
-#endif
-
+
#ifdef __OBJC__
-#if __has_feature(objc_arc)
- inline void adoptNSReference(id) { }
- inline void retain(id ptr) { }
- inline void release(id ptr) { }
-#else
- inline void retain(id ptr)
- {
- CFRetain(ptr);
- }
-
- inline void release(id ptr)
- {
- CFRelease(ptr);
- }
-
#ifdef OBJC_NO_GC
inline void adoptNSReference(id)
{
@@ -86,17 +66,15 @@
}
}
#endif
-#endif // __has_feature(objc_arc)
-#endif // __OBJC__
+#endif
-
template<typename T> class RetainPtr {
public:
typedef typename RemovePointer<T>::Type ValueType;
typedef ValueType* PtrType;
RetainPtr() : m_ptr(0) {}
- RetainPtr(PtrType ptr) : m_ptr(ptr) { if (ptr) retain(ptr); }
+ RetainPtr(PtrType ptr) : m_ptr(ptr) { if (ptr) CFRetain(ptr); }
RetainPtr(AdoptCFTag, PtrType ptr)
: m_ptr(ptr)
@@ -112,7 +90,7 @@
adoptNSReference(ptr);
}
- RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (PtrType ptr = m_ptr) retain(ptr); }
+ RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (PtrType ptr = m_ptr) CFRetain(ptr); }
#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
RetainPtr(RetainPtr&& o) : m_ptr(o.leakRef()) { }
@@ -122,7 +100,7 @@
RetainPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
- ~RetainPtr() { if (PtrType ptr = m_ptr) release(ptr); }
+ ~RetainPtr() { if (PtrType ptr = m_ptr) CFRelease(ptr); }
template<typename U> RetainPtr(const RetainPtr<U>&);
@@ -138,9 +116,8 @@
bool operator!() const { return !m_ptr; }
// This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef void (RetainPtr::*UnspecifiedBoolType)() const;
- void ImplicitConversionToBoolIsNotAllowed() const { }
- operator UnspecifiedBoolType() const { return m_ptr ? &RetainPtr::ImplicitConversionToBoolIsNotAllowed : 0; }
+ typedef PtrType RetainPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &RetainPtr::m_ptr : 0; }
RetainPtr& operator=(const RetainPtr&);
template<typename U> RetainPtr& operator=(const RetainPtr<U>&);
@@ -168,14 +145,14 @@
: m_ptr(o.get())
{
if (PtrType ptr = m_ptr)
- retain(ptr);
+ CFRetain(ptr);
}
template<typename T> inline void RetainPtr<T>::clear()
{
if (PtrType ptr = m_ptr) {
m_ptr = 0;
- release(ptr);
+ CFRelease(ptr);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes