Bug 1267918 - Add do_AddRef(const RefPtr<T>& aObj). r=froydnj
authorChris Pearce <cpearce@mozilla.com>
Thu, 30 Jun 2016 10:06:10 +1200
changeset 343403 45fb3e6f39369db6abc5479bf2e129163352de88
parent 343374 0a03bb6af6043ce323142d24fb43c2d63deefbcb
child 343404 d409232655857c1d27209a02be589344f5eee903
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1267918
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
mfbt/RefPtr.h
--- 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(...)
  *   {