Bug 1303472 - Add a move constructor to nsCOMPtr, r=froydnj
authorMichael Layzell <michael@thelayzells.com>
Fri, 16 Sep 2016 19:49:07 -0400
changeset 314641 6396e3ab4695af0b3815bd09255c48d182f06540
parent 314640 d616d2e9d1a495600dc857fa56f551598804d8d5
child 314642 8f87b0ff155b0cc6826b1ef38363e9797a35e4a5
push id30732
push usercbook@mozilla.com
push dateWed, 21 Sep 2016 10:04:03 +0000
treeherdermozilla-central@560b2c805bf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1303472
milestone52.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 1303472 - Add a move constructor to nsCOMPtr, r=froydnj MozReview-Commit-ID: 6ECLDmA9Ol
xpcom/glue/nsCOMPtr.h
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -435,16 +435,25 @@ public:
   {
     assert_validity();
     if (mRawPtr) {
       NSCAP_ADDREF(this, mRawPtr);
     }
     NSCAP_LOG_ASSIGNMENT(this, aSmartPtr.mRawPtr);
   }
 
+  nsCOMPtr(nsCOMPtr<T>&& aSmartPtr)
+    : NSCAP_CTOR_BASE(aSmartPtr.mRawPtr)
+  {
+    assert_validity();
+    aSmartPtr.mRawPtr = nullptr;
+    NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+  }
+
   MOZ_IMPLICIT nsCOMPtr(T* aRawPtr)
     : NSCAP_CTOR_BASE(aRawPtr)
   {
     assert_validity();
     if (mRawPtr) {
       NSCAP_ADDREF(this, mRawPtr);
     }
     NSCAP_LOG_ASSIGNMENT(this, aRawPtr);