Bug 1470420: Change an nsAutoPtr to UniquePtr in the Loader. r?xidorn
MozReview-Commit-ID: 4KnjxHOybmG
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -927,17 +927,17 @@ Loader::CreateSheet(nsIURI* aURI,
bool aSyncLoad,
StyleSheetState& aSheetState,
RefPtr<StyleSheet>* aSheet)
{
LOG(("css::Loader::CreateSheet"));
MOZ_ASSERT(aSheet, "Null out param!");
if (!mSheets) {
- mSheets = new Sheets();
+ mSheets = MakeUnique<Sheets>();
}
*aSheet = nullptr;
aSheetState = eSheetStateUnknown;
if (aURI) {
aSheetState = eSheetComplete;
RefPtr<StyleSheet> sheet;
--- a/layout/style/Loader.h
+++ b/layout/style/Loader.h
@@ -5,32 +5,32 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* loading of CSS style sheets using the network APIs */
#ifndef mozilla_css_Loader_h
#define mozilla_css_Loader_h
#include "nsIPrincipal.h"
-#include "nsAutoPtr.h"
#include "nsCompatibility.h"
#include "nsCycleCollectionParticipant.h"
#include "nsDataHashtable.h"
#include "nsRefPtrHashtable.h"
#include "nsStringFwd.h"
#include "nsTArray.h"
#include "nsTObserverArray.h"
#include "nsURIHashKey.h"
#include "nsIStyleSheetLinkingElement.h"
#include "mozilla/Attributes.h"
#include "mozilla/CORSMode.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StyleSheet.h"
+#include "mozilla/UniquePtr.h"
#include "mozilla/net/ReferrerPolicy.h"
class nsICSSLoaderObserver;
class nsIConsoleReportCollector;
class nsIContent;
class nsIDocument;
namespace mozilla {
@@ -584,17 +584,17 @@ private:
nsBaseHashtable<URIPrincipalReferrerPolicyAndCORSModeHashKey,
RefPtr<StyleSheet>,
StyleSheet*> mCompleteSheets;
nsDataHashtable<URIPrincipalReferrerPolicyAndCORSModeHashKey, SheetLoadData*>
mLoadingDatas; // weak refs
nsDataHashtable<URIPrincipalReferrerPolicyAndCORSModeHashKey, SheetLoadData*>
mPendingDatas; // weak refs
};
- nsAutoPtr<Sheets> mSheets;
+ UniquePtr<Sheets> mSheets;
// The array of posted stylesheet loaded events (SheetLoadDatas) we have.
// Note that these are rare.
LoadDataArray mPostedEvents;
// Our array of "global" observers
nsTObserverArray<nsCOMPtr<nsICSSLoaderObserver> > mObservers;