Bug 1617170 - Unfriend FileInfo from FileManager and encapsulate access to mFileInfos. r=dom-workers-and-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D64346

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2020-03-06 15:37:52 +00:00
Родитель 6cb20b0f86
Коммит 5432a3d723
3 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -16723,6 +16723,14 @@ nsresult FileManager::GetUsage(nsIFile* aDirectory, uint64_t& aUsage) {
return NS_OK;
}
void FileManager::RemoveFileInfo(const int64_t aId,
const MutexAutoLock& aFilesMutexLock) {
#ifdef DEBUG
aFilesMutexLock.AssertOwns(IndexedDatabaseManager::FileMutex());
#endif
mFileInfos.Remove(aId);
}
/*******************************************************************************
* QuotaClient
******************************************************************************/

Просмотреть файл

@ -76,7 +76,7 @@ void FileInfo::UpdateReferences(ThreadSafeAutoRefCnt& aRefCount, int32_t aDelta,
return;
}
mFileManager->mFileInfos.Remove(Id());
mFileManager->RemoveFileInfo(Id(), lock);
needsCleanup = !mFileManager->Invalidated();
}

Просмотреть файл

@ -8,6 +8,7 @@
#define mozilla_dom_indexeddb_filemanager_h__
#include "mozilla/Attributes.h"
#include "mozilla/Mutex.h"
#include "mozilla/dom/quota/PersistenceType.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
@ -26,8 +27,6 @@ class FileInfo;
// Implemented in ActorsParent.cpp.
class FileManager final {
friend class FileInfo;
typedef mozilla::dom::quota::PersistenceType PersistenceType;
const PersistenceType mPersistenceType;
@ -93,6 +92,8 @@ class FileManager final {
MOZ_MUST_USE RefPtr<FileInfo> CreateFileInfo();
void RemoveFileInfo(int64_t aId, const MutexAutoLock& aFilesMutexLock);
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileManager)
private: