зеркало из https://github.com/mozilla/gecko-dev.git
Bug 934640 - Add methods for checking origin and client directory existence; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D191048
This commit is contained in:
Родитель
bb9b3669eb
Коммит
bf65876240
|
@ -3206,6 +3206,15 @@ Result<nsCOMPtr<nsIFile>, nsresult> QuotaManager::GetOriginDirectory(
|
|||
return directory;
|
||||
}
|
||||
|
||||
Result<bool, nsresult> QuotaManager::DoesOriginDirectoryExist(
|
||||
const OriginMetadata& aOriginMetadata) const {
|
||||
AssertIsOnIOThread();
|
||||
|
||||
QM_TRY_INSPECT(const auto& directory, GetOriginDirectory(aOriginMetadata));
|
||||
|
||||
QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE_MEMBER(directory, Exists));
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult QuotaManager::CreateDirectoryMetadata(
|
||||
nsIFile& aDirectory, int64_t aTimestamp,
|
||||
|
@ -3516,6 +3525,18 @@ Result<Ok, nsresult> QuotaManager::RemoveOriginDirectory(nsIFile& aDirectory) {
|
|||
toBeRemovedStorageDir, NSID_TrimBracketsUTF16(nsID::GenerateUUID()))));
|
||||
}
|
||||
|
||||
Result<bool, nsresult> QuotaManager::DoesClientDirectoryExist(
|
||||
const ClientMetadata& aClientMetadata) const {
|
||||
AssertIsOnIOThread();
|
||||
|
||||
QM_TRY_INSPECT(const auto& directory, GetOriginDirectory(aClientMetadata));
|
||||
|
||||
QM_TRY(MOZ_TO_RESULT(
|
||||
directory->Append(Client::TypeToString(aClientMetadata.mClientType))));
|
||||
|
||||
QM_TRY_RETURN(MOZ_TO_RESULT_INVOKE_MEMBER(directory, Exists));
|
||||
}
|
||||
|
||||
template <typename OriginFunc>
|
||||
nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType,
|
||||
OriginFunc&& aOriginFunc) {
|
||||
|
|
|
@ -243,6 +243,9 @@ class QuotaManager final : public BackgroundThreadObject {
|
|||
Result<nsCOMPtr<nsIFile>, nsresult> GetOriginDirectory(
|
||||
const OriginMetadata& aOriginMetadata) const;
|
||||
|
||||
Result<bool, nsresult> DoesOriginDirectoryExist(
|
||||
const OriginMetadata& aOriginMetadata) const;
|
||||
|
||||
static nsresult CreateDirectoryMetadata(
|
||||
nsIFile& aDirectory, int64_t aTimestamp,
|
||||
const OriginMetadata& aOriginMetadata);
|
||||
|
@ -265,6 +268,9 @@ class QuotaManager final : public BackgroundThreadObject {
|
|||
|
||||
Result<Ok, nsresult> RemoveOriginDirectory(nsIFile& aDirectory);
|
||||
|
||||
Result<bool, nsresult> DoesClientDirectoryExist(
|
||||
const ClientMetadata& aClientMetadata) const;
|
||||
|
||||
RefPtr<UniversalDirectoryLockPromise> OpenStorageDirectory(
|
||||
const Nullable<PersistenceType>& aPersistenceType,
|
||||
const OriginScope& aOriginScope,
|
||||
|
|
Загрузка…
Ссылка в новой задаче