Bug 931887 - Use swap() instead forget() in LoadInfo, r=bent
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 23 Jan 2014 20:14:35 +0000
changeset 164887 e864fca8c73e674ef18930d61d53387c4094f7c5
parent 164886 98d0a4876836c603b2ecee02cc67d8b3f63ce127
child 164888 f88b13e2ae0acddbe78c7de8df85d227e4ce0ece
push id38850
push useramarchesini@mozilla.com
push dateThu, 23 Jan 2014 20:14:51 +0000
treeherdermozilla-inbound@e864fca8c73e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs931887
milestone29.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 931887 - Use swap() instead forget() in LoadInfo, r=bent
dom/workers/WorkerPrivate.h
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -154,23 +154,37 @@ public:
     LoadInfo()
     : mEvalAllowed(false), mReportCSPViolations(false),
       mXHRParamsAllowed(false), mPrincipalIsSystem(false)
     { }
 
     void
     StealFrom(LoadInfo& aOther)
     {
-      mBaseURI = aOther.mBaseURI.forget();
-      mResolvedScriptURI = aOther.mResolvedScriptURI.forget();
-      mPrincipal = aOther.mPrincipal.forget();
-      mScriptContext = aOther.mScriptContext.forget();
-      mWindow = aOther.mWindow.forget();
-      mCSP = aOther.mCSP.forget();
-      mChannel = aOther.mChannel.forget();
+      MOZ_ASSERT(!mBaseURI);
+      aOther.mBaseURI.swap(mBaseURI);
+
+      MOZ_ASSERT(!mResolvedScriptURI);
+      aOther.mResolvedScriptURI.swap(mResolvedScriptURI);
+
+      MOZ_ASSERT(!mPrincipal);
+      aOther.mPrincipal.swap(mPrincipal);
+
+      MOZ_ASSERT(!mScriptContext);
+      aOther.mScriptContext.swap(mScriptContext);
+
+      MOZ_ASSERT(!mWindow);
+      aOther.mWindow.swap(mWindow);
+
+      MOZ_ASSERT(!mCSP);
+      aOther.mCSP.swap(mCSP);
+
+      MOZ_ASSERT(!mChannel);
+      aOther.mChannel.swap(mChannel);
+
       mDomain = aOther.mDomain;
       mEvalAllowed = aOther.mEvalAllowed;
       mReportCSPViolations = aOther.mReportCSPViolations;
       mXHRParamsAllowed = aOther.mXHRParamsAllowed;
       mPrincipalIsSystem = aOther.mPrincipalIsSystem;
     }
   };