Bug 1161627 - part 1 - add move constructor and assignment operator for already_AddRefed&& to RefPtr; r=ehsan
authorNathan Froyd <froydnj@mozilla.com>
Tue, 05 May 2015 13:02:21 -0400
changeset 280069 b45c68b9dceb82d362b01c1eefe2eb51684af9d0
parent 280068 5c6f160c64764d41be558f2025ef567c8bd07fe3
child 280070 a047d84164b110c315cc423bb82e39f586306943
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1161627
milestone41.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 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.
mfbt/RefPtr.h
--- a/mfbt/RefPtr.h
+++ b/mfbt/RefPtr.h
@@ -232,16 +232,17 @@ class RefPtr
 
   struct DontRef {};
 
 public:
   RefPtr() : mPtr(0) {}
   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>
   RefPtr(const RefPtr<U>& aOther) : mPtr(ref(aOther.get())) {}
 
   ~RefPtr() { unref(mPtr); }
 
   RefPtr& operator=(const RefPtr& aOther)
@@ -254,16 +255,21 @@ public:
     assign(aOther.take());
     return *this;
   }
   RefPtr& operator=(already_AddRefed<T>& aOther)
   {
     assign(aOther.take());
     return *this;
   }
+  RefPtr& operator=(already_AddRefed<T>&& aOther)
+  {
+    assign(aOther.take());
+    return *this;
+  }
   RefPtr& operator=(T* aVal)
   {
     assign(ref(aVal));
     return *this;
   }
 
   template<typename U>
   RefPtr& operator=(const RefPtr<U>& aOther)