Bug 1633719 - Use *InitializedOnce* with NotNull instead of *InitializedOnce*NotNull for pointers. r=dom-workers-and-storage-reviewers,janv
authorSimon Giesecke <sgiesecke@mozilla.com>
Thu, 14 May 2020 09:14:04 +0000
changeset 593592 5f5964262d18844fcd64f2730f36e230bda18a41
parent 593591 b8ac0007a2d7729a58b7ba9f03a1fc34ab486ef7
child 593593 fddd01727ad2f5c097b4d750bba958d0cdfc1340
push id13186
push userffxbld-merge
push dateMon, 01 Jun 2020 09:52:46 +0000
treeherdermozilla-beta@3e7c70a1e4a1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdom-workers-and-storage-reviewers, janv
bugs1633719
milestone78.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 1633719 - Use *InitializedOnce* with NotNull instead of *InitializedOnce*NotNull for pointers. r=dom-workers-and-storage-reviewers,janv Differential Revision: https://phabricator.services.mozilla.com/D73025
dom/indexedDB/ActorsChild.cpp
dom/indexedDB/ActorsChild.h
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/IDBCursor.cpp
dom/indexedDB/IDBCursor.h
--- a/dom/indexedDB/ActorsChild.cpp
+++ b/dom/indexedDB/ActorsChild.cpp
@@ -3123,29 +3123,29 @@ BackgroundRequestChild::PreprocessHelper
 }
 
 /*******************************************************************************
  * BackgroundCursorChild
  ******************************************************************************/
 
 BackgroundCursorChildBase::BackgroundCursorChildBase(IDBRequest* const aRequest,
                                                      const Direction aDirection)
-    : mRequest(aRequest),
+    : mRequest(WrapNotNull(aRequest)),
       mTransaction(aRequest->MaybeTransactionRef()),
       mStrongRequest(aRequest),
       mDirection(aDirection) {
   MOZ_ASSERT(mTransaction);
 }
 
 template <IDBCursorType CursorType>
 BackgroundCursorChild<CursorType>::BackgroundCursorChild(IDBRequest* aRequest,
                                                          SourceType* aSource,
                                                          Direction aDirection)
     : BackgroundCursorChildBase(aRequest, aDirection),
-      mSource(aSource),
+      mSource(WrapNotNull(aSource)),
       mCursor(nullptr),
       mInFlightResponseInvalidationNeeded(false) {
   aSource->AssertIsOnOwningThread();
 
   MOZ_COUNT_CTOR(indexedDB::BackgroundCursorChild<CursorType>);
 }
 
 template <IDBCursorType CursorType>
--- a/dom/indexedDB/ActorsChild.h
+++ b/dom/indexedDB/ActorsChild.h
@@ -635,17 +635,17 @@ struct CloneInfo {
   RefPtr<BackgroundRequestChild::PreprocessHelper> mPreprocessHelper;
   UniquePtr<JSStructuredCloneData> mCloneData;
 };
 
 class BackgroundCursorChildBase : public PBackgroundIDBCursorChild {
  private:
   NS_DECL_OWNINGTHREAD
  protected:
-  InitializedOnceNotNull<IDBRequest* const> mRequest;
+  InitializedOnce<const NotNull<IDBRequest*>> mRequest;
   Maybe<IDBTransaction&> mTransaction;
 
   // These are only set while a request is in progress.
   RefPtr<IDBRequest> mStrongRequest;
   RefPtr<IDBCursor> mStrongCursor;
 
   const Direction mDirection;
 
@@ -680,17 +680,17 @@ class BackgroundCursorChild final : publ
  public:
   using SourceType = CursorSourceType<CursorType>;
   using ResponseType = typename CursorTypeTraits<CursorType>::ResponseType;
 
  private:
   friend class BackgroundTransactionChild;
   friend class BackgroundVersionChangeTransactionChild;
 
-  InitializedOnceNotNull<SourceType* const> mSource;
+  InitializedOnce<const NotNull<SourceType*>> mSource;
   IDBCursorImpl<CursorType>* mCursor;
 
   std::deque<CursorData<CursorType>> mCachedResponses, mDelayedResponses;
   bool mInFlightResponseInvalidationNeeded;
 
  public:
   BackgroundCursorChild(IDBRequest* aRequest, SourceType* aSource,
                         Direction aDirection);
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -4655,19 +4655,19 @@ class DatabaseConnection final {
   enum class CheckpointMode { Full, Restart, Truncate };
 
  public:
   class AutoSavepoint;
   class CachedStatement;
   class UpdateRefcountFunction;
 
  private:
-  InitializedOnceNotNull<const nsCOMPtr<mozIStorageConnection>>
+  InitializedOnce<const NotNull<nsCOMPtr<mozIStorageConnection>>>
       mStorageConnection;
-  InitializedOnceNotNull<const SafeRefPtr<FileManager>> mFileManager;
+  InitializedOnce<const NotNull<SafeRefPtr<FileManager>>> mFileManager;
   nsInterfaceHashtable<nsCStringHashKey, mozIStorageStatement>
       mCachedStatements;
   RefPtr<UpdateRefcountFunction> mUpdateRefcountFunction;
   RefPtr<QuotaObject> mQuotaObject;
   RefPtr<QuotaObject> mJournalQuotaObject;
   bool mInReadTransaction;
   bool mInWriteTransaction;
 
@@ -4962,17 +4962,17 @@ class ConnectionPool final {
 
    protected:
     explicit IdleResource(const TimeStamp& aIdleTime);
 
     ~IdleResource();
   };
 
   struct IdleDatabaseInfo final : public IdleResource {
-    InitializedOnceNotNull<DatabaseInfo* const> mDatabaseInfo;
+    InitializedOnce<const NotNull<DatabaseInfo*>> mDatabaseInfo;
 
    public:
     explicit IdleDatabaseInfo(DatabaseInfo* aDatabaseInfo);
 
     IdleDatabaseInfo(const IdleDatabaseInfo& aOther) = delete;
     IdleDatabaseInfo(IdleDatabaseInfo&& aOther) noexcept
         : IdleResource(std::move(aOther)),
           mDatabaseInfo{std::move(aOther.mDatabaseInfo)} {
@@ -5614,17 +5614,17 @@ class TransactionDatabaseOperationBase :
     Initial,
     DatabaseWork,
     SendingPreprocess,
     WaitingForContinue,
     SendingResults,
     Completed
   };
 
-  InitializedOnceNotNull<const SafeRefPtr<TransactionBase>> mTransaction;
+  InitializedOnce<const NotNull<SafeRefPtr<TransactionBase>>> mTransaction;
   InternalState mInternalState = InternalState::Initial;
   bool mWaitingForContinue = false;
   const bool mTransactionIsAborted;
 
  protected:
   const int64_t mTransactionLoggingSerialNumber;
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
@@ -7385,17 +7385,17 @@ class NormalTransactionOp : public Trans
 };
 
 class ObjectStoreAddOrPutRequestOp final : public NormalTransactionOp {
   friend class TransactionBase;
 
   typedef mozilla::dom::quota::PersistenceType PersistenceType;
 
   class StoredFileInfo final {
-    InitializedOnceNotNull<const SafeRefPtr<FileInfo>> mFileInfo;
+    InitializedOnce<const NotNull<SafeRefPtr<FileInfo>>> mFileInfo;
     // Either nothing, a file actor or a non-Blob-backed inputstream to write to
     // disk.
     using FileActorOrInputStream =
         Variant<Nothing, RefPtr<DatabaseFile>, nsCOMPtr<nsIInputStream>>;
     InitializedOnce<const FileActorOrInputStream> mFileActorOrInputStream;
 #ifdef DEBUG
     const StructuredCloneFileBase::FileType mType;
 #endif
@@ -7527,47 +7527,47 @@ void ObjectStoreAddOrPutRequestOp::Store
     // and storedFileInfo.mFileActorOrInputStream is Nothing.
     MOZ_ASSERT_IF(StructuredCloneFileBase::eMutableFile == mType,
                   mFileActorOrInputStream->is<Nothing>());
   }
 }
 
 ObjectStoreAddOrPutRequestOp::StoredFileInfo::StoredFileInfo(
     SafeRefPtr<FileInfo> aFileInfo)
-    : mFileInfo{std::move(aFileInfo)}, mFileActorOrInputStream {
+    : mFileInfo{WrapNotNull(std::move(aFileInfo))}, mFileActorOrInputStream {
   Nothing {}
 }
 #ifdef DEBUG
 , mType { StructuredCloneFileBase::eMutableFile }
 #endif
 {
   AssertIsOnBackgroundThread();
   AssertInvariants();
 
   MOZ_COUNT_CTOR(ObjectStoreAddOrPutRequestOp::StoredFileInfo);
 }
 
 ObjectStoreAddOrPutRequestOp::StoredFileInfo::StoredFileInfo(
     SafeRefPtr<FileInfo> aFileInfo, RefPtr<DatabaseFile> aFileActor)
-    : mFileInfo{std::move(aFileInfo)}, mFileActorOrInputStream {
+    : mFileInfo{WrapNotNull(std::move(aFileInfo))}, mFileActorOrInputStream {
   std::move(aFileActor)
 }
 #ifdef DEBUG
 , mType { StructuredCloneFileBase::eBlob }
 #endif
 {
   AssertIsOnBackgroundThread();
   AssertInvariants();
 
   MOZ_COUNT_CTOR(ObjectStoreAddOrPutRequestOp::StoredFileInfo);
 }
 
 ObjectStoreAddOrPutRequestOp::StoredFileInfo::StoredFileInfo(
     SafeRefPtr<FileInfo> aFileInfo, nsCOMPtr<nsIInputStream> aInputStream)
-    : mFileInfo{std::move(aFileInfo)}, mFileActorOrInputStream {
+    : mFileInfo{WrapNotNull(std::move(aFileInfo))}, mFileActorOrInputStream {
   std::move(aInputStream)
 }
 #ifdef DEBUG
 , mType { StructuredCloneFileBase::eStructuredClone }
 #endif
 {
   AssertIsOnBackgroundThread();
   AssertInvariants();
@@ -7942,17 +7942,17 @@ class CursorBase : public PBackgroundIDB
   friend class CommonOpenOpHelper;
 
  protected:
   const SafeRefPtr<TransactionBase> mTransaction;
 
   // This should only be touched on the PBackground thread to check whether
   // the objectStore has been deleted. Holding these saves a hash lookup for
   // every call to continue()/advance().
-  InitializedOnceNotNull<const RefPtr<FullObjectStoreMetadata>>
+  InitializedOnce<const NotNull<RefPtr<FullObjectStoreMetadata>>>
       mObjectStoreMetadata;
 
   const IndexOrObjectStoreId mObjectStoreId;
 
   LazyInitializedOnce<const Key>
       mLocaleAwareRangeBound;  ///< If the cursor is based on a key range, the
                                ///< bound in the direction of iteration (e.g.
                                ///< the upper bound in case of mDirection ==
@@ -7990,28 +7990,28 @@ class IndexCursorBase : public CursorBas
 
   IndexCursorBase(SafeRefPtr<TransactionBase> aTransaction,
                   RefPtr<FullObjectStoreMetadata> aObjectStoreMetadata,
                   RefPtr<FullIndexMetadata> aIndexMetadata,
                   Direction aDirection,
                   ConstructFromTransactionBase aConstructionTag)
       : CursorBase{std::move(aTransaction), std::move(aObjectStoreMetadata),
                    aDirection, aConstructionTag},
-        mIndexMetadata(std::move(aIndexMetadata)),
+        mIndexMetadata(WrapNotNull(std::move(aIndexMetadata))),
         mIndexId((*mIndexMetadata)->mCommonMetadata.id()),
         mUniqueIndex((*mIndexMetadata)->mCommonMetadata.unique()),
         mLocale((*mIndexMetadata)->mCommonMetadata.locale()) {}
 
  protected:
   IndexOrObjectStoreId Id() const { return mIndexId; }
 
   // This should only be touched on the PBackground thread to check whether
   // the index has been deleted. Holding these saves a hash lookup for every
   // call to continue()/advance().
-  InitializedOnceNotNull<const RefPtr<FullIndexMetadata>> mIndexMetadata;
+  InitializedOnce<const NotNull<RefPtr<FullIndexMetadata>>> mIndexMetadata;
   const IndexOrObjectStoreId mIndexId;
   const bool mUniqueIndex;
   const nsCString
       mLocale;  ///< The locale if the cursor is locale-aware, otherwise empty.
 
   struct ContinueQueries {
     nsCString mContinueQuery;
     nsCString mContinueToQuery;
@@ -8063,29 +8063,29 @@ using FilesArrayT =
 class ValueCursorBase {
   friend struct ValuePopulateResponseHelper<true>;
   friend struct ValuePopulateResponseHelper<false>;
 
  protected:
   explicit ValueCursorBase(TransactionBase* const aTransaction)
       : mDatabase(aTransaction->GetDatabasePtr()),
         mFileManager(mDatabase->GetFileManagerPtr()),
-        mBackgroundParent(aTransaction->GetBackgroundParent()) {
+        mBackgroundParent(WrapNotNull(aTransaction->GetBackgroundParent())) {
     MOZ_ASSERT(mDatabase);
     MOZ_ASSERT(mFileManager);
   }
 
   void ProcessFiles(CursorResponse& aResponse, const FilesArray& aFiles);
 
   ~ValueCursorBase() { MOZ_ASSERT(!mBackgroundParent); }
 
   const SafeRefPtr<Database> mDatabase;
   const SafeRefPtr<FileManager> mFileManager;
 
-  InitializedOnceNotNull<PBackgroundParent* const> mBackgroundParent;
+  InitializedOnce<const NotNull<PBackgroundParent*>> mBackgroundParent;
 };
 
 class KeyCursorBase {
  protected:
   explicit KeyCursorBase(TransactionBase* const /*aTransaction*/) {}
 
   static constexpr void ProcessFiles(CursorResponse& aResponse,
                                      const PseudoFilesArray& aFiles) {}
@@ -9070,21 +9070,21 @@ class DEBUGThreadSlower final : public n
  ******************************************************************************/
 
 // XXX Get rid of FileHelper and move the functions into FileManager.
 // Then, FileManager::Get(Journal)Directory and FileManager::GetFileForId might
 // eventually be made private.
 class MOZ_STACK_CLASS FileHelper final {
   const SafeRefPtr<FileManager> mFileManager;
 
-  LazyInitializedOnceNotNull<const nsCOMPtr<nsIFile>> mFileDirectory;
-  LazyInitializedOnceNotNull<const nsCOMPtr<nsIFile>> mJournalDirectory;
+  LazyInitializedOnce<const NotNull<nsCOMPtr<nsIFile>>> mFileDirectory;
+  LazyInitializedOnce<const NotNull<nsCOMPtr<nsIFile>>> mJournalDirectory;
 
   class ReadCallback;
-  LazyInitializedOnceNotNull<const RefPtr<ReadCallback>> mReadCallback;
+  LazyInitializedOnce<const NotNull<RefPtr<ReadCallback>>> mReadCallback;
 
  public:
   explicit FileHelper(SafeRefPtr<FileManager>&& aFileManager)
       : mFileManager(std::move(aFileManager)) {
     MOZ_ASSERT(mFileManager);
   }
 
   nsresult Init();
@@ -10675,18 +10675,18 @@ nsresult FileManager::AsyncDeleteFile(in
 
 /*******************************************************************************
  * DatabaseConnection implementation
  ******************************************************************************/
 
 DatabaseConnection::DatabaseConnection(
     nsCOMPtr<mozIStorageConnection> aStorageConnection,
     SafeRefPtr<FileManager> aFileManager)
-    : mStorageConnection(std::move(aStorageConnection)),
-      mFileManager(std::move(aFileManager)),
+    : mStorageConnection(WrapNotNull(std::move(aStorageConnection))),
+      mFileManager(WrapNotNull(std::move(aFileManager))),
       mInReadTransaction(false),
       mInWriteTransaction(false)
 #ifdef DEBUG
       ,
       mDEBUGSavepointCount(0)
 #endif
 {
   AssertIsOnConnectionThread();
@@ -13175,17 +13175,17 @@ ConnectionPool::IdleResource::~IdleResou
 }
 
 ConnectionPool::IdleDatabaseInfo::IdleDatabaseInfo(DatabaseInfo* aDatabaseInfo)
     : IdleResource(
           TimeStamp::NowLoRes() +
           (aDatabaseInfo->mIdle
                ? TimeDuration::FromMilliseconds(kConnectionIdleMaintenanceMS)
                : TimeDuration::FromMilliseconds(kConnectionIdleCloseMS))),
-      mDatabaseInfo(aDatabaseInfo) {
+      mDatabaseInfo(WrapNotNull(aDatabaseInfo)) {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aDatabaseInfo);
 
   MOZ_COUNT_CTOR(ConnectionPool::IdleDatabaseInfo);
 }
 
 ConnectionPool::IdleDatabaseInfo::~IdleDatabaseInfo() {
   AssertIsOnBackgroundThread();
@@ -16052,17 +16052,17 @@ bool VersionChangeTransaction::DeallocPB
  * CursorBase
  ******************************************************************************/
 
 CursorBase::CursorBase(SafeRefPtr<TransactionBase> aTransaction,
                        RefPtr<FullObjectStoreMetadata> aObjectStoreMetadata,
                        const Direction aDirection,
                        const ConstructFromTransactionBase /*aConstructionTag*/)
     : mTransaction(std::move(aTransaction)),
-      mObjectStoreMetadata(std::move(aObjectStoreMetadata)),
+      mObjectStoreMetadata(WrapNotNull(std::move(aObjectStoreMetadata))),
       mObjectStoreId((*mObjectStoreMetadata)->mCommonMetadata.id()),
       mDirection(aDirection),
       mMaxExtraCount(IndexedDatabaseManager::MaxPreloadExtraRecords()),
       mIsSameProcessActor(!BackgroundParent::IsOtherProcessActor(
           mTransaction->GetBackgroundParent())) {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(mTransaction);
 
@@ -16238,17 +16238,16 @@ void ValueCursorBase::ProcessFiles(Curso
     if (!files.IsEmpty()) {
       // TODO: Replace this assertion by one that checks if the response type
       // matches the cursor type, at a more generic location.
       MOZ_ASSERT(aResponse.type() ==
                      CursorResponse::TArrayOfObjectStoreCursorResponse ||
                  aResponse.type() ==
                      CursorResponse::TArrayOfIndexCursorResponse);
       MOZ_ASSERT(this->mDatabase);
-      MOZ_ASSERT(*this->mBackgroundParent);
 
       auto res = SerializeStructuredCloneFiles((*this->mBackgroundParent),
                                                this->mDatabase, files,
                                                /* aForPreprocess */ false);
       if (NS_WARN_IF(res.isErr())) {
         aResponse = ClampResultCode(res.inspectErr());
         break;
       }
@@ -22879,27 +22878,27 @@ nsresult DeleteDatabaseOp::VersionChange
 
   return NS_OK;
 }
 
 TransactionDatabaseOperationBase::TransactionDatabaseOperationBase(
     SafeRefPtr<TransactionBase> aTransaction)
     : DatabaseOperationBase(aTransaction->GetLoggingInfo()->Id(),
                             aTransaction->GetLoggingInfo()->NextRequestSN()),
-      mTransaction(std::move(aTransaction)),
+      mTransaction(WrapNotNull(std::move(aTransaction))),
       mTransactionIsAborted((*mTransaction)->IsAborted()),
       mTransactionLoggingSerialNumber((*mTransaction)->LoggingSerialNumber()) {
   MOZ_ASSERT(LoggingSerialNumber());
 }
 
 TransactionDatabaseOperationBase::TransactionDatabaseOperationBase(
     SafeRefPtr<TransactionBase> aTransaction, uint64_t aLoggingSerialNumber)
     : DatabaseOperationBase(aTransaction->GetLoggingInfo()->Id(),
                             aLoggingSerialNumber),
-      mTransaction(std::move(aTransaction)),
+      mTransaction(WrapNotNull(std::move(aTransaction))),
       mTransactionIsAborted((*mTransaction)->IsAborted()),
       mTransactionLoggingSerialNumber((*mTransaction)->LoggingSerialNumber()) {}
 
 TransactionDatabaseOperationBase::~TransactionDatabaseOperationBase() {
   MOZ_ASSERT(mInternalState == InternalState::Completed);
   MOZ_ASSERT(!mTransaction,
              "TransactionDatabaseOperationBase::Cleanup() was not called by a "
              "subclass!");
@@ -27607,32 +27606,32 @@ nsresult FileHelper::Init() {
   DebugOnly<bool> exists;
   MOZ_ASSERT(NS_SUCCEEDED(journalDirectory->Exists(&exists)));
   MOZ_ASSERT(exists);
 
   DebugOnly<bool> isDirectory;
   MOZ_ASSERT(NS_SUCCEEDED(journalDirectory->IsDirectory(&isDirectory)));
   MOZ_ASSERT(isDirectory);
 
-  mFileDirectory.init(std::move(fileDirectory));
-  mJournalDirectory.init(std::move(journalDirectory));
+  mFileDirectory.init(WrapNotNullUnchecked(std::move(fileDirectory)));
+  mJournalDirectory.init(WrapNotNullUnchecked(std::move(journalDirectory)));
 
   return NS_OK;
 }
 
 nsCOMPtr<nsIFile> FileHelper::GetFile(const FileInfo& aFileInfo) {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
-  return mFileManager->GetFileForId(*mFileDirectory, aFileInfo.Id());
+  return mFileManager->GetFileForId(mFileDirectory->get(), aFileInfo.Id());
 }
 
 nsCOMPtr<nsIFile> FileHelper::GetJournalFile(const FileInfo& aFileInfo) {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
-  return mFileManager->GetFileForId(*mJournalDirectory, aFileInfo.Id());
+  return mFileManager->GetFileForId(mJournalDirectory->get(), aFileInfo.Id());
 }
 
 nsresult FileHelper::CreateFileFromStream(nsIFile& aFile, nsIFile& aJournalFile,
                                           nsIInputStream& aInputStream,
                                           bool aCompress) {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   bool exists;
@@ -27795,17 +27794,17 @@ nsresult FileHelper::SyncRead(nsIInputSt
 
   // We need to proceed async.
   nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(&aInputStream);
   if (!asyncStream) {
     return rv;
   }
 
   if (!mReadCallback) {
-    mReadCallback.init(new ReadCallback());
+    mReadCallback.init(MakeNotNull<RefPtr<ReadCallback>>());
   }
 
   // We just need any thread with an event loop for receiving the
   // OnInputStreamReady callback. Let's use the I/O thread.
   nsCOMPtr<nsIEventTarget> target =
       do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
   MOZ_ASSERT(target);
 
--- a/dom/indexedDB/IDBCursor.cpp
+++ b/dom/indexedDB/IDBCursor.cpp
@@ -23,17 +23,17 @@
 #include "ActorsChild.h"
 
 namespace mozilla {
 namespace dom {
 
 using namespace indexedDB;
 
 IDBCursor::IDBCursor(BackgroundCursorChildBase* const aBackgroundActor)
-    : mBackgroundActor(aBackgroundActor),
+    : mBackgroundActor(WrapNotNull(aBackgroundActor)),
       mRequest(aBackgroundActor->GetRequest()),
       mTransaction(&mRequest->MutableTransactionRef()),
       mCachedKey(JS::UndefinedValue()),
       mCachedPrimaryKey(JS::UndefinedValue()),
       mCachedValue(JS::UndefinedValue()),
       mDirection(aBackgroundActor->GetDirection()),
       mHaveCachedKey(false),
       mHaveCachedPrimaryKey(false),
--- a/dom/indexedDB/IDBCursor.h
+++ b/dom/indexedDB/IDBCursor.h
@@ -47,17 +47,17 @@ class IDBCursor : public nsISupports, pu
  public:
   using Key = indexedDB::Key;
   using StructuredCloneReadInfoChild = indexedDB::StructuredCloneReadInfoChild;
 
   using Direction = IDBCursorDirection;
   using Type = IDBCursorType;
 
  protected:
-  InitializedOnceNotNull<indexedDB::BackgroundCursorChildBase* const>
+  InitializedOnce<const NotNull<indexedDB::BackgroundCursorChildBase*>>
       mBackgroundActor;
 
   // TODO: mRequest could be made const if Bug 1575173 is resolved. It is
   // initialized in the constructor and never modified/cleared.
   RefPtr<IDBRequest> mRequest;
 
   // Sub-classes' mSource will hold this alive.
   const CheckedUnsafePtr<IDBTransaction> mTransaction;
@@ -236,17 +236,17 @@ class IDBTypedCursor : public IDBCursor 
   }
 
   indexedDB::BackgroundCursorChild<CursorType>& GetTypedBackgroundActorRef()
       const {
     // We can safely downcast to BackgroundCursorChild<CursorType>*, since we
     // initialized that in the constructor from that type. We just want to avoid
     // having a second typed field.
     return *static_cast<indexedDB::BackgroundCursorChild<CursorType>*>(
-        *mBackgroundActor);
+        mBackgroundActor->get());
   }
 
   bool IsSourceDeleted() const;
 
  protected:
   virtual ~IDBTypedCursor() override;
 
   void DropJSObjects();