зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1840545 - Move some file utils to separate files; r=dom-storage-reviewers,jari
Differential Revision: https://phabricator.services.mozilla.com/D182174
This commit is contained in:
Родитель
f59701989d
Коммит
9d981e45a3
|
@ -89,6 +89,7 @@
|
|||
#include "mozilla/dom/quota/Client.h"
|
||||
#include "mozilla/dom/quota/Constants.h"
|
||||
#include "mozilla/dom/quota/DirectoryLock.h"
|
||||
#include "mozilla/dom/quota/FileUtils.h"
|
||||
#include "mozilla/dom/quota/PersistenceType.h"
|
||||
#include "mozilla/dom/quota/PQuota.h"
|
||||
#include "mozilla/dom/quota/PQuotaParent.h"
|
||||
|
@ -1638,25 +1639,6 @@ class RecordQuotaInfoLoadTimeHelper final : public Runnable {
|
|||
* Helper Functions
|
||||
******************************************************************************/
|
||||
|
||||
inline bool IsDotFile(const nsAString& aFileName) {
|
||||
return QuotaManager::IsDotFile(aFileName);
|
||||
}
|
||||
|
||||
inline bool IsOSMetadata(const nsAString& aFileName) {
|
||||
return QuotaManager::IsOSMetadata(aFileName);
|
||||
}
|
||||
|
||||
bool IsOriginMetadata(const nsAString& aFileName) {
|
||||
return aFileName.EqualsLiteral(METADATA_FILE_NAME) ||
|
||||
aFileName.EqualsLiteral(METADATA_V2_FILE_NAME) ||
|
||||
IsOSMetadata(aFileName);
|
||||
}
|
||||
|
||||
bool IsTempMetadata(const nsAString& aFileName) {
|
||||
return aFileName.EqualsLiteral(METADATA_TMP_FILE_NAME) ||
|
||||
aFileName.EqualsLiteral(METADATA_V2_TMP_FILE_NAME);
|
||||
}
|
||||
|
||||
// Return whether the group was actually updated.
|
||||
Result<bool, nsresult> MaybeUpdateGroupForOrigin(
|
||||
OriginMetadata& aOriginMetadata) {
|
||||
|
@ -2715,15 +2697,12 @@ void QuotaManager::Reset() {
|
|||
|
||||
// static
|
||||
bool QuotaManager::IsOSMetadata(const nsAString& aFileName) {
|
||||
return aFileName.EqualsLiteral(DSSTORE_FILE_NAME) ||
|
||||
aFileName.EqualsLiteral(DESKTOP_FILE_NAME) ||
|
||||
aFileName.LowerCaseEqualsLiteral(DESKTOP_INI_FILE_NAME) ||
|
||||
aFileName.LowerCaseEqualsLiteral(THUMBS_DB_FILE_NAME);
|
||||
return mozilla::dom::quota::IsOSMetadata(aFileName);
|
||||
}
|
||||
|
||||
// static
|
||||
bool QuotaManager::IsDotFile(const nsAString& aFileName) {
|
||||
return aFileName.First() == char16_t('.');
|
||||
return mozilla::dom::quota::IsDotFile(aFileName);
|
||||
}
|
||||
|
||||
void QuotaManager::RegisterNormalOriginOp(
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/* -*- 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 "FileUtils.h"
|
||||
|
||||
#include "mozilla/dom/quota/Constants.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define DSSTORE_FILE_NAME ".DS_Store"
|
||||
#define DESKTOP_FILE_NAME ".desktop"
|
||||
#define DESKTOP_INI_FILE_NAME "desktop.ini"
|
||||
#define THUMBS_DB_FILE_NAME "thumbs.db"
|
||||
|
||||
namespace mozilla::dom::quota {
|
||||
|
||||
bool IsOriginMetadata(const nsAString& aFileName) {
|
||||
return aFileName.EqualsLiteral(METADATA_FILE_NAME) ||
|
||||
aFileName.EqualsLiteral(METADATA_V2_FILE_NAME) ||
|
||||
IsOSMetadata(aFileName);
|
||||
}
|
||||
|
||||
bool IsTempMetadata(const nsAString& aFileName) {
|
||||
return aFileName.EqualsLiteral(METADATA_TMP_FILE_NAME) ||
|
||||
aFileName.EqualsLiteral(METADATA_V2_TMP_FILE_NAME);
|
||||
}
|
||||
|
||||
bool IsOSMetadata(const nsAString& aFileName) {
|
||||
return aFileName.EqualsLiteral(DSSTORE_FILE_NAME) ||
|
||||
aFileName.EqualsLiteral(DESKTOP_FILE_NAME) ||
|
||||
aFileName.LowerCaseEqualsLiteral(DESKTOP_INI_FILE_NAME) ||
|
||||
aFileName.LowerCaseEqualsLiteral(THUMBS_DB_FILE_NAME);
|
||||
}
|
||||
|
||||
bool IsDotFile(const nsAString& aFileName) {
|
||||
return aFileName.First() == char16_t('.');
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom::quota
|
|
@ -0,0 +1,24 @@
|
|||
/* -*- 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_QUOTA_FILEUTILS_H_
|
||||
#define DOM_QUOTA_FILEUTILS_H_
|
||||
|
||||
#include "nsStringFwd.h"
|
||||
|
||||
namespace mozilla::dom::quota {
|
||||
|
||||
bool IsOriginMetadata(const nsAString& aFileName);
|
||||
|
||||
bool IsTempMetadata(const nsAString& aFileName);
|
||||
|
||||
bool IsOSMetadata(const nsAString& aFileName);
|
||||
|
||||
bool IsDotFile(const nsAString& aFileName);
|
||||
|
||||
} // namespace mozilla::dom::quota
|
||||
|
||||
#endif // DOM_QUOTA_FILEUTILS_H_
|
|
@ -44,6 +44,7 @@ EXPORTS.mozilla.dom.quota += [
|
|||
"EncryptingOutputStream.h",
|
||||
"EncryptingOutputStream_impl.h",
|
||||
"FileStreams.h",
|
||||
"FileUtils.h",
|
||||
"FirstInitializationAttempts.h",
|
||||
"FirstInitializationAttemptsImpl.h",
|
||||
"ForwardDecls.h",
|
||||
|
@ -85,6 +86,7 @@ UNIFIED_SOURCES += [
|
|||
"DirectoryLockImpl.cpp",
|
||||
"EncryptingOutputStream.cpp",
|
||||
"FileStreams.cpp",
|
||||
"FileUtils.cpp",
|
||||
"GroupInfo.cpp",
|
||||
"GroupInfoPair.cpp",
|
||||
"InitializationTypes.cpp",
|
||||
|
|
Загрузка…
Ссылка в новой задаче