|
@@ -63,21 +63,21 @@ public:
|
|
: m_ptr(other.leak_ref())
|
|
: m_ptr(other.leak_ref())
|
|
{
|
|
{
|
|
}
|
|
}
|
|
- RefPtr(const NonnullRefPtr<T>& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr(const NonnullRefPtr<T>& other)
|
|
: m_ptr(const_cast<T*>(other.ptr()))
|
|
: m_ptr(const_cast<T*>(other.ptr()))
|
|
{
|
|
{
|
|
ASSERT(m_ptr);
|
|
ASSERT(m_ptr);
|
|
m_ptr->ref();
|
|
m_ptr->ref();
|
|
}
|
|
}
|
|
template<typename U>
|
|
template<typename U>
|
|
- RefPtr(const NonnullRefPtr<U>& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr(const NonnullRefPtr<U>& other)
|
|
: m_ptr(const_cast<U*>(other.ptr()))
|
|
: m_ptr(const_cast<U*>(other.ptr()))
|
|
{
|
|
{
|
|
ASSERT(m_ptr);
|
|
ASSERT(m_ptr);
|
|
m_ptr->ref();
|
|
m_ptr->ref();
|
|
}
|
|
}
|
|
template<typename U>
|
|
template<typename U>
|
|
- RefPtr(NonnullRefPtr<U>&& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr(NonnullRefPtr<U>&& other)
|
|
: m_ptr(&other.leak_ref())
|
|
: m_ptr(&other.leak_ref())
|
|
{
|
|
{
|
|
ASSERT(m_ptr);
|
|
ASSERT(m_ptr);
|
|
@@ -98,7 +98,7 @@ public:
|
|
{
|
|
{
|
|
ref_if_not_null(m_ptr);
|
|
ref_if_not_null(m_ptr);
|
|
}
|
|
}
|
|
- ~RefPtr()
|
|
|
|
|
|
+ ALWAYS_INLINE ~RefPtr()
|
|
{
|
|
{
|
|
clear();
|
|
clear();
|
|
#ifdef SANITIZE_PTRS
|
|
#ifdef SANITIZE_PTRS
|
|
@@ -121,7 +121,7 @@ public:
|
|
::swap(m_ptr, other.m_ptr);
|
|
::swap(m_ptr, other.m_ptr);
|
|
}
|
|
}
|
|
|
|
|
|
- RefPtr& operator=(RefPtr&& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(RefPtr&& other)
|
|
{
|
|
{
|
|
RefPtr tmp = move(other);
|
|
RefPtr tmp = move(other);
|
|
swap(tmp);
|
|
swap(tmp);
|
|
@@ -129,7 +129,7 @@ public:
|
|
}
|
|
}
|
|
|
|
|
|
template<typename U>
|
|
template<typename U>
|
|
- RefPtr& operator=(RefPtr<U>&& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(RefPtr<U>&& other)
|
|
{
|
|
{
|
|
RefPtr tmp = move(other);
|
|
RefPtr tmp = move(other);
|
|
swap(tmp);
|
|
swap(tmp);
|
|
@@ -137,7 +137,7 @@ public:
|
|
}
|
|
}
|
|
|
|
|
|
template<typename U>
|
|
template<typename U>
|
|
- RefPtr& operator=(NonnullRefPtr<U>&& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(NonnullRefPtr<U>&& other)
|
|
{
|
|
{
|
|
RefPtr tmp = move(other);
|
|
RefPtr tmp = move(other);
|
|
swap(tmp);
|
|
swap(tmp);
|
|
@@ -145,7 +145,7 @@ public:
|
|
return *this;
|
|
return *this;
|
|
}
|
|
}
|
|
|
|
|
|
- RefPtr& operator=(const NonnullRefPtr<T>& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(const NonnullRefPtr<T>& other)
|
|
{
|
|
{
|
|
RefPtr tmp = other;
|
|
RefPtr tmp = other;
|
|
swap(tmp);
|
|
swap(tmp);
|
|
@@ -154,7 +154,7 @@ public:
|
|
}
|
|
}
|
|
|
|
|
|
template<typename U>
|
|
template<typename U>
|
|
- RefPtr& operator=(const NonnullRefPtr<U>& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(const NonnullRefPtr<U>& other)
|
|
{
|
|
{
|
|
RefPtr tmp = other;
|
|
RefPtr tmp = other;
|
|
swap(tmp);
|
|
swap(tmp);
|
|
@@ -162,7 +162,7 @@ public:
|
|
return *this;
|
|
return *this;
|
|
}
|
|
}
|
|
|
|
|
|
- RefPtr& operator=(const RefPtr& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(const RefPtr& other)
|
|
{
|
|
{
|
|
RefPtr tmp = other;
|
|
RefPtr tmp = other;
|
|
swap(tmp);
|
|
swap(tmp);
|
|
@@ -170,21 +170,21 @@ public:
|
|
}
|
|
}
|
|
|
|
|
|
template<typename U>
|
|
template<typename U>
|
|
- RefPtr& operator=(const RefPtr<U>& other)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(const RefPtr<U>& other)
|
|
{
|
|
{
|
|
RefPtr tmp = other;
|
|
RefPtr tmp = other;
|
|
swap(tmp);
|
|
swap(tmp);
|
|
return *this;
|
|
return *this;
|
|
}
|
|
}
|
|
|
|
|
|
- RefPtr& operator=(const T* ptr)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(const T* ptr)
|
|
{
|
|
{
|
|
RefPtr tmp = ptr;
|
|
RefPtr tmp = ptr;
|
|
swap(tmp);
|
|
swap(tmp);
|
|
return *this;
|
|
return *this;
|
|
}
|
|
}
|
|
|
|
|
|
- RefPtr& operator=(const T& object)
|
|
|
|
|
|
+ ALWAYS_INLINE RefPtr& operator=(const T& object)
|
|
{
|
|
{
|
|
RefPtr tmp = object;
|
|
RefPtr tmp = object;
|
|
swap(tmp);
|
|
swap(tmp);
|
|
@@ -197,7 +197,7 @@ public:
|
|
return *this;
|
|
return *this;
|
|
}
|
|
}
|
|
|
|
|
|
- void clear()
|
|
|
|
|
|
+ ALWAYS_INLINE void clear()
|
|
{
|
|
{
|
|
unref_if_not_null(m_ptr);
|
|
unref_if_not_null(m_ptr);
|
|
m_ptr = nullptr;
|
|
m_ptr = nullptr;
|
|
@@ -216,35 +216,35 @@ public:
|
|
return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, *leak_ref());
|
|
return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, *leak_ref());
|
|
}
|
|
}
|
|
|
|
|
|
- T* ptr() { return m_ptr; }
|
|
|
|
- const T* ptr() const { return m_ptr; }
|
|
|
|
|
|
+ ALWAYS_INLINE T* ptr() { return m_ptr; }
|
|
|
|
+ ALWAYS_INLINE const T* ptr() const { return m_ptr; }
|
|
|
|
|
|
- T* operator->()
|
|
|
|
|
|
+ ALWAYS_INLINE T* operator->()
|
|
{
|
|
{
|
|
ASSERT(m_ptr);
|
|
ASSERT(m_ptr);
|
|
return m_ptr;
|
|
return m_ptr;
|
|
}
|
|
}
|
|
|
|
|
|
- const T* operator->() const
|
|
|
|
|
|
+ ALWAYS_INLINE const T* operator->() const
|
|
{
|
|
{
|
|
ASSERT(m_ptr);
|
|
ASSERT(m_ptr);
|
|
return m_ptr;
|
|
return m_ptr;
|
|
}
|
|
}
|
|
|
|
|
|
- T& operator*()
|
|
|
|
|
|
+ ALWAYS_INLINE T& operator*()
|
|
{
|
|
{
|
|
ASSERT(m_ptr);
|
|
ASSERT(m_ptr);
|
|
return *m_ptr;
|
|
return *m_ptr;
|
|
}
|
|
}
|
|
|
|
|
|
- const T& operator*() const
|
|
|
|
|
|
+ ALWAYS_INLINE const T& operator*() const
|
|
{
|
|
{
|
|
ASSERT(m_ptr);
|
|
ASSERT(m_ptr);
|
|
return *m_ptr;
|
|
return *m_ptr;
|
|
}
|
|
}
|
|
|
|
|
|
- operator const T*() const { return m_ptr; }
|
|
|
|
- operator T*() { return m_ptr; }
|
|
|
|
|
|
+ ALWAYS_INLINE operator const T*() const { return m_ptr; }
|
|
|
|
+ ALWAYS_INLINE operator T*() { return m_ptr; }
|
|
|
|
|
|
operator bool() { return !!m_ptr; }
|
|
operator bool() { return !!m_ptr; }
|
|
|
|
|