Skip to content

Commit

Permalink
Bug 1749504 - Simplify signature of QuotaManager::CreateDirectoryLock…
Browse files Browse the repository at this point in the history
…; r=dom-storage-reviewers,jstutte

CreateDirectoryLock currently takes three separate arguments which can be
expressed as just one argument.

Changes done in this patch:
- QuotaManager::CreateDirectoryLock changed to take just client metadata
- all call sites updated to reflect the changed signature

Differential Revision: https://phabricator.services.mozilla.com/D185568
  • Loading branch information
janvarga committed Sep 12, 2023
1 parent 13ff443 commit b6a1f2f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 18 deletions.
3 changes: 1 addition & 2 deletions dom/cache/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ Context::QuotaInitRunnable::Run() {

// Open directory
RefPtr<DirectoryLock> directoryLock = quotaManager->CreateDirectoryLock(
PERSISTENCE_TYPE_DEFAULT, *mDirectoryMetadata,
quota::Client::DOMCACHE,
{*mDirectoryMetadata, quota::Client::DOMCACHE},
/* aExclusive */ false);

// DirectoryLock::Acquire() will hold a reference to us as a listener. We
Expand Down
3 changes: 1 addition & 2 deletions dom/fs/parent/datamodel/FileSystemDataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,7 @@ RefPtr<BoolPromise> FileSystemDataManager::BeginOpen() {

RefPtr<quota::ClientDirectoryLock> directoryLock =
mQuotaManager->CreateDirectoryLock(
quota::PERSISTENCE_TYPE_DEFAULT, mOriginMetadata,
mozilla::dom::quota::Client::FILESYSTEM,
{mOriginMetadata, mozilla::dom::quota::Client::FILESYSTEM},
/* aExclusive */ false);

directoryLock->Acquire()
Expand Down
8 changes: 4 additions & 4 deletions dom/indexedDB/ActorsParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12725,7 +12725,7 @@ void DeleteFilesRunnable::Open() {
}

RefPtr<DirectoryLock> directoryLock = quotaManager->CreateDirectoryLock(
mFileManager->Type(), mFileManager->OriginMetadata(), quota::Client::IDB,
{mFileManager->OriginMetadata(), quota::Client::IDB},
/* aExclusive */ false);

mState = State_DirectoryOpenPending;
Expand Down Expand Up @@ -14953,9 +14953,9 @@ nsresult FactoryOp::FinishOpen() {
}()));

// Open directory
RefPtr<DirectoryLock> directoryLock = quotaManager->CreateDirectoryLock(
persistenceType, mOriginMetadata, Client::IDB,
/* aExclusive */ false);
RefPtr<DirectoryLock> directoryLock =
quotaManager->CreateDirectoryLock({mOriginMetadata, Client::IDB},
/* aExclusive */ false);

mState = State::DirectoryOpenPending;

Expand Down
3 changes: 1 addition & 2 deletions dom/localstorage/ActorsParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6853,8 +6853,7 @@ nsresult PrepareDatastoreOp::BeginDatastorePreparationInternal() {

// Open directory
mPendingDirectoryLock = quotaManager->CreateDirectoryLock(
mOriginMetadata.mPersistenceType, mOriginMetadata,
mozilla::dom::quota::Client::LS,
{mOriginMetadata, mozilla::dom::quota::Client::LS},
/* aExclusive */ false);

mNestedState = NestedState::DirectoryOpenPending;
Expand Down
8 changes: 4 additions & 4 deletions dom/quota/ActorsParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4935,12 +4935,12 @@ nsresult QuotaManager::EnsureStorageIsInitializedInternal() {
}

RefPtr<ClientDirectoryLock> QuotaManager::CreateDirectoryLock(
PersistenceType aPersistenceType, const OriginMetadata& aOriginMetadata,
Client::Type aClientType, bool aExclusive) {
const ClientMetadata& aClientMetadata, bool aExclusive) {
AssertIsOnOwningThread();

return DirectoryLockImpl::Create(WrapNotNullUnchecked(this), aPersistenceType,
aOriginMetadata, aClientType, aExclusive);
return DirectoryLockImpl::Create(
WrapNotNullUnchecked(this), aClientMetadata.mPersistenceType,
aClientMetadata, aClientMetadata.mClientType, aExclusive);
}

RefPtr<UniversalDirectoryLock> QuotaManager::CreateDirectoryLockInternal(
Expand Down
3 changes: 1 addition & 2 deletions dom/quota/QuotaManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ class QuotaManager final : public BackgroundThreadObject {
// In other words, protection which the lock represents dies with the lock
// object itself.
RefPtr<ClientDirectoryLock> CreateDirectoryLock(
PersistenceType aPersistenceType, const OriginMetadata& aOriginMetadata,
Client::Type aClientType, bool aExclusive);
const ClientMetadata& aClientMetadata, bool aExclusive);

// XXX RemoveMe once bug 1170279 gets fixed.
RefPtr<UniversalDirectoryLock> CreateDirectoryLockInternal(
Expand Down
3 changes: 1 addition & 2 deletions dom/simpledb/ActorsParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,7 @@ nsresult OpenOp::FinishOpen() {
// Open the directory

RefPtr<DirectoryLock> directoryLock = quotaManager->CreateDirectoryLock(
GetConnection()->GetPersistenceType(), mOriginMetadata,
mozilla::dom::quota::Client::SDB,
{mOriginMetadata, mozilla::dom::quota::Client::SDB},
/* aExclusive */ false);

mState = State::DirectoryOpenPending;
Expand Down

0 comments on commit b6a1f2f

Please sign in to comment.