Backed out 5 changesets (bug 1711663) for causing build bustages on FileManager. CLOSED TREE
authorIulian Moraru <imoraru@mozilla.com>
Tue, 01 Jun 2021 02:21:02 +0300
changeset 649893 391dbe0ceb290de3c1a6989aab62e602e55f176c
parent 649892 2746dcf5094b8ba4d84f8ca75e6d706d8c153fd7
child 649894 99e98ac9c89c5e79166fcb3d453ff830dec4509c
push id15597
push userffxbld-merge
push dateMon, 12 Jul 2021 12:28:04 +0000
treeherdermozilla-beta@9c0e51e068b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1711663
milestone91.0a1
backs out9f3260aaab1126ae26ce8198e6a546a8a71dbae9
adb6539a1e6fcfce348f41dc39ee9c8e1b68d6d3
2b58a824285dff769727801b23525e1943679e6f
28e04756a73d839ecddd818ad843f6164ba89c5f
8a36c84e9269e8091016b8803abe43e3dd5bf6b6
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
Backed out 5 changesets (bug 1711663) for causing build bustages on FileManager. CLOSED TREE Backed out changeset 9f3260aaab11 (bug 1711663) Backed out changeset adb6539a1e6f (bug 1711663) Backed out changeset 2b58a824285d (bug 1711663) Backed out changeset 28e04756a73d (bug 1711663) Backed out changeset 8a36c84e9269 (bug 1711663)
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/ActorsParent.h
dom/indexedDB/ActorsParentCommon.cpp
dom/indexedDB/ActorsParentCommon.h
dom/indexedDB/DatabaseFileInfo.cpp
dom/indexedDB/DatabaseFileInfo.h
dom/indexedDB/DatabaseFileInfoFwd.h
dom/indexedDB/DatabaseFileManager.h
dom/indexedDB/FileInfo.h
dom/indexedDB/FileInfoImpl.h
dom/indexedDB/FileInfoManager.h
dom/indexedDB/FileInfoT.h
dom/indexedDB/FileInfoTImpl.h
dom/indexedDB/FileManager.h
dom/indexedDB/FileManagerBase.h
dom/indexedDB/IndexedDatabaseInlines.h
dom/indexedDB/IndexedDatabaseManager.cpp
dom/indexedDB/IndexedDatabaseManager.h
dom/indexedDB/SchemaUpgrades.cpp
dom/indexedDB/test/gtest/TestSimpleFileInfo.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -16,20 +16,22 @@
 #include <iterator>
 #include <new>
 #include <numeric>
 #include <tuple>
 #include <type_traits>
 #include <utility>
 #include "ActorsParentCommon.h"
 #include "CrashAnnotations.h"
-#include "DatabaseFileInfo.h"
-#include "DatabaseFileManager.h"
+#include "DatabaseFileInfoFwd.h"
 #include "DBSchema.h"
 #include "ErrorList.h"
+#include "FileInfoT.h"
+#include "FileManager.h"
+#include "FileManagerBase.h"
 #include "IDBCursorType.h"
 #include "IDBObjectStore.h"
 #include "IDBTransaction.h"
 #include "IndexedDBCommon.h"
 #include "IndexedDatabaseInlines.h"
 #include "IndexedDatabaseManager.h"
 #include "KeyPath.h"
 #include "MainThreadUtils.h"
@@ -599,24 +601,23 @@ Result<nsCOMPtr<nsIFileURL>, nsresult> G
                  ToResultGet<nsCOMPtr<nsIFileProtocolHandler>>(
                      MOZ_SELECT_OVERLOAD(do_QueryInterface), protocolHandler));
 
   QM_TRY_INSPECT(const auto& mutator, MOZ_TO_RESULT_INVOKE_TYPED(
                                           nsCOMPtr<nsIURIMutator>, fileHandler,
                                           NewFileURIMutator, &aDatabaseFile));
 
   // aDirectoryLockId should only be -1 when we are called
-  // - from DatabaseFileManager::InitDirectory when the temporary storage
-  //    hasn't been initialized yet. At that time, the in-memory objects (e.g.
-  //    OriginInfo) are only being created so it doesn't make sense to tunnel
-  //    quota information to TelemetryVFS to get corresponding QuotaObject
-  //    instances for SQLite files.
+  // - from FileManager::InitDirectory when the temporary storage hasn't been
+  //    initialized yet. At that time, the in-memory objects (e.g. OriginInfo)
+  //    are only being created so it doesn't make sense to tunnel quota
+  //    information to TelemetryVFS to get corresponding QuotaObject instances
+  //    for SQLite files.
   // - from DeleteDatabaseOp::LoadPreviousVersion, since this might require
-  //   temporarily exceeding the quota limit before the database can be
-  //   deleted.
+  //   temporarily exceeding the quota limit before the database can be deleted.
   const auto directoryLockIdClause =
       aDirectoryLockId >= 0
           ? "&directoryLockId="_ns + IntToCString(aDirectoryLockId)
           : EmptyCString();
 
   const auto keyClause = [&aMaybeKey] {
     nsAutoCString keyClause;
     if (aMaybeKey) {
@@ -1131,17 +1132,17 @@ class DatabaseConnection final : public 
 
   enum class CheckpointMode { Full, Restart, Truncate };
 
  public:
   class AutoSavepoint;
   class UpdateRefcountFunction;
 
  private:
-  InitializedOnce<const NotNull<SafeRefPtr<DatabaseFileManager>>> mFileManager;
+  InitializedOnce<const NotNull<SafeRefPtr<FileManager>>> mFileManager;
   RefPtr<UpdateRefcountFunction> mUpdateRefcountFunction;
   RefPtr<QuotaObject> mQuotaObject;
   RefPtr<QuotaObject> mJournalQuotaObject;
   bool mInReadTransaction;
   bool mInWriteTransaction;
 
 #ifdef DEBUG
   uint32_t mDEBUGSavepointCount;
@@ -1182,17 +1183,17 @@ class DatabaseConnection final : public 
 
   nsresult DisableQuotaChecks();
 
   void EnableQuotaChecks();
 
  private:
   DatabaseConnection(
       MovingNotNull<nsCOMPtr<mozIStorageConnection>> aStorageConnection,
-      MovingNotNull<SafeRefPtr<DatabaseFileManager>> aFileManager);
+      MovingNotNull<SafeRefPtr<FileManager>> aFileManager);
 
   ~DatabaseConnection();
 
   nsresult Init();
 
   nsresult CheckpointInternal(CheckpointMode aMode);
 
   Result<uint32_t, nsresult> GetFreelistCount(
@@ -1225,32 +1226,32 @@ class MOZ_STACK_CLASS DatabaseConnection
 
 class DatabaseConnection::UpdateRefcountFunction final
     : public mozIStorageFunction {
   class FileInfoEntry;
 
   enum class UpdateType { Increment, Decrement };
 
   DatabaseConnection* const mConnection;
-  DatabaseFileManager& mFileManager;
+  FileManager& mFileManager;
   nsClassHashtable<nsUint64HashKey, FileInfoEntry> mFileInfoEntries;
   nsTHashMap<nsUint64HashKey, NotNull<FileInfoEntry*>> mSavepointEntriesIndex;
 
   nsTArray<int64_t> mJournalsToCreateBeforeCommit;
   nsTArray<int64_t> mJournalsToRemoveAfterCommit;
   nsTArray<int64_t> mJournalsToRemoveAfterAbort;
 
   bool mInSavepoint;
 
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   UpdateRefcountFunction(DatabaseConnection* aConnection,
-                         DatabaseFileManager& aFileManager);
+                         FileManager& aFileManager);
 
   nsresult WillCommit();
 
   void DidCommit();
 
   void DidAbort();
 
   void StartSavepoint();
@@ -2175,17 +2176,17 @@ class Database final
   friend class VersionChangeTransaction;
 
   class StartTransactionOp;
   class UnmapBlobCallback;
 
  private:
   SafeRefPtr<Factory> mFactory;
   SafeRefPtr<FullDatabaseMetadata> mMetadata;
-  SafeRefPtr<DatabaseFileManager> mFileManager;
+  SafeRefPtr<FileManager> mFileManager;
   RefPtr<DirectoryLock> mDirectoryLock;
   nsTHashSet<TransactionBase*> mTransactions;
   nsTHashSet<MutableFile*> mMutableFiles;
   nsTHashMap<nsIDHashKey, SafeRefPtr<DatabaseFileInfo>> mMappedBlobs;
   RefPtr<DatabaseConnection> mConnection;
   const PrincipalInfo mPrincipalInfo;
   const Maybe<ContentParentId> mOptionalContentParentId;
   // XXX Consider changing this to ClientMetadata.
@@ -2211,17 +2212,17 @@ class Database final
 #endif
 
  public:
   // Created by OpenDatabaseOp.
   Database(SafeRefPtr<Factory> aFactory, const PrincipalInfo& aPrincipalInfo,
            const Maybe<ContentParentId>& aOptionalContentParentId,
            const quota::OriginMetadata& aOriginMetadata, uint32_t aTelemetryId,
            SafeRefPtr<FullDatabaseMetadata> aMetadata,
-           SafeRefPtr<DatabaseFileManager> aFileManager,
+           SafeRefPtr<FileManager> aFileManager,
            RefPtr<DirectoryLock> aDirectoryLock, bool aFileHandleDisabled,
            bool aChromeWriteAccessAllowed, bool aInPrivateBrowsing,
            const Maybe<const CipherKey>& aMaybeKey);
 
   void AssertIsOnConnectionThread() const {
 #ifdef DEBUG
     if (mConnection) {
       MOZ_ASSERT(mConnection);
@@ -2258,19 +2259,19 @@ class Database final
   int64_t DirectoryLockId() const { return mDirectoryLockId; }
 
   uint32_t TelemetryId() const { return mTelemetryId; }
 
   PersistenceType Type() const { return mPersistenceType; }
 
   const nsString& FilePath() const { return mFilePath; }
 
-  DatabaseFileManager& GetFileManager() const { return *mFileManager; }
-
-  MovingNotNull<SafeRefPtr<DatabaseFileManager>> GetFileManagerPtr() const {
+  FileManager& GetFileManager() const { return *mFileManager; }
+
+  MovingNotNull<SafeRefPtr<FileManager>> GetFileManagerPtr() const {
     return WrapMovingNotNull(mFileManager.clonePtr());
   }
 
   const FullDatabaseMetadata& Metadata() const {
     MOZ_ASSERT(mMetadata);
     return *mMetadata;
   }
 
@@ -3286,17 +3287,17 @@ class OpenDatabaseOp final : public Fact
 
   class VersionChangeOp;
 
   Maybe<ContentParentId> mOptionalContentParentId;
 
   SafeRefPtr<FullDatabaseMetadata> mMetadata;
 
   uint64_t mRequestedVersion;
-  SafeRefPtr<DatabaseFileManager> mFileManager;
+  SafeRefPtr<FileManager> mFileManager;
 
   SafeRefPtr<Database> mDatabase;
   SafeRefPtr<VersionChangeTransaction> mVersionChangeTransaction;
 
   // This is only set while a VersionChangeOp is live. It holds a strong
   // reference to its OpenDatabaseOp object so this is a weak pointer to avoid
   // cycles.
   VersionChangeOp* mVersionChangeOp;
@@ -3596,17 +3597,17 @@ class RenameObjectStoreOp final : public
 
 class CreateIndexOp final : public VersionChangeTransactionOp {
   friend class VersionChangeTransaction;
 
   class UpdateIndexDataValuesFunction;
 
   const IndexMetadata mMetadata;
   Maybe<UniqueIndexTable> mMaybeUniqueIndexTable;
-  const SafeRefPtr<DatabaseFileManager> mFileManager;
+  const SafeRefPtr<FileManager> mFileManager;
   const nsCString mDatabaseId;
   const IndexOrObjectStoreId mObjectStoreId;
 
  private:
   // Only created by VersionChangeTransaction.
   CreateIndexOp(SafeRefPtr<VersionChangeTransaction> aTransaction,
                 IndexOrObjectStoreId aObjectStoreId,
                 const IndexMetadata& aMetadata);
@@ -4435,17 +4436,17 @@ class ValueCursorBase {
     MOZ_ASSERT(mDatabase);
   }
 
   void ProcessFiles(CursorResponse& aResponse, const FilesArray& aFiles);
 
   ~ValueCursorBase() { MOZ_ASSERT(!mBackgroundParent); }
 
   const SafeRefPtr<Database> mDatabase;
-  const NotNull<SafeRefPtr<DatabaseFileManager>> mFileManager;
+  const NotNull<SafeRefPtr<FileManager>> mFileManager;
 
   InitializedOnce<const NotNull<PBackgroundParent*>> mBackgroundParent;
 };
 
 class KeyCursorBase {
  protected:
   explicit KeyCursorBase(TransactionBase* const /*aTransaction*/) {}
 
@@ -4884,17 +4885,17 @@ class DatabaseLoggingInfo final {
 class QuotaClient final : public mozilla::dom::quota::Client {
   static QuotaClient* sInstance;
 
   nsCOMPtr<nsIEventTarget> mBackgroundThread;
   nsCOMPtr<nsITimer> mDeleteTimer;
   nsTArray<RefPtr<Maintenance>> mMaintenanceQueue;
   RefPtr<Maintenance> mCurrentMaintenance;
   RefPtr<nsThreadPool> mMaintenanceThreadPool;
-  nsClassHashtable<nsRefPtrHashKey<DatabaseFileManager>, nsTArray<int64_t>>
+  nsClassHashtable<nsRefPtrHashKey<FileManager>, nsTArray<int64_t>>
       mPendingDeleteInfos;
   FlippedOnce<false> mShutdownRequested;
 
  public:
   QuotaClient();
 
   static QuotaClient* GetInstance() {
     AssertIsOnBackgroundThread();
@@ -4924,17 +4925,17 @@ class QuotaClient final : public mozilla
   }
 
   bool IsShuttingDown() const {
     AssertIsOnBackgroundThread();
 
     return mShutdownRequested;
   }
 
-  nsresult AsyncDeleteFile(DatabaseFileManager* aFileManager, int64_t aFileId);
+  nsresult AsyncDeleteFile(FileManager* aFileManager, int64_t aFileId);
 
   nsresult FlushPendingFileDeletions();
 
   RefPtr<Maintenance> GetCurrentMaintenance() const {
     return mCurrentMaintenance;
   }
 
   void NoteFinishedMaintenance(Maintenance* aMaintenance) {
@@ -5068,23 +5069,23 @@ class DeleteFilesRunnable final : public
     // the main thread. Next step is State_Completed.
     State_UnblockingOpen,
 
     // All done.
     State_Completed
   };
 
   nsCOMPtr<nsIEventTarget> mOwningEventTarget;
-  SafeRefPtr<DatabaseFileManager> mFileManager;
+  SafeRefPtr<FileManager> mFileManager;
   RefPtr<DirectoryLock> mDirectoryLock;
   nsTArray<int64_t> mFileIds;
   State mState;
 
  public:
-  DeleteFilesRunnable(SafeRefPtr<DatabaseFileManager> aFileManager,
+  DeleteFilesRunnable(SafeRefPtr<FileManager> aFileManager,
                       nsTArray<int64_t>&& aFileIds);
 
   void RunImmediately();
 
  private:
   ~DeleteFilesRunnable() = default;
 
   void Open();
@@ -5457,30 +5458,30 @@ class DEBUGThreadSlower final : public n
 };
 
 #endif  // DEBUG
 
 /*******************************************************************************
  * Helper classes
  ******************************************************************************/
 
-// XXX Get rid of FileHelper and move the functions into DatabaseFileManager.
-// Then, DatabaseFileManager::Get(Journal)Directory and
-// DatabaseFileManager::GetFileForId might eventually be made private.
+// 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<DatabaseFileManager> mFileManager;
+  const SafeRefPtr<FileManager> mFileManager;
 
   LazyInitializedOnce<const NotNull<nsCOMPtr<nsIFile>>> mFileDirectory;
   LazyInitializedOnce<const NotNull<nsCOMPtr<nsIFile>>> mJournalDirectory;
 
   class ReadCallback;
   LazyInitializedOnce<const NotNull<RefPtr<ReadCallback>>> mReadCallback;
 
  public:
-  explicit FileHelper(SafeRefPtr<DatabaseFileManager>&& aFileManager)
+  explicit FileHelper(SafeRefPtr<FileManager>&& aFileManager)
       : mFileManager(std::move(aFileManager)) {
     MOZ_ASSERT(mFileManager);
   }
 
   nsresult Init();
 
   [[nodiscard]] nsCOMPtr<nsIFile> GetFile(const DatabaseFileInfo& aFileInfo);
 
@@ -5615,18 +5616,18 @@ SerializeStructuredCloneFiles(PBackgroun
                file.Type() == StructuredCloneFileBase::eStructuredClone;
       },
       [&directory, &aDatabase, aBackgroundActor, aForPreprocess](
           const auto& file) -> Result<SerializedStructuredCloneFile, nsresult> {
         const int64_t fileId = file.FileInfo().Id();
         MOZ_ASSERT(fileId > 0);
 
         const nsCOMPtr<nsIFile> nativeFile =
-            mozilla::dom::indexedDB::DatabaseFileManager::GetCheckedFileForId(
-                directory, fileId);
+            mozilla::dom::indexedDB::FileManager::GetCheckedFileForId(directory,
+                                                                      fileId);
         QM_TRY(OkIf(nativeFile), Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR),
                IDB_REPORT_INTERNAL_ERR_LAMBDA);
 
         switch (file.Type()) {
           case StructuredCloneFileBase::eStructuredClone:
             if (!aForPreprocess) {
               return SerializedStructuredCloneFile{
                   null_t(), StructuredCloneFileBase::eStructuredClone};
@@ -5875,40 +5876,38 @@ Result<Ok, nsresult> DeleteFileManagerDi
     const OriginMetadata& aOriginMetadata) {
   if (!aQuotaManager) {
     QM_TRY(aFileManagerDirectory.Remove(true));
 
     return Ok{};
   }
 
   // XXX We actually scan the directory multiple times here. Once in
-  // DatabaseFileManager::GetUsage and once in nsIFile::Remove (and there's one
-  // more scan in the cleanup function).
-
-  QM_TRY_UNWRAP(auto fileUsage,
-                DatabaseFileManager::GetUsage(&aFileManagerDirectory));
+  // FileManager::GetUsage and once in nsIFile::Remove (and there's one more
+  // scan in the cleanup function).
+
+  QM_TRY_UNWRAP(auto fileUsage, FileManager::GetUsage(&aFileManagerDirectory));
 
   uint64_t usageValue = fileUsage.GetValue().valueOr(0);
 
   // XXX QM_OR_ELSE_WARN is not needed here, the lambda function below looks
   // more like a cleanup after a failure.
   auto res = QM_OR_ELSE_WARN(
       MOZ_TO_RESULT_INVOKE(aFileManagerDirectory, Remove, true),
       ([&usageValue, &aFileManagerDirectory](nsresult rv) {
         // We may have deleted some files, try to update quota
         // information before returning the error.
 
         // failures of GetUsage are intentionally ignored
-        // XXX QM_TRY failures from DatabaseFileManager::GetUsage are not
-        // propagated here, but there's no warning which would close the error
-        // stack.
-        // XXX If DatabaseFileManager::GetUsage fails here, usageValue stays
-        // unchanged, so we will decrease usage below even for files which were
-        // not deleted.
-        Unused << DatabaseFileManager::GetUsage(&aFileManagerDirectory)
+        // XXX QM_TRY failures from FileManager::GetUsage are not propagated
+        // here, but there's no warning which would close the error stack.
+        // XXX If FileManager::GetUsage fails here, usageValue stays unchanged,
+        // so we will decrease usage below even for files which were not
+        // deleted.
+        Unused << FileManager::GetUsage(&aFileManagerDirectory)
                       .andThen([&usageValue](const auto& newFileUsage) {
                         const auto newFileUsageValue =
                             newFileUsage.GetValue().valueOr(0);
                         MOZ_ASSERT(newFileUsageValue <= usageValue);
                         usageValue -= newFileUsageValue;
 
                         // XXX andThen does not support void return
                         // values right now, we must return a Result
@@ -6562,17 +6561,17 @@ nsresult DispatchAndReturnFileReferences
 
   auto lambda = [&] {
     AssertIsOnIOThread();
 
     {
       IndexedDatabaseManager* const mgr = IndexedDatabaseManager::Get();
       MOZ_ASSERT(mgr);
 
-      const SafeRefPtr<DatabaseFileManager> fileManager =
+      const SafeRefPtr<FileManager> fileManager =
           mgr->GetFileManager(aPersistenceType, aOrigin, aDatabaseName);
 
       if (fileManager) {
         const SafeRefPtr<DatabaseFileInfo> fileInfo =
             fileManager->GetFileInfo(aFileId);
 
         if (fileInfo) {
           fileInfo->GetReferences(aMemRefCnt, aDBRefCnt);
@@ -6835,17 +6834,17 @@ FileHandleThreadPool* GetFileHandleThrea
     }
 
     gFileHandleThreadPool = fileHandleThreadPool;
   }
 
   return gFileHandleThreadPool;
 }
 
-nsresult DatabaseFileManager::AsyncDeleteFile(int64_t aFileId) {
+nsresult FileManager::AsyncDeleteFile(int64_t aFileId) {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!mFileInfos.Contains(aFileId));
 
   QuotaClient* quotaClient = QuotaClient::GetInstance();
   if (quotaClient) {
     QM_TRY(quotaClient->AsyncDeleteFile(this, aFileId));
   }
 
@@ -6853,17 +6852,17 @@ nsresult DatabaseFileManager::AsyncDelet
 }
 
 /*******************************************************************************
  * DatabaseConnection implementation
  ******************************************************************************/
 
 DatabaseConnection::DatabaseConnection(
     MovingNotNull<nsCOMPtr<mozIStorageConnection>> aStorageConnection,
-    MovingNotNull<SafeRefPtr<DatabaseFileManager>> aFileManager)
+    MovingNotNull<SafeRefPtr<FileManager>> aFileManager)
     : CachingDatabaseConnection(std::move(aStorageConnection)),
       mFileManager(std::move(aFileManager)),
       mInReadTransaction(false),
       mInWriteTransaction(false)
 #ifdef DEBUG
       ,
       mDEBUGSavepointCount(0)
 #endif
@@ -7463,17 +7462,17 @@ nsresult DatabaseConnection::AutoSavepoi
 #ifdef DEBUG
   mDEBUGTransaction = nullptr;
 #endif
 
   return NS_OK;
 }
 
 DatabaseConnection::UpdateRefcountFunction::UpdateRefcountFunction(
-    DatabaseConnection* const aConnection, DatabaseFileManager& aFileManager)
+    DatabaseConnection* const aConnection, FileManager& aFileManager)
     : mConnection(aConnection),
       mFileManager(aFileManager),
       mInSavepoint(false) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
 }
 
 nsresult DatabaseConnection::UpdateRefcountFunction::WillCommit() {
@@ -7697,17 +7696,17 @@ nsresult DatabaseConnection::UpdateRefco
   AUTO_PROFILER_LABEL(
       "DatabaseConnection::UpdateRefcountFunction::CreateJournals", DOM);
 
   const nsCOMPtr<nsIFile> journalDirectory = mFileManager.GetJournalDirectory();
   QM_TRY(OkIf(journalDirectory), NS_ERROR_FAILURE);
 
   for (const int64_t id : mJournalsToCreateBeforeCommit) {
     const nsCOMPtr<nsIFile> file =
-        DatabaseFileManager::GetFileForId(journalDirectory, id);
+        FileManager::GetFileForId(journalDirectory, id);
     QM_TRY(OkIf(file), NS_ERROR_FAILURE);
 
     QM_TRY(file->Create(nsIFile::NORMAL_FILE_TYPE, 0644));
 
     mJournalsToRemoveAfterAbort.AppendElement(id);
   }
 
   return NS_OK;
@@ -7721,17 +7720,17 @@ nsresult DatabaseConnection::UpdateRefco
   AUTO_PROFILER_LABEL(
       "DatabaseConnection::UpdateRefcountFunction::RemoveJournals", DOM);
 
   nsCOMPtr<nsIFile> journalDirectory = mFileManager.GetJournalDirectory();
   QM_TRY(OkIf(journalDirectory), NS_ERROR_FAILURE);
 
   for (const auto& journal : aJournals) {
     nsCOMPtr<nsIFile> file =
-        DatabaseFileManager::GetFileForId(journalDirectory, journal);
+        FileManager::GetFileForId(journalDirectory, journal);
     QM_TRY(OkIf(file), NS_ERROR_FAILURE);
 
     QM_WARNONLY_TRY(file->Remove(false));
   }
 
   return NS_OK;
 }
 
@@ -9443,27 +9442,24 @@ WaitForTransactionsHelper::Run() {
 
   return NS_OK;
 }
 
 /*******************************************************************************
  * Database
  ******************************************************************************/
 
-Database::Database(SafeRefPtr<Factory> aFactory,
-                   const PrincipalInfo& aPrincipalInfo,
-                   const Maybe<ContentParentId>& aOptionalContentParentId,
-                   const quota::OriginMetadata& aOriginMetadata,
-                   uint32_t aTelemetryId,
-                   SafeRefPtr<FullDatabaseMetadata> aMetadata,
-                   SafeRefPtr<DatabaseFileManager> aFileManager,
-                   RefPtr<DirectoryLock> aDirectoryLock,
-                   bool aFileHandleDisabled, bool aChromeWriteAccessAllowed,
-                   bool aInPrivateBrowsing,
-                   const Maybe<const CipherKey>& aMaybeKey)
+Database::Database(
+    SafeRefPtr<Factory> aFactory, const PrincipalInfo& aPrincipalInfo,
+    const Maybe<ContentParentId>& aOptionalContentParentId,
+    const quota::OriginMetadata& aOriginMetadata, uint32_t aTelemetryId,
+    SafeRefPtr<FullDatabaseMetadata> aMetadata,
+    SafeRefPtr<FileManager> aFileManager, RefPtr<DirectoryLock> aDirectoryLock,
+    bool aFileHandleDisabled, bool aChromeWriteAccessAllowed,
+    bool aInPrivateBrowsing, const Maybe<const CipherKey>& aMaybeKey)
     : mFactory(std::move(aFactory)),
       mMetadata(std::move(aMetadata)),
       mFileManager(std::move(aFileManager)),
       mDirectoryLock(std::move(aDirectoryLock)),
       mPrincipalInfo(aPrincipalInfo),
       mOptionalContentParentId(aOptionalContentParentId),
       mOriginMetadata(aOriginMetadata),
       mId(mMetadata->mDatabaseId),
@@ -12160,32 +12156,31 @@ mozilla::ipc::IPCResult Cursor<CursorTyp
 
   continueOp->DispatchToConnectionPool();
   mCurrentlyRunningOp = continueOp;
 
   return IPC_OK();
 }
 
 /*******************************************************************************
- * DatabaseFileManager
+ * FileManager
  ******************************************************************************/
 
-DatabaseFileManager::MutexType DatabaseFileManager::sMutex;
-
-DatabaseFileManager::DatabaseFileManager(
-    PersistenceType aPersistenceType,
-    const quota::OriginMetadata& aOriginMetadata,
-    const nsAString& aDatabaseName, bool aEnforcingQuota)
+FileManager::MutexType FileManager::sMutex;
+
+FileManager::FileManager(PersistenceType aPersistenceType,
+                         const quota::OriginMetadata& aOriginMetadata,
+                         const nsAString& aDatabaseName, bool aEnforcingQuota)
     : mPersistenceType(aPersistenceType),
       mOriginMetadata(aOriginMetadata),
       mDatabaseName(aDatabaseName),
       mEnforcingQuota(aEnforcingQuota) {}
 
-nsresult DatabaseFileManager::Init(nsIFile* aDirectory,
-                                   mozIStorageConnection& aConnection) {
+nsresult FileManager::Init(nsIFile* aDirectory,
+                           mozIStorageConnection& aConnection) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aDirectory);
 
   {
     QM_TRY_INSPECT(const bool& existsAsDirectory,
                    ExistsAsDirectory(*aDirectory));
 
     if (!existsAsDirectory) {
@@ -12227,61 +12222,61 @@ nsresult DatabaseFileManager::Init(nsIFi
                        MOZ_TO_RESULT_INVOKE(stmt, GetInt32, 1));
 
         // We put a raw pointer into the hash table, so the memory refcount will
         // be 0, but the dbRefCnt is non-zero, which will keep the
         // DatabaseFileInfo object alive.
         MOZ_ASSERT(dbRefCnt > 0);
         mFileInfos.InsertOrUpdate(
             id, MakeNotNull<DatabaseFileInfo*>(
-                    FileInfoManagerGuard{}, SafeRefPtrFromThis(), id,
+                    FileManagerGuard{}, SafeRefPtrFromThis(), id,
                     static_cast<nsrefcnt>(dbRefCnt)));
 
         mLastFileId = std::max(id, mLastFileId);
 
         return Ok{};
       }));
 
   return NS_OK;
 }
 
-nsCOMPtr<nsIFile> DatabaseFileManager::GetDirectory() {
+nsCOMPtr<nsIFile> FileManager::GetDirectory() {
   if (!this->AssertValid()) {
     return nullptr;
   }
 
   return GetFileForPath(*mDirectoryPath);
 }
 
-nsCOMPtr<nsIFile> DatabaseFileManager::GetCheckedDirectory() {
+nsCOMPtr<nsIFile> FileManager::GetCheckedDirectory() {
   auto directory = GetDirectory();
   if (NS_WARN_IF(!directory)) {
     return nullptr;
   }
 
   DebugOnly<bool> exists;
   MOZ_ASSERT(NS_SUCCEEDED(directory->Exists(&exists)));
   MOZ_ASSERT(exists);
 
   DebugOnly<bool> isDirectory;
   MOZ_ASSERT(NS_SUCCEEDED(directory->IsDirectory(&isDirectory)));
   MOZ_ASSERT(isDirectory);
 
   return directory;
 }
 
-nsCOMPtr<nsIFile> DatabaseFileManager::GetJournalDirectory() {
+nsCOMPtr<nsIFile> FileManager::GetJournalDirectory() {
   if (!this->AssertValid()) {
     return nullptr;
   }
 
   return GetFileForPath(*mJournalDirectoryPath);
 }
 
-nsCOMPtr<nsIFile> DatabaseFileManager::EnsureJournalDirectory() {
+nsCOMPtr<nsIFile> FileManager::EnsureJournalDirectory() {
   // This can happen on the IO or on a transaction thread.
   MOZ_ASSERT(!NS_IsMainThread());
 
   auto journalDirectory = GetFileForPath(*mJournalDirectoryPath);
   QM_TRY(OkIf(journalDirectory), nullptr);
 
   QM_TRY_INSPECT(const bool& exists,
                  MOZ_TO_RESULT_INVOKE(journalDirectory, Exists), nullptr);
@@ -12295,27 +12290,26 @@ nsCOMPtr<nsIFile> DatabaseFileManager::E
   } else {
     QM_TRY(journalDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755), nullptr);
   }
 
   return journalDirectory;
 }
 
 // static
-nsCOMPtr<nsIFile> DatabaseFileManager::GetFileForId(nsIFile* aDirectory,
-                                                    int64_t aId) {
+nsCOMPtr<nsIFile> FileManager::GetFileForId(nsIFile* aDirectory, int64_t aId) {
   MOZ_ASSERT(aDirectory);
   MOZ_ASSERT(aId > 0);
 
   QM_TRY_RETURN(CloneFileAndAppend(*aDirectory, IntToString(aId)), nullptr);
 }
 
 // static
-nsCOMPtr<nsIFile> DatabaseFileManager::GetCheckedFileForId(nsIFile* aDirectory,
-                                                           int64_t aId) {
+nsCOMPtr<nsIFile> FileManager::GetCheckedFileForId(nsIFile* aDirectory,
+                                                   int64_t aId) {
   auto file = GetFileForId(aDirectory, aId);
   if (NS_WARN_IF(!file)) {
     return nullptr;
   }
 
   DebugOnly<bool> exists;
   MOZ_ASSERT(NS_SUCCEEDED(file->Exists(&exists)));
   MOZ_ASSERT(exists);
@@ -12323,20 +12317,19 @@ nsCOMPtr<nsIFile> DatabaseFileManager::G
   DebugOnly<bool> isFile;
   MOZ_ASSERT(NS_SUCCEEDED(file->IsFile(&isFile)));
   MOZ_ASSERT(isFile);
 
   return file;
 }
 
 // static
-nsresult DatabaseFileManager::InitDirectory(nsIFile& aDirectory,
-                                            nsIFile& aDatabaseFile,
-                                            const nsACString& aOrigin,
-                                            uint32_t aTelemetryId) {
+nsresult FileManager::InitDirectory(nsIFile& aDirectory, nsIFile& aDatabaseFile,
+                                    const nsACString& aOrigin,
+                                    uint32_t aTelemetryId) {
   AssertIsOnIOThread();
 
   {
     QM_TRY_INSPECT(const bool& exists,
                    MOZ_TO_RESULT_INVOKE(aDirectory, Exists));
 
     if (!exists) {
       return NS_OK;
@@ -12442,18 +12435,17 @@ nsresult DatabaseFileManager::InitDirect
       QM_TRY(transaction.Commit());
     }
   }
 
   return NS_OK;
 }
 
 // static
-Result<FileUsageType, nsresult> DatabaseFileManager::GetUsage(
-    nsIFile* aDirectory) {
+Result<FileUsageType, nsresult> FileManager::GetUsage(nsIFile* aDirectory) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aDirectory);
 
   QM_TRY_INSPECT(const bool& exists, MOZ_TO_RESULT_INVOKE(aDirectory, Exists));
 
   if (!exists) {
     return FileUsageType{};
   }
@@ -12501,17 +12493,17 @@ Result<FileUsageType, nsresult> Database
         UNKNOWN_FILE_WARNING(leafName);
 
         return Ok{};
       }));
 
   return usage;
 }
 
-nsresult DatabaseFileManager::SyncDeleteFile(const int64_t aId) {
+nsresult FileManager::SyncDeleteFile(const int64_t aId) {
   MOZ_ASSERT(!mFileInfos.Contains(aId));
 
   if (!this->AssertValid()) {
     return NS_ERROR_UNEXPECTED;
   }
 
   const auto directory = GetDirectory();
   QM_TRY(OkIf(directory), NS_ERROR_FAILURE);
@@ -12523,18 +12515,17 @@ nsresult DatabaseFileManager::SyncDelete
   QM_TRY(OkIf(file), NS_ERROR_FAILURE);
 
   const nsCOMPtr<nsIFile> journalFile = GetFileForId(journalDirectory, aId);
   QM_TRY(OkIf(journalFile), NS_ERROR_FAILURE);
 
   return SyncDeleteFile(*file, *journalFile);
 }
 
-nsresult DatabaseFileManager::SyncDeleteFile(nsIFile& aFile,
-                                             nsIFile& aJournalFile) {
+nsresult FileManager::SyncDeleteFile(nsIFile& aFile, nsIFile& aJournalFile) {
   QuotaManager* const quotaManager =
       EnforcingQuota() ? QuotaManager::Get() : nullptr;
   MOZ_ASSERT_IF(EnforcingQuota(), quotaManager);
 
   QM_TRY(DeleteFile(aFile, quotaManager, Type(), OriginMetadata(),
                     Idempotency::No));
 
   QM_TRY(aJournalFile.Remove(false));
@@ -12569,17 +12560,17 @@ QuotaClient::~QuotaClient() {
   // No one else should be able to touch gTelemetryIdHashtable now that the
   // QuotaClient has gone away.
   gTelemetryIdHashtable = nullptr;
   gTelemetryIdMutex = nullptr;
 
   sInstance = nullptr;
 }
 
-nsresult QuotaClient::AsyncDeleteFile(DatabaseFileManager* aFileManager,
+nsresult QuotaClient::AsyncDeleteFile(FileManager* aFileManager,
                                       int64_t aFileId) {
   AssertIsOnBackgroundThread();
 
   if (mShutdownRequested) {
     // Whoops! We want to delete an IndexedDB disk-backed File but it's too late
     // to actually delete the file! This means we're going to "leak" the file
     // and leave it around when we shouldn't! (The file will stay around until
     // next storage initialization is triggered when the app is started again).
@@ -12886,19 +12877,19 @@ nsresult QuotaClient::GetUsageForOriginI
         CloneFileAndAppend(*directory,
                            databaseFilename + kFileManagerDirectoryNameSuffix));
 
     QM_TRY_INSPECT(
         const auto& databaseFile,
         CloneFileAndAppend(*directory, databaseFilename + kSQLiteSuffix));
 
     if (aInitializing) {
-      QM_TRY(DatabaseFileManager::InitDirectory(
-          *fmDirectory, *databaseFile, aOriginMetadata.mOrigin,
-          TelemetryIdForFile(databaseFile)));
+      QM_TRY(FileManager::InitDirectory(*fmDirectory, *databaseFile,
+                                        aOriginMetadata.mOrigin,
+                                        TelemetryIdForFile(databaseFile)));
     }
 
     if (aUsageInfo) {
       {
         QM_TRY_INSPECT(const int64_t& fileSize,
                        MOZ_TO_RESULT_INVOKE(databaseFile, GetFileSize));
 
         MOZ_ASSERT(fileSize >= 0);
@@ -12924,17 +12915,17 @@ nsresult QuotaClient::GetUsageForOriginI
                            }),
                            (ErrToOk<0, int64_t>)));
         MOZ_ASSERT(walFileSize >= 0);
         *aUsageInfo += DatabaseUsageType(Some(uint64_t(walFileSize)));
       }
 
       {
         QM_TRY_INSPECT(const auto& fileUsage,
-                       DatabaseFileManager::GetUsage(fmDirectory));
+                       FileManager::GetUsage(fmDirectory));
 
         *aUsageInfo += fileUsage;
       }
     }
   }
 
   return NS_OK;
 }
@@ -13240,18 +13231,18 @@ void QuotaClient::ProcessMaintenanceQueu
 
   mCurrentMaintenance->RunImmediately();
 }
 
 /*******************************************************************************
  * DeleteFilesRunnable
  ******************************************************************************/
 
-DeleteFilesRunnable::DeleteFilesRunnable(
-    SafeRefPtr<DatabaseFileManager> aFileManager, nsTArray<int64_t>&& aFileIds)
+DeleteFilesRunnable::DeleteFilesRunnable(SafeRefPtr<FileManager> aFileManager,
+                                         nsTArray<int64_t>&& aFileIds)
     : Runnable("dom::indexeddb::DeleteFilesRunnable"),
       mOwningEventTarget(GetCurrentEventTarget()),
       mFileManager(std::move(aFileManager)),
       mFileIds(std::move(aFileIds)),
       mState(State_Initial) {}
 
 void DeleteFilesRunnable::RunImmediately() {
   AssertIsOnBackgroundThread();
@@ -16127,26 +16118,26 @@ nsresult OpenDatabaseOp::DoDatabaseWork(
                             : mMetadata->mCommonMetadata.version();
   }
 
   QM_TRY(OkIf(mMetadata->mCommonMetadata.version() <= mRequestedVersion),
          NS_ERROR_DOM_INDEXEDDB_VERSION_ERR);
 
   QM_TRY_UNWRAP(
       mFileManager,
-      ([this, persistenceType, &databaseName, &fmDirectory, &connection]()
-           -> mozilla::Result<SafeRefPtr<DatabaseFileManager>, nsresult> {
+      ([this, persistenceType, &databaseName, &fmDirectory,
+        &connection]() -> mozilla::Result<SafeRefPtr<FileManager>, nsresult> {
         IndexedDatabaseManager* const mgr = IndexedDatabaseManager::Get();
         MOZ_ASSERT(mgr);
 
-        SafeRefPtr<DatabaseFileManager> fileManager = mgr->GetFileManager(
+        SafeRefPtr<FileManager> fileManager = mgr->GetFileManager(
             persistenceType, mOriginMetadata.mOrigin, databaseName);
 
         if (!fileManager) {
-          fileManager = MakeSafeRefPtr<DatabaseFileManager>(
+          fileManager = MakeSafeRefPtr<FileManager>(
               persistenceType, mOriginMetadata, databaseName, mEnforcingQuota);
 
           QM_TRY(fileManager->Init(fmDirectory, *connection));
 
           mgr->AddFileManager(fileManager.clonePtr());
         }
 
         return fileManager;
@@ -18111,17 +18102,17 @@ nsresult CreateFileOp::DoDatabaseWork() 
 
   AUTO_PROFILER_LABEL("CreateFileOp::DoDatabaseWork", DOM);
 
   if (NS_WARN_IF(QuotaManager::IsShuttingDown()) || !OperationMayProceed()) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
-  DatabaseFileManager& fileManager = mDatabase->GetFileManager();
+  FileManager& fileManager = mDatabase->GetFileManager();
 
   mFileInfo.init(fileManager.CreateFileInfo());
   if (NS_WARN_IF(!*mFileInfo)) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
   const int64_t fileId = (*mFileInfo)->Id();
--- a/dom/indexedDB/ActorsParent.h
+++ b/dom/indexedDB/ActorsParent.h
@@ -23,16 +23,17 @@ class FileHandleThreadPool;
 namespace quota {
 
 class Client;
 
 }  // namespace quota
 
 namespace indexedDB {
 
+class FileManager;
 class LoggingInfo;
 class PBackgroundIDBFactoryParent;
 class PBackgroundIndexedDBUtilsParent;
 
 already_AddRefed<PBackgroundIDBFactoryParent> AllocPBackgroundIDBFactoryParent(
     const LoggingInfo& aLoggingInfo);
 
 bool RecvPBackgroundIDBFactoryConstructor(PBackgroundIDBFactoryParent* aActor,
--- a/dom/indexedDB/ActorsParentCommon.cpp
+++ b/dom/indexedDB/ActorsParentCommon.cpp
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ActorsParentCommon.h"
 
 // local includes
-#include "DatabaseFileInfo.h"
-#include "DatabaseFileManager.h"
+#include "DatabaseFileInfoFwd.h"  // for DatabaseFileInfo
+#include "FileManager.h"
 #include "IndexedDatabase.h"  // for StructuredCloneFile...
 #include "IndexedDatabaseManager.h"
 #include "IndexedDBCommon.h"
 #include "ReportInternalError.h"
 
 // global includes
 #include <stdlib.h>
 #include <string.h>
@@ -87,18 +87,17 @@ constexpr StructuredCloneFileBase::FileT
   }
 }
 
 int32_t ToInteger(const nsAString& aStr, nsresult* const aRv) {
   return aStr.ToInteger(aRv);
 }
 
 Result<StructuredCloneFileParent, nsresult> DeserializeStructuredCloneFile(
-    const DatabaseFileManager& aFileManager,
-    const nsDependentSubstring& aText) {
+    const FileManager& aFileManager, const nsDependentSubstring& aText) {
   MOZ_ASSERT(!aText.IsEmpty());
 
   const StructuredCloneFileBase::FileType type =
       ToStructuredCloneFileType(aText.First());
 
   QM_TRY_INSPECT(
       const auto& id,
       ToResultGet<int32_t>(
@@ -333,17 +332,17 @@ nsresult ReadCompressedIndexDataValuesFr
     default:
       return NS_ERROR_FILE_CORRUPTED;
   }
 }
 
 Result<StructuredCloneReadInfoParent, nsresult>
 GetStructuredCloneReadInfoFromBlob(const uint8_t* aBlobData,
                                    uint32_t aBlobDataLength,
-                                   const DatabaseFileManager& aFileManager,
+                                   const FileManager& aFileManager,
                                    const nsAString& aFileIds,
                                    const Maybe<CipherKey>& aMaybeKey) {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   AUTO_PROFILER_LABEL("GetStructuredCloneReadInfoFromBlob", DOM);
 
   const char* const compressed = reinterpret_cast<const char*>(aBlobData);
   const size_t compressedLength = size_t(aBlobDataLength);
@@ -374,19 +373,20 @@ GetStructuredCloneReadInfoFromBlob(const
                   DeserializeStructuredCloneFiles(aFileManager, aFileIds));
   }
 
   return StructuredCloneReadInfoParent{std::move(data), std::move(files),
                                        false};
 }
 
 Result<StructuredCloneReadInfoParent, nsresult>
-GetStructuredCloneReadInfoFromExternalBlob(
-    uint64_t aIntData, const DatabaseFileManager& aFileManager,
-    const nsAString& aFileIds, const Maybe<CipherKey>& aMaybeKey) {
+GetStructuredCloneReadInfoFromExternalBlob(uint64_t aIntData,
+                                           const FileManager& aFileManager,
+                                           const nsAString& aFileIds,
+                                           const Maybe<CipherKey>& aMaybeKey) {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   AUTO_PROFILER_LABEL("GetStructuredCloneReadInfoFromExternalBlob", DOM);
 
   nsTArray<StructuredCloneFileParent> files;
   if (!aFileIds.IsVoid()) {
     QM_TRY_UNWRAP(files,
                   DeserializeStructuredCloneFiles(aFileManager, aFileIds));
@@ -436,17 +436,17 @@ GetStructuredCloneReadInfoFromExternalBl
   return StructuredCloneReadInfoParent{std::move(data), std::move(files),
                                        false};
 }
 
 template <typename T>
 Result<StructuredCloneReadInfoParent, nsresult>
 GetStructuredCloneReadInfoFromSource(T* aSource, uint32_t aDataIndex,
                                      uint32_t aFileIdsIndex,
-                                     const DatabaseFileManager& aFileManager,
+                                     const FileManager& aFileManager,
                                      const Maybe<CipherKey>& aMaybeKey) {
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(aSource);
 
   QM_TRY_INSPECT(const int32_t& columnType,
                  MOZ_TO_RESULT_INVOKE(aSource, GetTypeOfIndex, aDataIndex));
 
   QM_TRY_INSPECT(const bool& isNull,
@@ -666,36 +666,37 @@ ReadCompressedNumber(const Span<const ui
     MOZ_ASSERT(false);
     IDB_REPORT_INTERNAL_ERR();
   });
 
   return std::pair{result, Span{newPos + 1, end}};
 }
 
 Result<StructuredCloneReadInfoParent, nsresult>
-GetStructuredCloneReadInfoFromValueArray(
-    mozIStorageValueArray* aValues, uint32_t aDataIndex, uint32_t aFileIdsIndex,
-    const DatabaseFileManager& aFileManager,
-    const Maybe<CipherKey>& aMaybeKey) {
+GetStructuredCloneReadInfoFromValueArray(mozIStorageValueArray* aValues,
+                                         uint32_t aDataIndex,
+                                         uint32_t aFileIdsIndex,
+                                         const FileManager& aFileManager,
+                                         const Maybe<CipherKey>& aMaybeKey) {
   return GetStructuredCloneReadInfoFromSource(
       aValues, aDataIndex, aFileIdsIndex, aFileManager, aMaybeKey);
 }
 
 Result<StructuredCloneReadInfoParent, nsresult>
 GetStructuredCloneReadInfoFromStatement(mozIStorageStatement* aStatement,
                                         uint32_t aDataIndex,
                                         uint32_t aFileIdsIndex,
-                                        const DatabaseFileManager& aFileManager,
+                                        const FileManager& aFileManager,
                                         const Maybe<CipherKey>& aMaybeKey) {
   return GetStructuredCloneReadInfoFromSource(
       aStatement, aDataIndex, aFileIdsIndex, aFileManager, aMaybeKey);
 }
 
 Result<nsTArray<StructuredCloneFileParent>, nsresult>
-DeserializeStructuredCloneFiles(const DatabaseFileManager& aFileManager,
+DeserializeStructuredCloneFiles(const FileManager& aFileManager,
                                 const nsAString& aText) {
   MOZ_ASSERT(!IsOnBackgroundThread());
 
   nsTArray<StructuredCloneFileParent> result;
   for (const auto& token :
        nsCharSeparatedTokenizerTemplate<NS_TokenizerIgnoreNothing>(aText, ' ')
            .ToRange()) {
     MOZ_ASSERT(!token.IsEmpty());
--- a/dom/indexedDB/ActorsParentCommon.h
+++ b/dom/indexedDB/ActorsParentCommon.h
@@ -30,17 +30,17 @@ class JSObject;
 class mozIStorageConnection;
 class mozIStorageStatement;
 class mozIStorageValueArray;
 
 namespace mozilla {
 namespace dom {
 namespace indexedDB {
 
-class DatabaseFileManager;
+class FileManager;
 struct StructuredCloneFileParent;
 struct StructuredCloneReadInfoParent;
 
 using IndexedDBCipherStrategy = quota::IPCStreamCipherStrategy;
 using CipherKey = IndexedDBCipherStrategy::KeyType;
 
 // At the moment, the encrypted stream block size is assumed to be unchangeable
 // between encrypting and decrypting blobs. This assumptions holds as long as we
@@ -97,29 +97,31 @@ Result<IndexDataValuesAutoArray, nsresul
 
 Result<std::tuple<IndexOrObjectStoreId, bool, Span<const uint8_t>>, nsresult>
 ReadCompressedIndexId(Span<const uint8_t> aData);
 
 Result<std::pair<uint64_t, mozilla::Span<const uint8_t>>, nsresult>
 ReadCompressedNumber(Span<const uint8_t> aSpan);
 
 Result<StructuredCloneReadInfoParent, nsresult>
-GetStructuredCloneReadInfoFromValueArray(
-    mozIStorageValueArray* aValues, uint32_t aDataIndex, uint32_t aFileIdsIndex,
-    const DatabaseFileManager& aFileManager, const Maybe<CipherKey>& aMaybeKey);
+GetStructuredCloneReadInfoFromValueArray(mozIStorageValueArray* aValues,
+                                         uint32_t aDataIndex,
+                                         uint32_t aFileIdsIndex,
+                                         const FileManager& aFileManager,
+                                         const Maybe<CipherKey>& aMaybeKey);
 
 Result<StructuredCloneReadInfoParent, nsresult>
 GetStructuredCloneReadInfoFromStatement(mozIStorageStatement* aStatement,
                                         uint32_t aDataIndex,
                                         uint32_t aFileIdsIndex,
-                                        const DatabaseFileManager& aFileManager,
+                                        const FileManager& aFileManager,
                                         const Maybe<CipherKey>& aMaybeKey);
 
 Result<nsTArray<StructuredCloneFileParent>, nsresult>
-DeserializeStructuredCloneFiles(const DatabaseFileManager& aFileManager,
+DeserializeStructuredCloneFiles(const FileManager& aFileManager,
                                 const nsAString& aText);
 
 nsresult ExecuteSimpleSQLSequence(mozIStorageConnection& aConnection,
                                   Span<const nsLiteralCString> aSQLCommands);
 
 }  // namespace indexedDB
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/indexedDB/DatabaseFileInfo.cpp
+++ b/dom/indexedDB/DatabaseFileInfo.cpp
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "DatabaseFileInfo.h"
-
-#include "FileInfoImpl.h"
+#include "FileInfoTImpl.h"
+#include "FileManager.h"
 
 namespace mozilla::dom::indexedDB {
 
-template class FileInfo<DatabaseFileManager>;
+template class FileInfoT<FileManager>;
 
 }  // namespace mozilla::dom::indexedDB
deleted file mode 100644
--- a/dom/indexedDB/DatabaseFileInfo.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef DOM_INDEXEDDB_DATABASEFILEINFO_H_
-#define DOM_INDEXEDDB_DATABASEFILEINFO_H_
-
-#include "DatabaseFileInfoFwd.h"
-
-#include "DatabaseFileManager.h"
-#include "FileInfo.h"
-
-#endif  // DOM_INDEXEDDB_DATABASEFILEINFO_H_
--- a/dom/indexedDB/DatabaseFileInfoFwd.h
+++ b/dom/indexedDB/DatabaseFileInfoFwd.h
@@ -4,18 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef DOM_INDEXEDDB_DATABASEFILEINFOFWD_H_
 #define DOM_INDEXEDDB_DATABASEFILEINFOFWD_H_
 
 namespace mozilla::dom::indexedDB {
 
-class DatabaseFileManager;
+class FileManager;
 
 template <typename FileManager>
-class FileInfo;
+class FileInfoT;
 
-using DatabaseFileInfo = FileInfo<DatabaseFileManager>;
+using DatabaseFileInfo = FileInfoT<indexedDB::FileManager>;
 
 }  // namespace mozilla::dom::indexedDB
 
 #endif  // DOM_INDEXEDDB_DATABASEFILEINFOFWD_H_
rename from dom/indexedDB/FileInfo.h
rename to dom/indexedDB/FileInfoT.h
--- a/dom/indexedDB/FileInfo.h
+++ b/dom/indexedDB/FileInfoT.h
@@ -1,73 +1,62 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef DOM_INDEXEDDB_FILEINFO_H_
-#define DOM_INDEXEDDB_FILEINFO_H_
+#ifndef mozilla_dom_indexeddb_fileinfot_h__
+#define mozilla_dom_indexeddb_fileinfot_h__
 
 #include "nsISupportsImpl.h"
 #include "nsCOMPtr.h"
 #include "SafeRefPtr.h"
 
 namespace mozilla {
 namespace dom {
 namespace indexedDB {
 
-class FileInfoBase {
+template <typename FileManager>
+class FileInfoT final {
  public:
+  using AutoLock = typename FileManager::AutoLock;
   using IdType = int64_t;
 
-  IdType Id() const { return mFileId; }
-
- protected:
-  explicit FileInfoBase(const int64_t aFileId) : mFileId(aFileId) {
-    MOZ_ASSERT(mFileId > 0);
-  }
-
- private:
-  const IdType mFileId;
-};
-
-template <typename FileManager>
-class FileInfo final : public FileInfoBase {
- public:
-  using AutoLock = typename FileManager::AutoLock;
-
-  FileInfo(const typename FileManager::FileInfoManagerGuard& aGuard,
-           SafeRefPtr<FileManager> aFileManager, const int64_t aFileId,
-           const nsrefcnt aInitialDBRefCnt = 0);
+  FileInfoT(const typename FileManager::FileManagerGuard& aGuard,
+            SafeRefPtr<FileManager> aFileManager, const int64_t aFileId,
+            const nsrefcnt aInitialDBRefCnt = 0);
 
   void AddRef();
   void Release(const bool aSyncDeleteFile = false);
 
   void UpdateDBRefs(int32_t aDelta);
 
   void GetReferences(int32_t* aRefCnt, int32_t* aDBRefCnt);
 
   FileManager& Manager() const;
 
+  IdType Id() const;
+
   nsCOMPtr<nsIFile> GetFileForFileInfo() const;
 
   void LockedAddRef();
-  bool LockedClearDBRefs(
-      const typename FileManager::FileInfoManagerGuard& aGuard);
+  bool LockedClearDBRefs(const typename FileManager::FileManagerGuard& aGuard);
 
  private:
   void UpdateReferences(ThreadSafeAutoRefCnt& aRefCount, int32_t aDelta,
                         bool aSyncDeleteFile = false);
 
   void Cleanup();
 
+  const IdType mFileId;
+
   ThreadSafeAutoRefCnt mRefCnt;
   ThreadSafeAutoRefCnt mDBRefCnt;
 
   const SafeRefPtr<FileManager> mFileManager;
 };
 
 }  // namespace indexedDB
 }  // namespace dom
 }  // namespace mozilla
 
-#endif  // DOM_INDEXEDDB_FILEINFO_H_
+#endif  // mozilla_dom_indexeddb_fileinfot_h__
rename from dom/indexedDB/FileInfoImpl.h
rename to dom/indexedDB/FileInfoTImpl.h
--- a/dom/indexedDB/FileInfoImpl.h
+++ b/dom/indexedDB/FileInfoTImpl.h
@@ -1,91 +1,97 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef DOM_INDEXEDDB_FILEINFOIMPL_H_
-#define DOM_INDEXEDDB_FILEINFOIMPL_H_
+#ifndef mozilla_dom_indexeddb_fileinfotimpl_h__
+#define mozilla_dom_indexeddb_fileinfotimpl_h__
 
-#include "FileInfo.h"
+#include "FileInfoT.h"
 
 #include "mozilla/dom/quota/QuotaCommon.h"
 #include "mozilla/Mutex.h"
 #include "nsIFile.h"
 
 namespace mozilla {
 namespace dom {
 namespace indexedDB {
 
 template <typename FileManager>
-FileInfo<FileManager>::FileInfo(
-    const typename FileManager::FileInfoManagerGuard& aGuard,
+FileInfoT<FileManager>::FileInfoT(
+    const typename FileManager::FileManagerGuard& aGuard,
     SafeRefPtr<FileManager> aFileManager, const int64_t aFileId,
     const nsrefcnt aInitialDBRefCnt)
-    : FileInfoBase{aFileId},
+    : mFileId(aFileId),
       mDBRefCnt(aInitialDBRefCnt),
       mFileManager(std::move(aFileManager)) {
+  MOZ_ASSERT(mFileId > 0);
   MOZ_ASSERT(mFileManager);
 }
 
 template <typename FileManager>
-void FileInfo<FileManager>::AddRef() {
+void FileInfoT<FileManager>::AddRef() {
   AutoLock lock(FileManager::Mutex());
 
   LockedAddRef();
 }
 
 template <typename FileManager>
-void FileInfo<FileManager>::Release(const bool aSyncDeleteFile) {
+void FileInfoT<FileManager>::Release(const bool aSyncDeleteFile) {
   UpdateReferences(mRefCnt, -1, aSyncDeleteFile);
 }
 
 template <typename FileManager>
-void FileInfo<FileManager>::UpdateDBRefs(int32_t aDelta) {
+void FileInfoT<FileManager>::UpdateDBRefs(int32_t aDelta) {
   UpdateReferences(mDBRefCnt, aDelta);
 }
 
 template <typename FileManager>
-void FileInfo<FileManager>::GetReferences(int32_t* const aRefCnt,
-                                          int32_t* const aDBRefCnt) {
+void FileInfoT<FileManager>::GetReferences(int32_t* const aRefCnt,
+                                           int32_t* const aDBRefCnt) {
   AutoLock lock(FileManager::Mutex());
 
   if (aRefCnt) {
     *aRefCnt = mRefCnt;
   }
 
   if (aDBRefCnt) {
     *aDBRefCnt = mDBRefCnt;
   }
 }
 
 template <typename FileManager>
-FileManager& FileInfo<FileManager>::Manager() const {
+FileManager& FileInfoT<FileManager>::Manager() const {
   return *mFileManager;
 }
 
 template <typename FileManager>
-void FileInfo<FileManager>::UpdateReferences(ThreadSafeAutoRefCnt& aRefCount,
-                                             const int32_t aDelta,
-                                             const bool aSyncDeleteFile) {
+int64_t FileInfoT<FileManager>::Id() const {
+  return mFileId;
+}
+
+template <typename FileManager>
+void FileInfoT<FileManager>::UpdateReferences(ThreadSafeAutoRefCnt& aRefCount,
+                                              const int32_t aDelta,
+                                              const bool aSyncDeleteFile) {
   bool needsCleanup;
   {
     AutoLock lock(FileManager::Mutex());
 
     aRefCount = aRefCount + aDelta;
 
     if (mRefCnt + mDBRefCnt > 0) {
       return;
     }
 
     mFileManager->RemoveFileInfo(Id(), lock);
 
-    // If the FileManager was already invalidated, we don't need to do any
+    // If the file manager was already invalidated, we don't need to do any
     // cleanup anymore. In that case, the entire origin directory has already
     // been deleted by the quota manager, and we don't need to delete individual
     // files.
     needsCleanup = !mFileManager->Invalidated();
   }
 
   if (needsCleanup) {
     if (aSyncDeleteFile) {
@@ -94,25 +100,25 @@ void FileInfo<FileManager>::UpdateRefere
       Cleanup();
     }
   }
 
   delete this;
 }
 
 template <typename FileManager>
-void FileInfo<FileManager>::LockedAddRef() {
+void FileInfoT<FileManager>::LockedAddRef() {
   FileManager::Mutex().AssertCurrentThreadOwns();
 
   ++mRefCnt;
 }
 
 template <typename FileManager>
-bool FileInfo<FileManager>::LockedClearDBRefs(
-    const typename FileManager::FileInfoManagerGuard&) {
+bool FileInfoT<FileManager>::LockedClearDBRefs(
+    const typename FileManager::FileManagerGuard&) {
   FileManager::Mutex().AssertCurrentThreadOwns();
 
   mDBRefCnt = 0;
 
   if (mRefCnt) {
     return true;
   }
 
@@ -122,22 +128,22 @@ bool FileInfo<FileManager>::LockedClearD
   MOZ_ASSERT(mFileManager->Invalidated());
 
   delete this;
 
   return false;
 }
 
 template <typename FileManager>
-void FileInfo<FileManager>::Cleanup() {
+void FileInfoT<FileManager>::Cleanup() {
   QM_WARNONLY_TRY(mFileManager->AsyncDeleteFile(Id()));
 }
 
 template <typename FileManager>
-nsCOMPtr<nsIFile> FileInfo<FileManager>::GetFileForFileInfo() const {
+nsCOMPtr<nsIFile> FileInfoT<FileManager>::GetFileForFileInfo() const {
   const nsCOMPtr<nsIFile> directory = Manager().GetDirectory();
   if (NS_WARN_IF(!directory)) {
     return nullptr;
   }
 
   nsCOMPtr<nsIFile> file = FileManager::GetFileForId(directory, Id());
   if (NS_WARN_IF(!file)) {
     return nullptr;
@@ -145,9 +151,9 @@ nsCOMPtr<nsIFile> FileInfo<FileManager>:
 
   return file;
 }
 
 }  // namespace indexedDB
 }  // namespace dom
 }  // namespace mozilla
 
-#endif  // DOM_INDEXEDDB_FILEINFOIMPL_H_
+#endif  // mozilla_dom_indexeddb_fileinfotimpl_h__
rename from dom/indexedDB/DatabaseFileManager.h
rename to dom/indexedDB/FileManager.h
--- a/dom/indexedDB/DatabaseFileManager.h
+++ b/dom/indexedDB/FileManager.h
@@ -1,45 +1,46 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef DOM_INDEXEDDB_DATABASEFILEMANAGER_H_
-#define DOM_INDEXEDDB_DATABASEFILEMANAGER_H_
+#ifndef mozilla_dom_indexeddb_filemanager_h__
+#define mozilla_dom_indexeddb_filemanager_h__
 
-#include "FileInfoManager.h"
 #include "mozilla/dom/quota/CommonMetadata.h"
 #include "mozilla/dom/quota/PersistenceType.h"
 #include "mozilla/dom/quota/UsageInfo.h"
 #include "mozilla/InitializedOnce.h"
+#include "FileManagerBase.h"
 
 class nsIFile;
 class mozIStorageConnection;
 
-namespace mozilla::dom::indexedDB {
+namespace mozilla {
+namespace dom {
+namespace indexedDB {
 
 // Implemented in ActorsParent.cpp.
-class DatabaseFileManager final
-    : public FileInfoManager<DatabaseFileManager>,
-      public AtomicSafeRefCounted<DatabaseFileManager> {
+class FileManager final : public FileManagerBase<FileManager>,
+                          public AtomicSafeRefCounted<FileManager> {
   using PersistenceType = mozilla::dom::quota::PersistenceType;
-  using FileInfoManager<DatabaseFileManager>::MutexType;
+  using FileManagerBase<FileManager>::MutexType;
 
   const PersistenceType mPersistenceType;
   const quota::OriginMetadata mOriginMetadata;
   const nsString mDatabaseName;
 
   LazyInitializedOnce<const nsString> mDirectoryPath;
   LazyInitializedOnce<const nsString> mJournalDirectoryPath;
 
   const bool mEnforcingQuota;
 
-  // Lock protecting DatabaseFileManager.mFileInfos.
+  // Lock protecting FileManager.mFileInfos.
   // It's s also used to atomically update DatabaseFileInfo.mRefCnt and
   // DatabaseFileInfo.mDBRefCnt
   static MutexType sMutex;
 
  public:
   [[nodiscard]] static nsCOMPtr<nsIFile> GetFileForId(nsIFile* aDirectory,
                                                       int64_t aId);
 
@@ -47,19 +48,19 @@ class DatabaseFileManager final
       nsIFile* aDirectory, int64_t aId);
 
   static nsresult InitDirectory(nsIFile& aDirectory, nsIFile& aDatabaseFile,
                                 const nsACString& aOrigin,
                                 uint32_t aTelemetryId);
 
   static Result<quota::FileUsageType, nsresult> GetUsage(nsIFile* aDirectory);
 
-  DatabaseFileManager(PersistenceType aPersistenceType,
-                      const quota::OriginMetadata& aOriginMetadata,
-                      const nsAString& aDatabaseName, bool aEnforcingQuota);
+  FileManager(PersistenceType aPersistenceType,
+              const quota::OriginMetadata& aOriginMetadata,
+              const nsAString& aDatabaseName, bool aEnforcingQuota);
 
   PersistenceType Type() const { return mPersistenceType; }
 
   const quota::OriginMetadata& OriginMetadata() const {
     return mOriginMetadata;
   }
 
   const nsACString& Origin() const { return mOriginMetadata.mOrigin; }
@@ -81,18 +82,20 @@ class DatabaseFileManager final
   [[nodiscard]] nsresult SyncDeleteFile(int64_t aId);
 
   // XXX When getting rid of FileHelper, this method should be removed/made
   // private.
   [[nodiscard]] nsresult SyncDeleteFile(nsIFile& aFile, nsIFile& aJournalFile);
 
   [[nodiscard]] nsresult AsyncDeleteFile(int64_t aFileId);
 
-  MOZ_DECLARE_REFCOUNTED_TYPENAME(DatabaseFileManager)
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(FileManager)
 
   static StaticMutex& Mutex() { return sMutex; }
 
-  ~DatabaseFileManager() = default;
+  ~FileManager() = default;
 };
 
-}  // namespace mozilla::dom::indexedDB
+}  // namespace indexedDB
+}  // namespace dom
+}  // namespace mozilla
 
-#endif  // DOM_INDEXEDDB_DATABASEFILEMANAGER_H_
+#endif  // mozilla_dom_indexeddb_filemanager_h__
rename from dom/indexedDB/FileInfoManager.h
rename to dom/indexedDB/FileManagerBase.h
--- a/dom/indexedDB/FileInfoManager.h
+++ b/dom/indexedDB/FileManagerBase.h
@@ -1,67 +1,47 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef DOM_INDEXEDDB_FILEINFOMANAGER_H_
-#define DOM_INDEXEDDB_FILEINFOMANAGER_H_
+#ifndef mozilla_dom_indexeddb_filemanagerbase_h__
+#define mozilla_dom_indexeddb_filemanagerbase_h__
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/StaticMutex.h"
 #include "nsTHashMap.h"
 #include "nsHashKeys.h"
 #include "nsISupportsImpl.h"
-#include "FileInfo.h"
+#include "FileInfoT.h"
 #include "FlippedOnce.h"
 
 namespace mozilla {
 namespace dom {
 namespace indexedDB {
 
-class FileInfoManagerBase {
+template <typename FileManager>
+class FileManagerBase {
  public:
-  bool Invalidated() const { return mInvalidated; }
-
- protected:
-  bool AssertValid() const {
-    if (NS_WARN_IF(Invalidated())) {
-      MOZ_ASSERT(false);
-      return false;
-    }
-
-    return true;
-  }
-
-  void Invalidate() { mInvalidated.Flip(); }
-
- private:
-  FlippedOnce<false> mInvalidated;
-};
-
-template <typename FileManager>
-class FileInfoManager : public FileInfoManagerBase {
- public:
-  using FileInfo = FileInfo<FileManager>;
+  using FileInfo = FileInfoT<FileManager>;
   using MutexType = StaticMutex;
   using AutoLock = mozilla::detail::BaseAutoLock<MutexType&>;
 
   [[nodiscard]] SafeRefPtr<FileInfo> GetFileInfo(int64_t aId) const {
     return AcquireFileInfo([this, aId] { return mFileInfos.MaybeGet(aId); });
   }
 
   [[nodiscard]] SafeRefPtr<FileInfo> CreateFileInfo() {
     return AcquireFileInfo([this] {
       const int64_t id = ++mLastFileId;
 
       auto fileInfo =
-          MakeNotNull<FileInfo*>(FileInfoManagerGuard{},
+          MakeNotNull<FileInfo*>(FileManagerGuard{},
                                  SafeRefPtr{static_cast<FileManager*>(this),
                                             AcquireStrongRefFromRawPtr{}},
                                  id);
 
       mFileInfos.InsertOrUpdate(id, fileInfo);
       return Some(fileInfo);
     });
   }
@@ -71,35 +51,37 @@ class FileInfoManager : public FileInfoM
     aFileMutexLock.AssertOwns(FileManager::Mutex());
 #endif
     mFileInfos.Remove(aId);
   }
 
   nsresult Invalidate() {
     AutoLock lock(FileManager::Mutex());
 
-    FileInfoManagerBase::Invalidate();
+    mInvalidated.Flip();
 
     mFileInfos.RemoveIf([](const auto& iter) {
       FileInfo* info = iter.Data();
       MOZ_ASSERT(info);
 
-      return !info->LockedClearDBRefs(FileInfoManagerGuard{});
+      return !info->LockedClearDBRefs(FileManagerGuard{});
     });
 
     return NS_OK;
   }
 
-  class FileInfoManagerGuard {
-    FileInfoManagerGuard() = default;
+  bool Invalidated() const { return mInvalidated; }
+
+  class FileManagerGuard {
+    FileManagerGuard() = default;
   };
 
  private:
   // Runs the given aFileInfoTableOp operation, which must return a FileInfo*,
-  // under the FileManager lock, acquires a strong reference to the returned
+  // under the file manager lock, acquires a strong reference to the returned
   // object under the lock, and returns the strong reference.
   template <typename FileInfoTableOp>
   [[nodiscard]] SafeRefPtr<FileInfo> AcquireFileInfo(
       const FileInfoTableOp& aFileInfoTableOp) const {
     if (!AssertValid()) {
       // In release, the assertions are disabled.
       return nullptr;
     }
@@ -118,25 +100,36 @@ class FileInfoManager : public FileInfoM
 
       return {};
     }();
 
     return SafeRefPtr{std::move(fileInfo)};
   }
 
  protected:
+  bool AssertValid() const {
+    if (NS_WARN_IF(static_cast<const FileManager*>(this)->Invalidated())) {
+      MOZ_ASSERT(false);
+      return false;
+    }
+
+    return true;
+  }
+
 #ifdef DEBUG
-  ~FileInfoManager() { MOZ_ASSERT(mFileInfos.IsEmpty()); }
+  ~FileManagerBase() { MOZ_ASSERT(mFileInfos.IsEmpty()); }
 #else
-  ~FileInfoManager() = default;
+  ~FileManagerBase() = default;
 #endif
 
   // Access to the following fields must be protected by
   // FileManager::Mutex()
   int64_t mLastFileId = 0;
   nsTHashMap<nsUint64HashKey, NotNull<FileInfo*>> mFileInfos;
+
+  FlippedOnce<false> mInvalidated;
 };
 
 }  // namespace indexedDB
 }  // namespace dom
 }  // namespace mozilla
 
-#endif  // DOM_INDEXEDDB_FILEINFOMANAGER_H_
+#endif  // mozilla_dom_indexeddb_filemanagerbase_h__
--- a/dom/indexedDB/IndexedDatabaseInlines.h
+++ b/dom/indexedDB/IndexedDatabaseInlines.h
@@ -6,17 +6,17 @@
 
 #ifndef IndexedDatabaseInlines_h
 #define IndexedDatabaseInlines_h
 
 #ifndef mozilla_dom_indexeddatabase_h__
 #  error Must include IndexedDatabase.h first
 #endif
 
-#include "DatabaseFileInfo.h"
+#include "FileManager.h"
 #include "IDBMutableFile.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/File.h"
 
 namespace mozilla {
 namespace dom {
 namespace indexedDB {
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -24,17 +24,17 @@
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/PBackgroundChild.h"
 #include "nsContentUtils.h"
 #include "nsGlobalWindow.h"
 #include "mozilla/Logging.h"
 
 #include "ActorsChild.h"
-#include "DatabaseFileManager.h"
+#include "FileManager.h"
 #include "IDBEvents.h"
 #include "IDBFactory.h"
 #include "IDBKeyRange.h"
 #include "IDBRequest.h"
 #include "IndexedDBCommon.h"
 #include "ProfilerHelpers.h"
 #include "ScriptErrorHelper.h"
 #include "nsCharSeparatedTokenizer.h"
@@ -58,20 +58,20 @@
 namespace mozilla::dom {
 namespace indexedDB {
 
 using namespace mozilla::dom::quota;
 using namespace mozilla::ipc;
 
 class FileManagerInfo {
  public:
-  [[nodiscard]] SafeRefPtr<DatabaseFileManager> GetFileManager(
+  [[nodiscard]] SafeRefPtr<FileManager> GetFileManager(
       PersistenceType aPersistenceType, const nsAString& aName) const;
 
-  void AddFileManager(SafeRefPtr<DatabaseFileManager> aFileManager);
+  void AddFileManager(SafeRefPtr<FileManager> aFileManager);
 
   bool HasFileManagers() const {
     AssertIsOnIOThread();
 
     return !mPersistentStorageFileManagers.IsEmpty() ||
            !mTemporaryStorageFileManagers.IsEmpty() ||
            !mDefaultStorageFileManagers.IsEmpty();
   }
@@ -79,27 +79,27 @@ class FileManagerInfo {
   void InvalidateAllFileManagers() const;
 
   void InvalidateAndRemoveFileManagers(PersistenceType aPersistenceType);
 
   void InvalidateAndRemoveFileManager(PersistenceType aPersistenceType,
                                       const nsAString& aName);
 
  private:
-  nsTArray<SafeRefPtr<DatabaseFileManager> >& GetArray(
+  nsTArray<SafeRefPtr<FileManager> >& GetArray(
       PersistenceType aPersistenceType);
 
-  const nsTArray<SafeRefPtr<DatabaseFileManager> >& GetImmutableArray(
+  const nsTArray<SafeRefPtr<FileManager> >& GetImmutableArray(
       PersistenceType aPersistenceType) const {
     return const_cast<FileManagerInfo*>(this)->GetArray(aPersistenceType);
   }
 
-  nsTArray<SafeRefPtr<DatabaseFileManager> > mPersistentStorageFileManagers;
-  nsTArray<SafeRefPtr<DatabaseFileManager> > mTemporaryStorageFileManagers;
-  nsTArray<SafeRefPtr<DatabaseFileManager> > mDefaultStorageFileManagers;
+  nsTArray<SafeRefPtr<FileManager> > mPersistentStorageFileManagers;
+  nsTArray<SafeRefPtr<FileManager> > mTemporaryStorageFileManagers;
+  nsTArray<SafeRefPtr<FileManager> > mDefaultStorageFileManagers;
 };
 
 }  // namespace indexedDB
 
 using namespace mozilla::dom::indexedDB;
 
 namespace {
 
@@ -670,33 +670,33 @@ int32_t IndexedDatabaseManager::MaxPrelo
 }
 
 void IndexedDatabaseManager::ClearBackgroundActor() {
   MOZ_ASSERT(NS_IsMainThread());
 
   mBackgroundActor = nullptr;
 }
 
-SafeRefPtr<DatabaseFileManager> IndexedDatabaseManager::GetFileManager(
+SafeRefPtr<FileManager> IndexedDatabaseManager::GetFileManager(
     PersistenceType aPersistenceType, const nsACString& aOrigin,
     const nsAString& aDatabaseName) {
   AssertIsOnIOThread();
 
   FileManagerInfo* info;
   if (!mFileManagerInfos.Get(aOrigin, &info)) {
     return nullptr;
   }
 
   return info->GetFileManager(aPersistenceType, aDatabaseName);
 }
 
 void IndexedDatabaseManager::AddFileManager(
-    SafeRefPtr<DatabaseFileManager> aFileManager) {
+    SafeRefPtr<FileManager> aFileManager) {
   AssertIsOnIOThread();
-  MOZ_ASSERT(aFileManager);
+  NS_ASSERTION(aFileManager, "Null file manager!");
 
   const auto& origin = aFileManager->Origin();
   mFileManagerInfos.GetOrInsertNew(origin)->AddFileManager(
       std::move(aFileManager));
 }
 
 void IndexedDatabaseManager::InvalidateAllFileManagers() {
   AssertIsOnIOThread();
@@ -835,35 +835,33 @@ void IndexedDatabaseManager::LoggingMode
 // static
 const nsCString& IndexedDatabaseManager::GetLocale() {
   IndexedDatabaseManager* idbManager = Get();
   MOZ_ASSERT(idbManager, "IDBManager is not ready!");
 
   return idbManager->mLocale;
 }
 
-SafeRefPtr<DatabaseFileManager> FileManagerInfo::GetFileManager(
+SafeRefPtr<FileManager> FileManagerInfo::GetFileManager(
     PersistenceType aPersistenceType, const nsAString& aName) const {
   AssertIsOnIOThread();
 
   const auto& managers = GetImmutableArray(aPersistenceType);
 
   const auto end = managers.cend();
   const auto foundIt =
       std::find_if(managers.cbegin(), end, DatabaseNameMatchPredicate(&aName));
 
   return foundIt != end ? foundIt->clonePtr() : nullptr;
 }
 
-void FileManagerInfo::AddFileManager(
-    SafeRefPtr<DatabaseFileManager> aFileManager) {
+void FileManagerInfo::AddFileManager(SafeRefPtr<FileManager> aFileManager) {
   AssertIsOnIOThread();
 
-  nsTArray<SafeRefPtr<DatabaseFileManager> >& managers =
-      GetArray(aFileManager->Type());
+  nsTArray<SafeRefPtr<FileManager> >& managers = GetArray(aFileManager->Type());
 
   NS_ASSERTION(!managers.Contains(aFileManager), "Adding more than once?!");
 
   managers.AppendElement(std::move(aFileManager));
 }
 
 void FileManagerInfo::InvalidateAllFileManagers() const {
   AssertIsOnIOThread();
@@ -882,18 +880,17 @@ void FileManagerInfo::InvalidateAllFileM
     mDefaultStorageFileManagers[i]->Invalidate();
   }
 }
 
 void FileManagerInfo::InvalidateAndRemoveFileManagers(
     PersistenceType aPersistenceType) {
   AssertIsOnIOThread();
 
-  nsTArray<SafeRefPtr<DatabaseFileManager> >& managers =
-      GetArray(aPersistenceType);
+  nsTArray<SafeRefPtr<FileManager> >& managers = GetArray(aPersistenceType);
 
   for (uint32_t i = 0; i < managers.Length(); i++) {
     managers[i]->Invalidate();
   }
 
   managers.Clear();
 }
 
@@ -907,17 +904,17 @@ void FileManagerInfo::InvalidateAndRemov
       std::find_if(managers.cbegin(), end, DatabaseNameMatchPredicate(&aName));
 
   if (foundIt != end) {
     (*foundIt)->Invalidate();
     managers.RemoveElementAt(foundIt.GetIndex());
   }
 }
 
-nsTArray<SafeRefPtr<DatabaseFileManager> >& FileManagerInfo::GetArray(
+nsTArray<SafeRefPtr<FileManager> >& FileManagerInfo::GetArray(
     PersistenceType aPersistenceType) {
   switch (aPersistenceType) {
     case PERSISTENCE_TYPE_PERSISTENT:
       return mPersistentStorageFileManagers;
     case PERSISTENCE_TYPE_TEMPORARY:
       return mTemporaryStorageFileManagers;
     case PERSISTENCE_TYPE_DEFAULT:
       return mDefaultStorageFileManagers;
--- a/dom/indexedDB/IndexedDatabaseManager.h
+++ b/dom/indexedDB/IndexedDatabaseManager.h
@@ -22,25 +22,25 @@ class EventChainPostVisitor;
 
 namespace dom {
 
 class IDBFactory;
 
 namespace indexedDB {
 
 class BackgroundUtilsChild;
-class DatabaseFileManager;
+class FileManager;
 class FileManagerInfo;
 
 }  // namespace indexedDB
 
 class IndexedDatabaseManager final {
-  using PersistenceType = mozilla::dom::quota::PersistenceType;
-  using DatabaseFileManager = mozilla::dom::indexedDB::DatabaseFileManager;
-  using FileManagerInfo = mozilla::dom::indexedDB::FileManagerInfo;
+  typedef mozilla::dom::quota::PersistenceType PersistenceType;
+  typedef mozilla::dom::indexedDB::FileManager FileManager;
+  typedef mozilla::dom::indexedDB::FileManagerInfo FileManagerInfo;
 
  public:
   enum LoggingMode {
     Logging_Disabled = 0,
     Logging_Concise,
     Logging_Detailed,
     Logging_ConciseProfilerMarks,
     Logging_DetailedProfilerMarks
@@ -100,21 +100,21 @@ class IndexedDatabaseManager final {
   static bool PreprocessingEnabled();
 
   // The maximum number of extra entries to preload in an Cursor::OpenOp or
   // Cursor::ContinueOp.
   static int32_t MaxPreloadExtraRecords();
 
   void ClearBackgroundActor();
 
-  [[nodiscard]] SafeRefPtr<DatabaseFileManager> GetFileManager(
+  [[nodiscard]] SafeRefPtr<FileManager> GetFileManager(
       PersistenceType aPersistenceType, const nsACString& aOrigin,
       const nsAString& aDatabaseName);
 
-  void AddFileManager(SafeRefPtr<DatabaseFileManager> aFileManager);
+  void AddFileManager(SafeRefPtr<FileManager> aFileManager);
 
   void InvalidateAllFileManagers();
 
   void InvalidateFileManagers(PersistenceType aPersistenceType,
                               const nsACString& aOrigin);
 
   void InvalidateFileManager(PersistenceType aPersistenceType,
                              const nsACString& aOrigin,
@@ -146,21 +146,21 @@ class IndexedDatabaseManager final {
 
   nsresult Init();
 
   void Destroy();
 
   static void LoggingModePrefChangedCallback(const char* aPrefName,
                                              void* aClosure);
 
-  // Maintains a list of all DatabaseFileManager objects per origin. This list
-  // isn't protected by any mutex but it is only ever touched on the IO thread.
+  // Maintains a list of all file managers per origin. This list isn't
+  // protected by any mutex but it is only ever touched on the IO thread.
   nsClassHashtable<nsCStringHashKey, FileManagerInfo> mFileManagerInfos;
 
-  nsClassHashtable<nsRefPtrHashKey<DatabaseFileManager>, nsTArray<int64_t>>
+  nsClassHashtable<nsRefPtrHashKey<FileManager>, nsTArray<int64_t>>
       mPendingDeleteInfos;
 
   nsCString mLocale;
 
   indexedDB::BackgroundUtilsChild* mBackgroundActor;
 
   static bool sIsMainProcess;
   static bool sFullSynchronousMode;
--- a/dom/indexedDB/SchemaUpgrades.cpp
+++ b/dom/indexedDB/SchemaUpgrades.cpp
@@ -3,19 +3,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SchemaUpgrades.h"
 
 // local includes
 #include "ActorsParentCommon.h"
-#include "DatabaseFileInfo.h"
-#include "DatabaseFileManager.h"
+#include "DatabaseFileInfoFwd.h"
 #include "DBSchema.h"
+#include "FileManager.h"
 #include "IndexedDatabase.h"
 #include "IndexedDBCommon.h"
 #include "ReportInternalError.h"
 
 // global includes
 #include <stdlib.h>
 #include <algorithm>
 #include <tuple>
@@ -2258,17 +2258,17 @@ nsresult UpgradeSchemaFrom18_0To19_0(moz
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return NS_OK;
 }
 
 class UpgradeFileIdsFunction final : public mozIStorageFunction {
-  SafeRefPtr<DatabaseFileManager> mFileManager;
+  SafeRefPtr<FileManager> mFileManager;
 
  public:
   UpgradeFileIdsFunction() { AssertIsOnIOThread(); }
 
   nsresult Init(nsIFile* aFMDirectory, mozIStorageConnection& aConnection);
 
   NS_DECL_ISUPPORTS
 
@@ -2851,20 +2851,19 @@ nsresult DeserializeUpgradeValueToFileId
 
   const RefPtr<DeserializeUpgradeValueHelper> helper =
       new DeserializeUpgradeValueHelper(aCloneReadInfo);
   return helper->DispatchAndWait(aFileIds);
 }
 
 nsresult UpgradeFileIdsFunction::Init(nsIFile* aFMDirectory,
                                       mozIStorageConnection& aConnection) {
-  // This DatabaseFileManager doesn't need real origin info, etc. The only
-  // purpose is to store file ids without adding more complexity or code
-  // duplication.
-  auto fileManager = MakeSafeRefPtr<DatabaseFileManager>(
+  // This file manager doesn't need real origin info, etc. The only purpose is
+  // to store file ids without adding more complexity or code duplication.
+  auto fileManager = MakeSafeRefPtr<FileManager>(
       PERSISTENCE_TYPE_INVALID, quota::OriginMetadata{}, u""_ns, false);
 
   nsresult rv = fileManager->Init(aFMDirectory, aConnection);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   mFileManager = std::move(fileManager);
--- a/dom/indexedDB/test/gtest/TestSimpleFileInfo.cpp
+++ b/dom/indexedDB/test/gtest/TestSimpleFileInfo.cpp
@@ -1,46 +1,45 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "FileInfo.h"
-#include "FileInfoImpl.h"
-#include "FileInfoManager.h"
+#include "FileInfoTImpl.h"
+#include "FileManagerBase.h"
 
 #include "gtest/gtest.h"
 
 #include "mozilla/ArrayAlgorithm.h"
 #include "mozilla/StaticMutex.h"
 #include "nsTArray.h"
 
 #include <array>
 
 using namespace mozilla;
 using namespace mozilla::dom::indexedDB;
 
-class SimpleFileManager;
+class TestFileManager;
 
-using SimpleFileInfo = FileInfo<SimpleFileManager>;
+using SimpleFileInfo = FileInfoT<TestFileManager>;
 
-struct SimpleFileManagerStats final {
+struct TestFileManagerStats final {
   // XXX We don't keep track of the specific aFileId parameters here, should we?
 
   size_t mAsyncDeleteFileCalls = 0;
   size_t mSyncDeleteFileCalls = 0;
 };
 
-class SimpleFileManager final : public FileInfoManager<SimpleFileManager>,
-                                public AtomicSafeRefCounted<SimpleFileManager> {
+class TestFileManager final : public FileManagerBase<TestFileManager>,
+                              public AtomicSafeRefCounted<TestFileManager> {
  public:
-  using FileInfoManager<SimpleFileManager>::MutexType;
+  using FileManagerBase<TestFileManager>::MutexType;
 
-  MOZ_DECLARE_REFCOUNTED_TYPENAME(SimpleFileManager)
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(TestFileManager)
 
-  // SimpleFileManager functions that are used by SimpleFileInfo
+  // FileManager functions that are used by SimpleFileInfo
 
   [[nodiscard]] nsresult AsyncDeleteFile(const int64_t aFileId) {
     MOZ_RELEASE_ASSERT(!mFileInfos.Contains(aFileId));
 
     if (mStats) {
       ++mStats->mAsyncDeleteFileCalls;
     }
 
@@ -52,66 +51,66 @@ class SimpleFileManager final : public F
 
     if (mStats) {
       ++mStats->mSyncDeleteFileCalls;
     }
     return NS_OK;
   }
 
   // Test-specific functions
-  explicit SimpleFileManager(SimpleFileManagerStats* aStats = nullptr)
+  explicit TestFileManager(TestFileManagerStats* aStats = nullptr)
       : mStats{aStats} {}
 
   void CreateDBOnlyFileInfos() {
     for (const auto id : kDBOnlyFileInfoIds) {
-      // Copied from within DatabaseFileManager::Init.
+      // Copied from within FileManager::Init.
 
       mFileInfos.InsertOrUpdate(
-          id, MakeNotNull<SimpleFileInfo*>(FileInfoManagerGuard{},
-                                           SafeRefPtrFromThis(), id,
-                                           static_cast<nsrefcnt>(1)));
+          id,
+          MakeNotNull<SimpleFileInfo*>(FileManagerGuard{}, SafeRefPtrFromThis(),
+                                       id, static_cast<nsrefcnt>(1)));
 
       mLastFileId = std::max(id, mLastFileId);
     }
   }
 
   static MutexType& Mutex() { return sMutex; }
 
   static constexpr auto kDBOnlyFileInfoIds =
       std::array<int64_t, 3>{{10, 20, 30}};
 
  private:
   inline static MutexType sMutex;
 
-  SimpleFileManagerStats* const mStats;
+  TestFileManagerStats* const mStats;
 };
 
-// These tests test the SimpleFileManager itself, to ensure the SimpleFileInfo
+// These tests test the TestFileManager itself, to ensure the SimpleFileInfo
 // tests below are valid.
 
-TEST(DOM_IndexedDB_SimpleFileManager, Invalidate)
+TEST(DOM_IndexedDB_TestFileManager, Invalidate)
 {
-  const auto fileManager = MakeSafeRefPtr<SimpleFileManager>();
+  const auto fileManager = MakeSafeRefPtr<TestFileManager>();
 
   fileManager->Invalidate();
 
   ASSERT_TRUE(fileManager->Invalidated());
 }
 
 // These tests mainly test SimpleFileInfo, which is a simplified version of
 // DatabaseFileInfo (SimpleFileInfo doesn't work with real files stored on
-// disk). The actual objects, DatabaseFileInfo and DatabaseFileManager are not
-// tested here.
+// disk). The actual objects, DatabaseFileInfo and FileManager are not tested
+// here.
 
 TEST(DOM_IndexedDB_SimpleFileInfo, Create)
 {
-  auto stats = SimpleFileManagerStats{};
+  auto stats = TestFileManagerStats{};
 
   {
-    const auto fileManager = MakeSafeRefPtr<SimpleFileManager>(&stats);
+    const auto fileManager = MakeSafeRefPtr<TestFileManager>(&stats);
     auto fileInfo = fileManager->CreateFileInfo();
 
     int32_t memRefCnt, dbRefCnt;
     fileInfo->GetReferences(&memRefCnt, &dbRefCnt);
 
     ASSERT_EQ(fileManager, &fileInfo->Manager());
 
     ASSERT_EQ(1, memRefCnt);
@@ -119,23 +118,23 @@ TEST(DOM_IndexedDB_SimpleFileInfo, Creat
   }
 
   ASSERT_EQ(0u, stats.mSyncDeleteFileCalls);
   ASSERT_EQ(1u, stats.mAsyncDeleteFileCalls);
 }
 
 TEST(DOM_IndexedDB_SimpleFileInfo, CreateWithInitialDBRefCnt)
 {
-  auto stats = SimpleFileManagerStats{};
+  auto stats = TestFileManagerStats{};
 
   {
-    const auto fileManager = MakeSafeRefPtr<SimpleFileManager>(&stats);
+    const auto fileManager = MakeSafeRefPtr<TestFileManager>(&stats);
     fileManager->CreateDBOnlyFileInfos();
 
-    for (const auto id : SimpleFileManager::kDBOnlyFileInfoIds) {
+    for (const auto id : TestFileManager::kDBOnlyFileInfoIds) {
       const auto fileInfo = fileManager->GetFileInfo(id);
       ASSERT_NE(nullptr, fileInfo);
 
       int32_t memRefCnt, dbRefCnt;
       fileInfo->GetReferences(&memRefCnt, &dbRefCnt);
 
       ASSERT_EQ(fileManager, &fileInfo->Manager());
 
@@ -146,24 +145,24 @@ TEST(DOM_IndexedDB_SimpleFileInfo, Creat
 
   ASSERT_EQ(0u, stats.mSyncDeleteFileCalls);
   // Since the files have still non-zero dbRefCnt, nothing must be deleted.
   ASSERT_EQ(0u, stats.mAsyncDeleteFileCalls);
 }
 
 TEST(DOM_IndexedDB_SimpleFileInfo, CreateWithInitialDBRefCnt_Invalidate)
 {
-  auto stats = SimpleFileManagerStats{};
+  auto stats = TestFileManagerStats{};
 
   {
-    const auto fileManager = MakeSafeRefPtr<SimpleFileManager>(&stats);
+    const auto fileManager = MakeSafeRefPtr<TestFileManager>(&stats);
     fileManager->CreateDBOnlyFileInfos();
 
     const auto fileInfos = TransformIntoNewArray(
-        SimpleFileManager::kDBOnlyFileInfoIds,
+        TestFileManager::kDBOnlyFileInfoIds,
         [&fileManager](const auto id) { return fileManager->GetFileInfo(id); });
 
     fileManager->Invalidate();
 
     for (const auto& fileInfo : fileInfos) {
       int32_t memRefCnt, dbRefCnt;
       fileInfo->GetReferences(&memRefCnt, &dbRefCnt);
 
@@ -174,105 +173,105 @@ TEST(DOM_IndexedDB_SimpleFileInfo, Creat
 
   ASSERT_EQ(0u, stats.mSyncDeleteFileCalls);
   // Since the files have still non-zero dbRefCnt, nothing must be deleted.
   ASSERT_EQ(0u, stats.mAsyncDeleteFileCalls);
 }
 
 TEST(DOM_IndexedDB_SimpleFileInfo, CreateWithInitialDBRefCnt_UpdateDBRefsToZero)
 {
-  auto stats = SimpleFileManagerStats{};
+  auto stats = TestFileManagerStats{};
 
   {
-    const auto fileManager = MakeSafeRefPtr<SimpleFileManager>(&stats);
+    const auto fileManager = MakeSafeRefPtr<TestFileManager>(&stats);
     fileManager->CreateDBOnlyFileInfos();
 
     const auto fileInfo =
-        fileManager->GetFileInfo(SimpleFileManager::kDBOnlyFileInfoIds[0]);
+        fileManager->GetFileInfo(TestFileManager::kDBOnlyFileInfoIds[0]);
     fileInfo->UpdateDBRefs(-1);
 
     int32_t memRefCnt, dbRefCnt;
     fileInfo->GetReferences(&memRefCnt, &dbRefCnt);
 
     ASSERT_EQ(1, memRefCnt);  // we hold one in fileInfo ourselves
     ASSERT_EQ(0, dbRefCnt);
   }
 
   ASSERT_EQ(0u, stats.mSyncDeleteFileCalls);
   ASSERT_EQ(1u, stats.mAsyncDeleteFileCalls);
 }
 
 TEST(DOM_IndexedDB_SimpleFileInfo, ReleaseWithFileManagerCleanup)
 {
-  auto stats = SimpleFileManagerStats{};
+  auto stats = TestFileManagerStats{};
   {
-    const auto fileManager = MakeSafeRefPtr<SimpleFileManager>(&stats);
+    const auto fileManager = MakeSafeRefPtr<TestFileManager>(&stats);
     fileManager->CreateDBOnlyFileInfos();
 
     auto* fileInfo = fileManager->CreateFileInfo().forget().take();
     fileInfo->Release(/* aSyncDeleteFile */ true);
 
-    // This was the only reference and SimpleFileManager was not invalidated,
-    // so SimpleFileManager::Cleanup should have been called.
+    // This was the only reference and FileManager was not invalidated, to
+    // FileManager::Cleanup should have been called.
     ASSERT_EQ(1u, stats.mSyncDeleteFileCalls);
   }
   ASSERT_EQ(0u, stats.mAsyncDeleteFileCalls);
 }
 
 #ifndef DEBUG
 // These tests cause assertion failures in DEBUG builds.
 
 TEST(DOM_IndexedDB_SimpleFileInfo, Invalidate_CreateFileInfo)
 {
-  auto stats = SimpleFileManagerStats{};
+  auto stats = TestFileManagerStats{};
   {
-    const auto fileManager = MakeSafeRefPtr<SimpleFileManager>(&stats);
+    const auto fileManager = MakeSafeRefPtr<TestFileManager>(&stats);
 
     fileManager->Invalidate();
 
     const auto fileInfo = fileManager->CreateFileInfo();
     Unused << fileInfo;
 
     ASSERT_EQ(nullptr, fileInfo);
   }
 
   ASSERT_EQ(0u, stats.mSyncDeleteFileCalls);
   ASSERT_EQ(0u, stats.mAsyncDeleteFileCalls);
 }
 #endif
 
 TEST(DOM_IndexedDB_SimpleFileInfo, Invalidate_Release)
 {
-  auto stats = SimpleFileManagerStats{};
+  auto stats = TestFileManagerStats{};
   {
-    const auto fileManager = MakeSafeRefPtr<SimpleFileManager>(&stats);
+    const auto fileManager = MakeSafeRefPtr<TestFileManager>(&stats);
 
     const auto fileInfo = fileManager->CreateFileInfo();
     Unused << fileInfo;
 
     fileManager->Invalidate();
 
-    // SimpleFileManager was invalidated, so Release does not do any cleanup.
+    // FileManager was invalidated, so Release does not do any cleanup.
   }
 
   ASSERT_EQ(0u, stats.mSyncDeleteFileCalls);
   ASSERT_EQ(0u, stats.mAsyncDeleteFileCalls);
 }
 
 TEST(DOM_IndexedDB_SimpleFileInfo, Invalidate_ReleaseWithFileManagerCleanup)
 {
-  auto stats = SimpleFileManagerStats{};
+  auto stats = TestFileManagerStats{};
   {
-    const auto fileManager = MakeSafeRefPtr<SimpleFileManager>(&stats);
+    const auto fileManager = MakeSafeRefPtr<TestFileManager>(&stats);
 
     auto* fileInfo = fileManager->CreateFileInfo().forget().take();
 
     fileManager->Invalidate();
 
-    // SimpleFileManager was invalidated, so Release does not do any cleanup.
+    // FileManager was invalidated, so Release does not do any cleanup.
     fileInfo->Release(/* aSyncDeleteFile */ true);
   }
 
   ASSERT_EQ(0u, stats.mSyncDeleteFileCalls);
   ASSERT_EQ(0u, stats.mAsyncDeleteFileCalls);
 }
 
 // XXX Add test for GetFileForFileInfo