Bug 1626451 - Remove nsAutoPtr usage from uriloader/. r=valentin
authorEric Rahm <erahm@mozilla.com>
Fri, 03 Apr 2020 21:05:39 +0000
changeset 522078 fc7bca6a1fb91f1c05ab0406cc345cfebbbe1d77
parent 522077 0b5682be22dcd0697e3204ec13a3ee604ae7c484
child 522079 e7bbdc722890fbe4346e244d5fc29feacc33a2dd
push id111997
push usererahm@mozilla.com
push dateFri, 03 Apr 2020 22:13:48 +0000
treeherderautoland@22a884a1390f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1626451
milestone76.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 1626451 - Remove nsAutoPtr usage from uriloader/. r=valentin Differential Revision: https://phabricator.services.mozilla.com/D69122
uriloader/base/nsDocLoader.cpp
uriloader/base/nsDocLoader.h
uriloader/base/nsURILoader.cpp
uriloader/exthandler/nsExternalHelperAppService.cpp
uriloader/exthandler/nsExternalHelperAppService.h
uriloader/exthandler/unix/nsGNOMERegistry.cpp
uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
uriloader/exthandler/unix/nsOSHelperAppService.cpp
uriloader/exthandler/win/nsMIMEInfoWin.cpp
uriloader/exthandler/win/nsOSHelperAppService.cpp
uriloader/prefetch/OfflineCacheUpdateGlue.h
uriloader/prefetch/nsOfflineCacheUpdate.h
uriloader/prefetch/nsPrefetchService.cpp
uriloader/prefetch/nsPrefetchService.h
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -20,17 +20,16 @@
 #include "nsIWebNavigation.h"
 #include "nsIWebProgressListener2.h"
 
 #include "nsString.h"
 
 #include "nsCOMPtr.h"
 #include "nscore.h"
 #include "nsIWeakReferenceUtils.h"
-#include "nsAutoPtr.h"
 #include "nsQueryObject.h"
 
 #include "nsPIDOMWindow.h"
 #include "nsGlobalWindow.h"
 
 #include "nsIStringBundle.h"
 
 #include "nsIDocShell.h"
@@ -1201,26 +1200,26 @@ NS_IMETHODIMP nsDocLoader::OnStatus(nsIR
     if (NS_FAILED(rv)) return rv;
 
     // Keep around the message. In case a request finishes, we need to make sure
     // to send the status message of another request to our user to that we
     // don't display, for example, "Transferring" messages for requests that are
     // already done.
     if (info) {
       if (!info->mLastStatus) {
-        info->mLastStatus = new nsStatusInfo(aRequest);
+        info->mLastStatus = MakeUnique<nsStatusInfo>(aRequest);
       } else {
         // We're going to move it to the front of the list, so remove
         // it from wherever it is now.
         info->mLastStatus->remove();
       }
       info->mLastStatus->mStatusMessage = msg;
       info->mLastStatus->mStatusCode = aStatus;
       // Put the info at the front of the list
-      mStatusInfoList.insertFront(info->mLastStatus);
+      mStatusInfoList.insertFront(info->mLastStatus.get());
     }
     FireOnStatusChange(this, aRequest, aStatus, msg.get());
   }
   return NS_OK;
 }
 
 void nsDocLoader::ClearInternalProgress() {
   ClearRequestInfoHash();
--- a/uriloader/base/nsDocLoader.h
+++ b/uriloader/base/nsDocLoader.h
@@ -21,20 +21,20 @@
 #include "nsIChannel.h"
 #include "nsIProgressEventSink.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIChannelEventSink.h"
 #include "nsISupportsPriority.h"
 #include "nsCOMPtr.h"
 #include "PLDHashTable.h"
-#include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 
 #include "mozilla/LinkedList.h"
+#include "mozilla/UniquePtr.h"
 
 namespace mozilla {
 namespace dom {
 class BrowserBridgeChild;
 }  // namespace dom
 }  // namespace mozilla
 
 /****************************************************************************
@@ -278,17 +278,17 @@ class nsDocLoader : public nsIDocumentLo
       return static_cast<nsIRequest*>(const_cast<void*>(mKey));
     }
 
     const void* mKey;  // Must be first for the PLDHashTable stubs to work
     int64_t mCurrentProgress;
     int64_t mMaxProgress;
     bool mUploading;
 
-    nsAutoPtr<nsStatusInfo> mLastStatus;
+    mozilla::UniquePtr<nsStatusInfo> mLastStatus;
   };
 
   static void RequestInfoHashInitEntry(PLDHashEntryHdr* entry, const void* key);
   static void RequestInfoHashClearEntry(PLDHashTable* table,
                                         PLDHashEntryHdr* entry);
 
   // IMPORTANT: The ownership implicit in the following member
   // variables has been explicitly checked and set using nsCOMPtr
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sts=2 sw=2 et cin: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsURILoader.h"
-#include "nsAutoPtr.h"
 #include "nsIURIContentListener.h"
 #include "nsIContentHandler.h"
 #include "nsILoadGroup.h"
 #include "nsIDocumentLoader.h"
 #include "nsIStreamListener.h"
 #include "nsIURI.h"
 #include "nsIChannel.h"
 #include "nsIInterfaceRequestor.h"
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -36,17 +36,16 @@
 #include "nsILoadGroup.h"
 #include "nsIWebProgressListener.h"
 #include "nsITransfer.h"
 #include "nsReadableUtils.h"
 #include "nsIRequest.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsThreadUtils.h"
-#include "nsAutoPtr.h"
 #include "nsIMutableArray.h"
 #include "nsIRedirectHistoryEntry.h"
 #include "nsOSHelperAppService.h"
 #include "nsOSHelperAppServiceChild.h"
 
 // used to access our datastore of user-configured helper applications
 #include "nsIHandlerService.h"
 #include "nsIMIMEInfo.h"
--- a/uriloader/exthandler/nsExternalHelperAppService.h
+++ b/uriloader/exthandler/nsExternalHelperAppService.h
@@ -24,17 +24,16 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIChannel.h"
 #include "nsIBackgroundFileSaver.h"
 
 #include "nsCOMPtr.h"
 #include "nsIObserver.h"
 #include "nsCOMArray.h"
 #include "nsWeakReference.h"
-#include "nsAutoPtr.h"
 #include "mozilla/Attributes.h"
 
 class nsExternalAppHandler;
 class nsIMIMEInfo;
 class nsITransfer;
 class MaybeCloseWindowHelper;
 
 /**
--- a/uriloader/exthandler/unix/nsGNOMERegistry.cpp
+++ b/uriloader/exthandler/unix/nsGNOMERegistry.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsGNOMERegistry.h"
 #include "nsString.h"
 #include "nsMIMEInfoUnix.h"
-#include "nsAutoPtr.h"
 #include "nsIGIOService.h"
 
 /* static */
 bool nsGNOMERegistry::HandlerExists(const char* aProtocolScheme) {
   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
   if (!giovfs) {
     return false;
   }
--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
@@ -4,17 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsMIMEInfoUnix.h"
 #include "nsGNOMERegistry.h"
 #include "nsIGIOService.h"
 #include "nsNetCID.h"
 #include "nsIIOService.h"
-#include "nsAutoPtr.h"
 #ifdef MOZ_ENABLE_DBUS
 #  include "nsDBusHandlerApp.h"
 #endif
 
 nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI* aURI) {
   return nsGNOMERegistry::LoadURL(aURI);
 }
 
--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
@@ -23,17 +23,16 @@
 #include "nsNetCID.h"
 #include "nsXPCOM.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCRT.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "ContentHandlerService.h"
 #include "prenv.h"  // for PR_GetEnv()
-#include "nsAutoPtr.h"
 #include "mozilla/Preferences.h"
 #include "nsMimeTypes.h"
 
 using namespace mozilla;
 
 #define LOG(args) MOZ_LOG(mLog, mozilla::LogLevel::Debug, args)
 #define LOG_ENABLED() MOZ_LOG_TEST(mLog, mozilla::LogLevel::Debug)
 
--- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp
+++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp
@@ -6,17 +6,16 @@
 
 #include "nsArrayEnumerator.h"
 #include "nsCOMArray.h"
 #include "nsLocalFile.h"
 #include "nsMIMEInfoWin.h"
 #include "nsNetUtil.h"
 #include <windows.h>
 #include <shellapi.h>
-#include "nsAutoPtr.h"
 #include "nsIMutableArray.h"
 #include "nsTArray.h"
 #include "shlobj.h"
 #include "windows.h"
 #include "nsIWindowsRegKey.h"
 #include "nsUnicharUtils.h"
 #include "nsITextToSubURI.h"
 #include "nsVariant.h"
--- a/uriloader/exthandler/win/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp
@@ -8,17 +8,16 @@
 #include "nsComponentManagerUtils.h"
 #include "nsOSHelperAppService.h"
 #include "nsISupports.h"
 #include "nsString.h"
 #include "nsIMIMEInfo.h"
 #include "nsMIMEInfoWin.h"
 #include "nsMimeTypes.h"
 #include "plstr.h"
-#include "nsAutoPtr.h"
 #include "nsNativeCharsetUtils.h"
 #include "nsLocalFile.h"
 #include "nsIWindowsRegKey.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/UniquePtrExtensions.h"
 #include "mozilla/WindowsVersion.h"
 
 // shellapi.h is needed to build with WIN32_LEAN_AND_MEAN
--- a/uriloader/prefetch/OfflineCacheUpdateGlue.h
+++ b/uriloader/prefetch/OfflineCacheUpdateGlue.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsOfflineCacheUpdateGlue_h
 #define nsOfflineCacheUpdateGlue_h
 
 #include "nsIOfflineCacheUpdate.h"
 
 #include "nsCOMPtr.h"
-#include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsWeakReference.h"
 #include "mozilla/Attributes.h"
 
 class nsOfflineCacheUpdate;
 
 namespace mozilla {
 namespace dom {
--- a/uriloader/prefetch/nsOfflineCacheUpdate.h
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.h
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsOfflineCacheUpdate_h__
 #define nsOfflineCacheUpdate_h__
 
 #include "nsIOfflineCacheUpdate.h"
 
-#include "nsAutoPtr.h"
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsIChannelEventSink.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIMutableArray.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIApplicationCache.h"
--- a/uriloader/prefetch/nsPrefetchService.cpp
+++ b/uriloader/prefetch/nsPrefetchService.cpp
@@ -20,17 +20,16 @@
 #include "nsICacheInfoChannel.h"
 #include "nsIHttpChannel.h"
 #include "nsIURL.h"
 #include "nsISupportsPriority.h"
 #include "nsNetUtil.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsStreamUtils.h"
-#include "nsAutoPtr.h"
 #include "prtime.h"
 #include "mozilla/Logging.h"
 #include "plstr.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsINode.h"
 #include "mozilla/dom/Document.h"
 #include "nsContentUtils.h"
 #include "nsStyleLinkElement.h"
--- a/uriloader/prefetch/nsPrefetchService.h
+++ b/uriloader/prefetch/nsPrefetchService.h
@@ -11,17 +11,16 @@
 #include "nsIPrefetchService.h"
 #include "nsIRedirectResultListener.h"
 #include "nsIWebProgressListener.h"
 #include "nsIStreamListener.h"
 #include "nsIChannel.h"
 #include "nsIURI.h"
 #include "nsWeakReference.h"
 #include "nsCOMPtr.h"
-#include "nsAutoPtr.h"
 #include "mozilla/Attributes.h"
 #include <deque>
 
 class nsPrefetchService;
 class nsPrefetchNode;
 class nsIReferrerInfo;
 
 //-----------------------------------------------------------------------------