Bug 1600283 - Remove uses of already_AddRefed. r=#dom-workers-and-storage draft
authorSimon Giesecke <sgiesecke@mozilla.com>
Wed, 04 Dec 2019 16:48:32 +0000
changeset 2515985 bd490b16cb0385ef82c95556f7c59f8a6c64f4e8
parent 2515984 b79ce67a166a8f2bf6bc760576613e676da923b5
child 2515986 8e4ca40f650a5ce382ef3aaf7f3d7934ee456686
push id460090
push userreviewbot
push dateWed, 04 Dec 2019 16:51:29 +0000
treeherdertry@35d310cdd9cf [default view] [failures only]
bugs1600283
milestone73.0a1
Bug 1600283 - Remove uses of already_AddRefed. r=#dom-workers-and-storage Differential Revision: https://phabricator.services.mozilla.com/D55488 Differential Diff: PHID-DIFF-bag6ugstnpa3mydwuomq
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -6531,19 +6531,19 @@ class VersionChangeTransaction final
       PBackgroundIDBCursorParent* aActor) override;
 };
 
 class MutableFile : public BackgroundMutableFileParentBase {
   RefPtr<Database> mDatabase;
   RefPtr<FileInfo> mFileInfo;
 
  public:
-  static already_AddRefed<MutableFile> Create(nsIFile* aFile,
-                                              Database* aDatabase,
-                                              FileInfo* aFileInfo);
+  static MOZ_MUST_USE RefPtr<MutableFile> Create(nsIFile* aFile,
+                                                 Database* aDatabase,
+                                                 FileInfo* aFileInfo);
 
   Database* GetDatabase() const {
     AssertIsOnBackgroundThread();
     MOZ_ASSERT(mDatabase);
 
     return mDatabase;
   }
 
@@ -19446,29 +19446,28 @@ MutableFile::MutableFile(nsIFile* aFile,
       mFileInfo(aFileInfo) {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aDatabase);
   MOZ_ASSERT(aFileInfo);
 }
 
 MutableFile::~MutableFile() { mDatabase->UnregisterMutableFile(this); }
 
-already_AddRefed<MutableFile> MutableFile::Create(nsIFile* aFile,
-                                                  Database* aDatabase,
-                                                  FileInfo* aFileInfo) {
+RefPtr<MutableFile> MutableFile::Create(nsIFile* aFile, Database* aDatabase,
+                                        FileInfo* aFileInfo) {
   AssertIsOnBackgroundThread();
 
   RefPtr<MutableFile> newMutableFile =
       new MutableFile(aFile, aDatabase, aFileInfo);
 
   if (!aDatabase->RegisterMutableFile(newMutableFile)) {
     return nullptr;
   }
 
-  return newMutableFile.forget();
+  return newMutableFile;
 }
 
 void MutableFile::NoteActiveState() {
   AssertIsOnBackgroundThread();
 
   mDatabase->NoteActiveMutableFile();
 }
 
@@ -19483,17 +19482,17 @@ PBackgroundParent* MutableFile::GetBackg
   MOZ_ASSERT(!IsActorDestroyed());
 
   return GetDatabase()->GetBackgroundParent();
 }
 
 already_AddRefed<nsISupports> MutableFile::CreateStream(bool aReadOnly) {
   AssertIsOnBackgroundThread();
 
-  PersistenceType persistenceType = mDatabase->Type();
+  const PersistenceType persistenceType = mDatabase->Type();
   const nsACString& group = mDatabase->Group();
   const nsACString& origin = mDatabase->Origin();
 
   nsCOMPtr<nsISupports> result;
 
   if (aReadOnly) {
     RefPtr<FileInputStream> stream =
         CreateFileInputStream(persistenceType, group, origin, Client::IDB,
@@ -19510,17 +19509,17 @@ already_AddRefed<nsISupports> MutableFil
   }
 
   return result.forget();
 }
 
 already_AddRefed<BlobImpl> MutableFile::CreateBlobImpl() {
   AssertIsOnBackgroundThread();
 
-  RefPtr<FileBlobImpl> blobImpl = new FileBlobImpl(mFile);
+  auto blobImpl = MakeRefPtr<FileBlobImpl>(mFile);
   blobImpl->SetFileId(mFileInfo->Id());
 
   return blobImpl.forget();
 }
 
 PBackgroundFileHandleParent* MutableFile::AllocPBackgroundFileHandleParent(
     const FileMode& aMode) {
   AssertIsOnBackgroundThread();