Bug 1287624, part 2 - Replace swap with forget in a few places. r=froydnj
authorAndrew McCreight <continuation@gmail.com>
Wed, 20 Jul 2016 15:19:00 -0700
changeset 345977 59409d62be6199125942fad9f5a1250f9dc3cd25
parent 345976 7d2485670bb24a96b19bbee95b17c578cc29709c
child 345978 ff1ffc0835711a1ab930ad1477e0ad5635cf7099
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
bugs1287624
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 1287624, part 2 - Replace swap with forget in a few places. r=froydnj The return argument was initialized to null in all of these, so it should not change the behavior.
netwerk/base/nsInputStreamPump.cpp
toolkit/components/places/nsNavHistoryQuery.cpp
xpfe/appshell/nsAppShellService.cpp
--- a/netwerk/base/nsInputStreamPump.cpp
+++ b/netwerk/base/nsInputStreamPump.cpp
@@ -61,18 +61,17 @@ nsInputStreamPump::Create(nsInputStreamP
                           bool                 closeWhenDone)
 {
     nsresult rv = NS_ERROR_OUT_OF_MEMORY;
     RefPtr<nsInputStreamPump> pump = new nsInputStreamPump();
     if (pump) {
         rv = pump->Init(stream, streamPos, streamLen,
                         segsize, segcount, closeWhenDone);
         if (NS_SUCCEEDED(rv)) {
-            *result = nullptr;
-            pump.swap(*result);
+            pump.forget(result);
         }
     }
     return rv;
 }
 
 struct PeekData {
   PeekData(nsInputStreamPump::PeekSegmentFun fun, void* closure)
     : mFunc(fun), mClosure(closure) {}
--- a/toolkit/components/places/nsNavHistoryQuery.cpp
+++ b/toolkit/components/places/nsNavHistoryQuery.cpp
@@ -1501,31 +1501,29 @@ nsNavHistoryQueryOptions::Clone(nsINavHi
   return rv;
 }
 
 nsresult
 nsNavHistoryQueryOptions::Clone(nsNavHistoryQueryOptions **aResult)
 {
   *aResult = nullptr;
   nsNavHistoryQueryOptions *result = new nsNavHistoryQueryOptions();
-  if (! result)
-    return NS_ERROR_OUT_OF_MEMORY;
 
   RefPtr<nsNavHistoryQueryOptions> resultHolder(result);
   result->mSort = mSort;
   result->mResultType = mResultType;
   result->mExcludeItems = mExcludeItems;
   result->mExcludeQueries = mExcludeQueries;
   result->mExpandQueries = mExpandQueries;
   result->mMaxResults = mMaxResults;
   result->mQueryType = mQueryType;
   result->mParentAnnotationToExclude = mParentAnnotationToExclude;
   result->mAsyncEnabled = mAsyncEnabled;
 
-  resultHolder.swap(*aResult);
+  resultHolder.forget(aResult);
   return NS_OK;
 }
 
 
 // AppendBoolKeyValueIfTrue
 
 void // static
 AppendBoolKeyValueIfTrue(nsACString& aString, const nsCString& aName,
--- a/xpfe/appshell/nsAppShellService.cpp
+++ b/xpfe/appshell/nsAppShellService.cpp
@@ -773,17 +773,17 @@ nsAppShellService::JustCreateTopWindow(n
       do_GetInterface(NS_ISUPPORTS_CAST(nsIBaseWindow*, window));
   nsCOMPtr<nsIWebNavigation> newWebNav = do_GetInterface(newDomWin);
   nsCOMPtr<nsILoadContext> thisContext = do_GetInterface(newWebNav);
   if (thisContext) {
     thisContext->SetPrivateBrowsing(isPrivateBrowsingWindow);
     thisContext->SetRemoteTabs(isUsingRemoteTabs);
   }
 
-  window.swap(*aResult); // transfer reference
+  window.forget(aResult);
   if (parent)
     parent->AddChildWindow(*aResult);
 
   if (center)
     rv = (*aResult)->Center(parent, parent ? false : true, false);
 
   return rv;
 }