Bug 1161627 - part 1 - add move constructor and assignment operator for already_AddRefed&& to RefPtr; r=ehsan

This change is prep work for future mass rewriting.
This commit is contained in:
Nathan Froyd 2015-05-05 13:02:21 -04:00
parent 2e6c0723a0
commit 0bd78f32c5

View File

@ -237,6 +237,7 @@ public:
RefPtr(const RefPtr& aOther) : mPtr(ref(aOther.mPtr)) {}
MOZ_IMPLICIT RefPtr(const TemporaryRef<T>& aOther) : mPtr(aOther.take()) {}
MOZ_IMPLICIT RefPtr(already_AddRefed<T>& aOther) : mPtr(aOther.take()) {}
MOZ_IMPLICIT RefPtr(already_AddRefed<T>&& aOther) : mPtr(aOther.take()) {}
MOZ_IMPLICIT RefPtr(T* aVal) : mPtr(ref(aVal)) {}
template<typename U>
@ -259,6 +260,11 @@ public:
assign(aOther.take());
return *this;
}
RefPtr& operator=(already_AddRefed<T>&& aOther)
{
assign(aOther.take());
return *this;
}
RefPtr& operator=(T* aVal)
{
assign(ref(aVal));