зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1697115 - Rationalize QuotaManager::ResetUsageForClient arguments; r=dom-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D107616
This commit is contained in:
Родитель
b59182de8d
Коммит
c546aae9a0
|
@ -5052,8 +5052,8 @@ void Datastore::ConnectionClosedCallback() {
|
|||
QuotaManager* quotaManager = QuotaManager::Get();
|
||||
MOZ_ASSERT(quotaManager);
|
||||
|
||||
quotaManager->ResetUsageForClient(PERSISTENCE_TYPE_DEFAULT, mOriginMetadata,
|
||||
mozilla::dom::quota::Client::LS);
|
||||
quotaManager->ResetUsageForClient(
|
||||
ClientMetadata{mOriginMetadata, mozilla::dom::quota::Client::LS});
|
||||
}
|
||||
|
||||
mConnection = nullptr;
|
||||
|
|
|
@ -3920,28 +3920,27 @@ void QuotaManager::DecreaseUsageForClient(const ClientMetadata& aClientMetadata,
|
|||
}
|
||||
}
|
||||
|
||||
void QuotaManager::ResetUsageForClient(PersistenceType aPersistenceType,
|
||||
const OriginMetadata& aOriginMetadata,
|
||||
Client::Type aClientType) {
|
||||
void QuotaManager::ResetUsageForClient(const ClientMetadata& aClientMetadata) {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aPersistenceType != PERSISTENCE_TYPE_PERSISTENT);
|
||||
MOZ_ASSERT(IsBestEffortPersistenceType(aClientMetadata.mPersistenceType));
|
||||
|
||||
MutexAutoLock lock(mQuotaMutex);
|
||||
|
||||
GroupInfoPair* pair;
|
||||
if (!mGroupInfoPairs.Get(aOriginMetadata.mGroup, &pair)) {
|
||||
if (!mGroupInfoPairs.Get(aClientMetadata.mGroup, &pair)) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<GroupInfo> groupInfo = pair->LockedGetGroupInfo(aPersistenceType);
|
||||
RefPtr<GroupInfo> groupInfo =
|
||||
pair->LockedGetGroupInfo(aClientMetadata.mPersistenceType);
|
||||
if (!groupInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<OriginInfo> originInfo =
|
||||
groupInfo->LockedGetOriginInfo(aOriginMetadata.mOrigin);
|
||||
groupInfo->LockedGetOriginInfo(aClientMetadata.mOrigin);
|
||||
if (originInfo) {
|
||||
originInfo->LockedResetUsageForClient(aClientType);
|
||||
originInfo->LockedResetUsageForClient(aClientMetadata.mClientType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8989,6 +8988,8 @@ void ClearRequestBase::DeleteFiles(QuotaManager& aQuotaManager,
|
|||
const auto& metadata,
|
||||
aQuotaManager.LoadFullOriginMetadataWithRestore(file));
|
||||
|
||||
MOZ_ASSERT(metadata.mPersistenceType == aPersistenceType);
|
||||
|
||||
if (!mClientType.IsNull()) {
|
||||
nsAutoString clientDirectoryName;
|
||||
QM_TRY(OkIf(Client::TypeToText(mClientType.Value(),
|
||||
|
@ -9031,7 +9032,7 @@ void ClearRequestBase::DeleteFiles(QuotaManager& aQuotaManager,
|
|||
metadata);
|
||||
} else {
|
||||
aQuotaManager.ResetUsageForClient(
|
||||
aPersistenceType, metadata, mClientType.Value());
|
||||
ClientMetadata{metadata, mClientType.Value()});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -171,9 +171,7 @@ class QuotaManager final : public BackgroundThreadObject {
|
|||
void DecreaseUsageForClient(const ClientMetadata& aClientMetadata,
|
||||
int64_t aSize);
|
||||
|
||||
void ResetUsageForClient(PersistenceType aPersistenceType,
|
||||
const OriginMetadata& aOriginMetadata,
|
||||
Client::Type aClientType);
|
||||
void ResetUsageForClient(const ClientMetadata& aClientMetadata);
|
||||
|
||||
UsageInfo GetUsageForClient(PersistenceType aPersistenceType,
|
||||
const OriginMetadata& aOriginMetadata,
|
||||
|
|
Загрузка…
Ссылка в новой задаче