Bug 1065923 - Rename Storage TelemetryVFS to BaseVFS. r=janv

Differential Revision: https://phabricator.services.mozilla.com/D172015
This commit is contained in:
Marco Bonardo 2023-05-10 11:51:48 +00:00
Родитель b95433991f
Коммит b99a4a2645
7 изменённых файлов: 24 добавлений и 26 удалений

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

@ -479,11 +479,11 @@ static const char* xNextSystemCall(sqlite3_vfs* vfs, const char* zName) {
namespace mozilla {
namespace storage {
const char* GetTelemetryVFSName(bool exclusive) {
return exclusive ? "telemetry-vfs-excl" : "telemetry-vfs";
const char* GetBaseVFSName(bool exclusive) {
return exclusive ? "base-vfs-excl" : "base-vfs";
}
UniquePtr<sqlite3_vfs> ConstructTelemetryVFS(bool exclusive) {
UniquePtr<sqlite3_vfs> ConstructBaseVFS(bool exclusive) {
#if defined(XP_WIN)
# define EXPECTED_VFS "win32"
# define EXPECTED_VFS_EXCL "win32"
@ -516,7 +516,7 @@ UniquePtr<sqlite3_vfs> ConstructTelemetryVFS(bool exclusive) {
tvfs->szOsFile =
sizeof(telemetry_file) - sizeof(sqlite3_file) + vfs->szOsFile;
tvfs->mxPathname = vfs->mxPathname;
tvfs->zName = GetTelemetryVFSName(exclusive);
tvfs->zName = GetBaseVFSName(exclusive);
tvfs->pAppData = vfs;
tvfs->xOpen = xOpen;
tvfs->xDelete = xDelete;

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

@ -56,6 +56,7 @@ EXPORTS.mozilla.storage += [
# SEE ABOVE NOTE!
UNIFIED_SOURCES += [
"BaseVFS.cpp",
"FileSystemModule.cpp",
"mozStorageArgValueArray.cpp",
"mozStorageAsyncStatement.cpp",
@ -78,7 +79,6 @@ UNIFIED_SOURCES += [
"ReadOnlyNoLockVFS.cpp",
"SQLCollations.cpp",
"StorageBaseStatementInternal.cpp",
"TelemetryVFS.cpp",
"VacuumManager.cpp",
"Variant.cpp",
]

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

@ -74,7 +74,7 @@ using mozilla::Telemetry::AccumulateCategoricalKeyed;
using mozilla::Telemetry::LABELS_SQLITE_STORE_OPEN;
using mozilla::Telemetry::LABELS_SQLITE_STORE_QUERY;
const char* GetTelemetryVFSName(bool);
const char* GetBaseVFSName(bool);
const char* GetQuotaVFSName();
const char* GetObfuscatingVFSName();
@ -825,8 +825,8 @@ nsresult Connection::initialize(const nsACString& aStorageKey,
mTelemetryFilename.AssignLiteral(":memory:");
int srv = ::sqlite3_open_v2(path.get(), &mDBConn, mFlags,
GetTelemetryVFSName(true));
int srv =
::sqlite3_open_v2(path.get(), &mDBConn, mFlags, GetBaseVFSName(true));
if (srv != SQLITE_OK) {
mDBConn = nullptr;
nsresult rv = convertResultCode(srv);
@ -874,12 +874,12 @@ nsresult Connection::initialize(nsIFile* aDatabaseFile) {
"readonly-immutable-nolock");
} else {
srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn, mFlags,
GetTelemetryVFSName(exclusive));
GetBaseVFSName(exclusive));
if (exclusive && (srv == SQLITE_LOCKED || srv == SQLITE_BUSY)) {
// Retry without trying to get an exclusive lock.
exclusive = false;
srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn,
mFlags, GetTelemetryVFSName(false));
mFlags, GetBaseVFSName(false));
}
}
if (srv != SQLITE_OK) {
@ -897,7 +897,7 @@ nsresult Connection::initialize(nsIFile* aDatabaseFile) {
// first query execution. When initializeInternal fails it closes the
// connection, so we can try to restart it in non-exclusive mode.
srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn, mFlags,
GetTelemetryVFSName(false));
GetBaseVFSName(false));
if (srv == SQLITE_OK) {
rv = initializeInternal();
}
@ -960,7 +960,7 @@ nsresult Connection::initialize(nsIFileURL* aFileURL,
const char* const vfs = hasKey ? GetObfuscatingVFSName()
: hasDirectoryLockId ? GetQuotaVFSName()
: GetTelemetryVFSName(exclusive);
: GetBaseVFSName(exclusive);
int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, vfs);
if (srv != SQLITE_OK) {
@ -2545,7 +2545,7 @@ Connection::EnableModule(const nsACString& aModuleName) {
return NS_ERROR_FAILURE;
}
// Implemented in TelemetryVFS.cpp
// Implemented in QuotaVFS.cpp
already_AddRefed<QuotaObject> GetQuotaObjectForFile(sqlite3_file* pFile);
NS_IMETHODIMP

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

@ -305,8 +305,8 @@ void Service::minimizeMemory() {
}
}
UniquePtr<sqlite3_vfs> ConstructTelemetryVFS(bool);
const char* GetTelemetryVFSName(bool);
UniquePtr<sqlite3_vfs> ConstructBaseVFS(bool);
const char* GetBaseVFSName(bool);
UniquePtr<sqlite3_vfs> ConstructQuotaVFS(const char* aBaseVFSName);
const char* GetQuotaVFSName();
@ -339,25 +339,25 @@ nsresult Service::initialize() {
* / \
* / \
* / \
* telemetry-vfs-excl telemetry-vfs
* base-vfs-excl base-vfs
* / \ / \
* / \ / \
* / \ / \
* unix-excl win32 unix win32
*/
rc = mTelemetrySqliteVFS.Init(ConstructTelemetryVFS(false));
rc = mBaseSqliteVFS.Init(ConstructBaseVFS(false));
if (rc != SQLITE_OK) {
return convertResultCode(rc);
}
rc = mTelemetryExclSqliteVFS.Init(ConstructTelemetryVFS(true));
rc = mBaseExclSqliteVFS.Init(ConstructBaseVFS(true));
if (rc != SQLITE_OK) {
return convertResultCode(rc);
}
rc = mQuotaSqliteVFS.Init(ConstructQuotaVFS(GetTelemetryVFSName(
StaticPrefs::storage_sqlite_exclusiveLock_enabled())));
rc = mQuotaSqliteVFS.Init(ConstructQuotaVFS(
GetBaseVFSName(StaticPrefs::storage_sqlite_exclusiveLock_enabled())));
if (rc != SQLITE_OK) {
return convertResultCode(rc);
}

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

@ -129,8 +129,8 @@ class Service : public mozIStorageService,
// The order of these members should match the order of Init calls in
// initialize(), to ensure that the unregistration takes place in the reverse
// order.
AutoVFSRegistration mTelemetrySqliteVFS;
AutoVFSRegistration mTelemetryExclSqliteVFS;
AutoVFSRegistration mBaseSqliteVFS;
AutoVFSRegistration mBaseExclSqliteVFS;
AutoVFSRegistration mQuotaSqliteVFS;
AutoVFSRegistration mObfuscatingSqliteVFS;
AutoVFSRegistration mReadOnlyNoLockSqliteVFS;

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

@ -8,7 +8,7 @@ support-files =
locale_collation.txt
VacuumParticipant.sys.mjs
[test_retry_on_busy.js]
[test_base_vfs.js]
[test_bug-365166.js]
[test_bug-393952.js]
[test_bug-429521.js]
@ -33,6 +33,7 @@ skip-if = debug
[test_minimizeMemory.js]
[test_page_size_is_32k.js]
[test_readonly-immutable-nolock_vfs.js]
[test_retry_on_busy.js]
[test_sqlite_secure_delete.js]
[test_statement_executeAsync.js]
[test_statement_wrapper_automatically.js]
@ -49,6 +50,3 @@ fail-if = os == "android"
[test_storage_value_array.js]
[test_unicode.js]
[test_vacuum.js]
[test_telemetry_vfs.js]
# Bug 676981: test fails consistently on Android
# fail-if = os == "android"