Bug 1600283 - Remove uses of plain pointers. r=#dom-workers-and-storage draft
authorSimon Giesecke <sgiesecke@mozilla.com>
Wed, 04 Dec 2019 16:50:03 +0000
changeset 2516003 db838c27cf2b26351710671c6b44f49f45ac635c
parent 2516002 ed3d43b1b88aad10373376230a507a8d7b6d9835
child 2516004 909f76910b6e7542d2146bc3b903443cd96ed30b
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 plain pointers. r=#dom-workers-and-storage Differential Revision: https://phabricator.services.mozilla.com/D55508 Differential Diff: PHID-DIFF-kwe2sceatgdvxq4225t7
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -5013,17 +5013,17 @@ class ConnectionPool final {
  public:
   ConnectionPool();
 
   void AssertIsOnOwningThread() const {
     NS_ASSERT_OWNINGTHREAD(ConnectionPool);
   }
 
   nsresult GetOrCreateConnection(const Database* aDatabase,
-                                 DatabaseConnection** aConnection);
+                                 RefPtr<DatabaseConnection>* aConnection);
 
   uint64_t Start(const nsID& aBackgroundChildLoggingId,
                  const nsACString& aDatabaseId, int64_t aLoggingSerialNumber,
                  const nsTArray<nsString>& aObjectStoreNames,
                  bool aIsWriteTransaction,
                  TransactionDatabaseOperationBase* aTransactionOp);
 
   void Dispatch(uint64_t aTransactionId, nsIRunnable* aRunnable);
@@ -11159,17 +11159,17 @@ void ConnectionPool::IdleTimerCallback(n
   if (index) {
     self->mIdleThreads.RemoveElementsAt(0, index);
   }
 
   self->AdjustIdleTimer();
 }
 
 nsresult ConnectionPool::GetOrCreateConnection(
-    const Database* aDatabase, DatabaseConnection** aConnection) {
+    const Database* aDatabase, RefPtr<DatabaseConnection>* aConnection) {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aDatabase);
 
   AUTO_PROFILER_LABEL("ConnectionPool::GetOrCreateConnection", DOM);
 
   DatabaseInfo* dbInfo;
   {
@@ -11208,17 +11208,17 @@ nsresult ConnectionPool::GetOrCreateConn
 
 #ifdef DEBUG
     dbInfo->mDEBUGConnectionThread = GetCurrentPhysicalThread();
 #endif
   }
 
   dbInfo->AssertIsOnConnectionThread();
 
-  connection.forget(aConnection);
+  *aConnection = std::move(connection);
   return NS_OK;
 }
 
 uint64_t ConnectionPool::Start(
     const nsID& aBackgroundChildLoggingId, const nsACString& aDatabaseId,
     int64_t aLoggingSerialNumber, const nsTArray<nsString>& aObjectStoreNames,
     bool aIsWriteTransaction,
     TransactionDatabaseOperationBase* aTransactionOp) {
@@ -12973,18 +12973,17 @@ void Database::Invalidate() {
 
 nsresult Database::EnsureConnection() {
   MOZ_ASSERT(!NS_IsMainThread());
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   AUTO_PROFILER_LABEL("Database::EnsureConnection", DOM);
 
   if (!mConnection || !mConnection->GetStorageConnection()) {
-    nsresult rv = gConnectionPool->GetOrCreateConnection(
-        this, getter_AddRefs(mConnection));
+    nsresult rv = gConnectionPool->GetOrCreateConnection(this, &mConnection);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   AssertIsOnConnectionThread();
 
   return NS_OK;