Bug 1600283 - Remove uses of already_AddRefed. r=dom-workers-and-storage-reviewers,janv
authorSimon Giesecke <sgiesecke@mozilla.com>
Mon, 16 Dec 2019 13:19:24 +0000
changeset 507118 ea17496f741b04193f15b7e14bcddbe5ae64dae9
parent 507117 cb0d23d69fd2cb96dedba0db099ed80eb62081db
child 507119 aa02e93402e01025296051964250b2dcc0486312
push id103275
push usersgiesecke@mozilla.com
push dateMon, 16 Dec 2019 13:25:58 +0000
treeherderautoland@ea17496f741b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdom-workers-and-storage-reviewers, janv
bugs1600283
milestone73.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 1600283 - Remove uses of already_AddRefed. r=dom-workers-and-storage-reviewers,janv Differential Revision: https://phabricator.services.mozilla.com/D55490
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -4849,17 +4849,17 @@ class DatabaseConnection::CachedStatemen
 
   mozIStorageStatement* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN;
 
   void Reset();
 
  private:
   // Only called by DatabaseConnection.
   void Assign(DatabaseConnection* aConnection,
-              already_AddRefed<mozIStorageStatement> aStatement);
+              nsCOMPtr<mozIStorageStatement> aStatement);
 
   // No funny business allowed.
   CachedStatement(const CachedStatement&) = delete;
   CachedStatement& operator=(const CachedStatement&) = delete;
 };
 
 class DatabaseConnection::UpdateRefcountFunction final
     : public mozIStorageFunction {
@@ -5708,30 +5708,30 @@ class TransactionDatabaseOperationBase :
 class Factory final : public PBackgroundIDBFactoryParent {
   RefPtr<DatabaseLoggingInfo> mLoggingInfo;
 
 #ifdef DEBUG
   bool mActorDestroyed;
 #endif
 
  public:
-  static already_AddRefed<Factory> Create(const LoggingInfo& aLoggingInfo);
+  static MOZ_MUST_USE RefPtr<Factory> Create(const LoggingInfo& aLoggingInfo);
 
   DatabaseLoggingInfo* GetLoggingInfo() const {
     AssertIsOnBackgroundThread();
     MOZ_ASSERT(mLoggingInfo);
 
     return mLoggingInfo;
   }
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(mozilla::dom::indexedDB::Factory)
 
  private:
   // Only constructed in Create().
-  explicit Factory(already_AddRefed<DatabaseLoggingInfo> aLoggingInfo);
+  explicit Factory(RefPtr<DatabaseLoggingInfo> aLoggingInfo);
 
   // Reference counted.
   ~Factory() override;
 
   // IPDL methods are only called by IPDL.
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
   mozilla::ipc::IPCResult RecvDeleteMe() override;
@@ -9850,17 +9850,17 @@ nsresult DatabaseConnection::GetCachedSt
       NS_WARNING(error.get());
 #endif
       return rv;
     }
 
     mCachedStatements.Put(aQuery, stmt);
   }
 
-  aCachedStatement->Assign(this, stmt.forget());
+  aCachedStatement->Assign(this, std::move(stmt));
   return NS_OK;
 }
 
 template <typename BindFunctor>
 nsresult DatabaseConnection::ExecuteCachedStatement(
     const nsACString& aQuery, const BindFunctor& aBindFunctor) {
   CachedStatement stmt;
   nsresult rv = GetCachedStatement(aQuery, &stmt);
@@ -10509,29 +10509,29 @@ void DatabaseConnection::CachedStatement
   if (mStatement) {
     mScoper.reset();
     mScoper.emplace(mStatement);
   }
 }
 
 void DatabaseConnection::CachedStatement::Assign(
     DatabaseConnection* aConnection,
-    already_AddRefed<mozIStorageStatement> aStatement) {
+    nsCOMPtr<mozIStorageStatement> aStatement) {
 #ifdef DEBUG
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT_IF(mDEBUGConnection, mDEBUGConnection == aConnection);
 
   mDEBUGConnection = aConnection;
 #endif
   AssertIsOnConnectionThread();
 
   mScoper.reset();
 
-  mStatement = aStatement;
+  mStatement = std::move(aStatement);
 
   if (mStatement) {
     mScoper.emplace(mStatement);
   }
 }
 
 DatabaseConnection::AutoSavepoint::AutoSavepoint()
     : mConnection(nullptr)
@@ -12563,31 +12563,31 @@ DatabaseLoggingInfo::~DatabaseLoggingInf
     gLoggingInfoHashtable->Remove(backgroundChildLoggingId);
   }
 }
 
 /*******************************************************************************
  * Factory
  ******************************************************************************/
 
-Factory::Factory(already_AddRefed<DatabaseLoggingInfo> aLoggingInfo)
+Factory::Factory(RefPtr<DatabaseLoggingInfo> aLoggingInfo)
     : mLoggingInfo(std::move(aLoggingInfo))
 #ifdef DEBUG
       ,
       mActorDestroyed(false)
 #endif
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!QuotaClient::IsShuttingDownOnBackgroundThread());
 }
 
 Factory::~Factory() { MOZ_ASSERT(mActorDestroyed); }
 
 // static
-already_AddRefed<Factory> Factory::Create(const LoggingInfo& aLoggingInfo) {
+RefPtr<Factory> Factory::Create(const LoggingInfo& aLoggingInfo) {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!QuotaClient::IsShuttingDownOnBackgroundThread());
 
   // Balanced in ActoryDestroy().
   IncreaseBusyCount();
 
   MOZ_ASSERT(gLoggingInfoHashtable);
   RefPtr<DatabaseLoggingInfo> loggingInfo =
@@ -12610,17 +12610,17 @@ already_AddRefed<Factory> Factory::Creat
         "NextRequestSerialNumber doesn't match!");
 #endif  // !DISABLE_ASSERTS_FOR_FUZZING
   } else {
     loggingInfo = new DatabaseLoggingInfo(aLoggingInfo);
     gLoggingInfoHashtable->Put(aLoggingInfo.backgroundChildLoggingId(),
                                loggingInfo);
   }
 
-  return RefPtr<Factory>(new Factory(loggingInfo.forget())).forget();
+  return new Factory(std::move(loggingInfo));
 }
 
 void Factory::ActorDestroy(ActorDestroyReason aWhy) {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!mActorDestroyed);
 
 #ifdef DEBUG
   mActorDestroyed = true;