Bug 1267918 - Add do_AddRef(const RefPtr<T>& aObj). r=froydnj
This means we can return already_AddRefed<T> for any RefPtr<T>s
being held as instance variables easier.
MozReview-Commit-ID: HFHdkF8EUsK
--- a/mfbt/RefPtr.h
+++ b/mfbt/RefPtr.h
@@ -597,16 +597,24 @@ operator!=(decltype(nullptr), const RefP
template <class T>
inline already_AddRefed<T>
do_AddRef(T* aObj)
{
RefPtr<T> ref(aObj);
return ref.forget();
}
+template <class T>
+inline already_AddRefed<T>
+do_AddRef(const RefPtr<T>& aObj)
+{
+ RefPtr<T> ref(aObj);
+ return ref.forget();
+}
+
namespace mozilla {
/**
* Helper function to be able to conveniently write things like:
*
* already_AddRefed<T>
* f(...)
* {