Lines Matching defs:RefPtr

21 // RefPtr and PassRefPtr are documented at http://webkit.org/coding/RefPtr.html
35 template<typename T> class RefPtr {
36 WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(RefPtr);
37 WTF_DISALLOW_ZERO_ASSIGNMENT(RefPtr);
39 ALWAYS_INLINE RefPtr() : m_ptr(0) { }
40 ALWAYS_INLINE RefPtr(std::nullptr_t) : m_ptr(0) { }
41 ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
42 template<typename U> RefPtr(const RawPtr<U>& ptr, EnsurePtrConvertibleArgDecl(U, T)) : m_ptr(ptr.get()) { refIfNotNull(m_ptr); }
43 ALWAYS_INLINE explicit RefPtr(T& ref) : m_ptr(&ref) { m_ptr->ref(); }
44 ALWAYS_INLINE RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { refIfNotNull(m_ptr); }
45 template<typename U> RefPtr(const RefPtr<U>& o, EnsurePtrConvertibleArgDecl(U, T)) : m_ptr(o.get()) { refIfNotNull(m_ptr); }
48 RefPtr(RefPtr&& o) : m_ptr(o.m_ptr) { o.m_ptr = 0; }
49 RefPtr& operator=(RefPtr&&);
53 template<typename U> RefPtr(const PassRefPtr<U>&, EnsurePtrConvertibleArgDecl(U, T));
56 RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
59 ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); }
72 typedef T* (RefPtr::*UnspecifiedBoolType);
73 operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : 0; }
75 RefPtr& operator=(const RefPtr&);
76 RefPtr& operator=(T*);
77 RefPtr& operator=(const PassRefPtr<T>&);
78 RefPtr& operator=(std::nullptr_t) { clear(); return *this; }
80 template<typename U> RefPtr<T>& operator=(const RefPtr<U>&);
81 template<typename U> RefPtr<T>& operator=(const PassRefPtr<U>&);
82 template<typename U> RefPtr<T>& operator=(const RawPtr<U>&);
84 void swap(RefPtr&);
92 template<typename T> template<typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o, EnsurePtrConvertibleArgDefn(U, T))
97 template<typename T> inline void RefPtr<T>::clear()
104 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr& o)
106 RefPtr ptr = o;
112 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr&& o)
114 // FIXME: Instead of explicitly casting to RefPtr&& here, we should use std::move, but that requires us to
116 RefPtr ptr = static_cast<RefPtr&&>(o);
122 template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<U>& o)
124 RefPtr ptr = o;
129 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(T* optr)
131 RefPtr ptr = optr;
136 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<T>& o)
138 RefPtr ptr = o;
143 template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o)
145 RefPtr ptr = o;
150 template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const RawPtr<U>& o)
152 RefPtr ptr = o.get();
157 template<class T> inline void RefPtr<T>::swap(RefPtr& o)
162 template<class T> inline void swap(RefPtr<T>& a, RefPtr<T>& b)
167 template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const RefPtr<U>& b)
172 template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, U* b)
177 template<typename T, typename U> inline bool operator==(T* a, const RefPtr<U>& b)
182 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const RefPtr<U>& b)
187 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, U* b)
192 template<typename T, typename U> inline bool operator!=(T* a, const RefPtr<U>& b)
197 template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const RefPtr<U>& p)
199 return RefPtr<T>(static_cast<T*>(p.get()));
202 template<typename T> inline T* getPtr(const RefPtr<T>& p)
211 template<typename U> RefPtrValuePeeker(const RefPtr<U>& p): m_ptr(p.get()) { }
221 using WTF::RefPtr;