summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB
diff options
context:
space:
mode:
Diffstat (limited to 'dom/indexedDB')
-rw-r--r--dom/indexedDB/ActorsParent.cpp143
-rw-r--r--dom/indexedDB/FileManager.h3
2 files changed, 4 insertions, 142 deletions
diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp
index 58c113058..38621cee3 100644
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -4129,7 +4129,6 @@ GetDatabaseFileURL(nsIFile* aDatabaseFile,
PersistenceType aPersistenceType,
const nsACString& aGroup,
const nsACString& aOrigin,
- uint32_t aTelemetryId,
nsIFileURL** aResult)
{
MOZ_ASSERT(aDatabaseFile);
@@ -4161,18 +4160,10 @@ GetDatabaseFileURL(nsIFile* aDatabaseFile,
nsAutoCString type;
PersistenceTypeToText(aPersistenceType, type);
- nsAutoCString telemetryFilenameClause;
- if (aTelemetryId) {
- telemetryFilenameClause.AssignLiteral("&telemetryFilename=indexedDB-");
- telemetryFilenameClause.AppendInt(aTelemetryId);
- telemetryFilenameClause.AppendLiteral(".sqlite");
- }
-
rv = fileUrl->SetQuery(NS_LITERAL_CSTRING("persistenceType=") + type +
NS_LITERAL_CSTRING("&group=") + aGroup +
NS_LITERAL_CSTRING("&origin=") + aOrigin +
- NS_LITERAL_CSTRING("&cache=private") +
- telemetryFilenameClause);
+ NS_LITERAL_CSTRING("&cache=private"));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@@ -4422,7 +4413,6 @@ CreateStorageConnection(nsIFile* aDBFile,
PersistenceType aPersistenceType,
const nsACString& aGroup,
const nsACString& aOrigin,
- uint32_t aTelemetryId,
mozIStorageConnection** aConnection)
{
AssertIsOnIOThread();
@@ -4454,7 +4444,6 @@ CreateStorageConnection(nsIFile* aDBFile,
aPersistenceType,
aGroup,
aOrigin,
- aTelemetryId,
getter_AddRefs(dbFileUrl));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -4890,7 +4879,6 @@ GetStorageConnection(nsIFile* aDatabaseFile,
PersistenceType aPersistenceType,
const nsACString& aGroup,
const nsACString& aOrigin,
- uint32_t aTelemetryId,
mozIStorageConnection** aConnection)
{
MOZ_ASSERT(!NS_IsMainThread());
@@ -4918,7 +4906,6 @@ GetStorageConnection(nsIFile* aDatabaseFile,
aPersistenceType,
aGroup,
aOrigin,
- aTelemetryId,
getter_AddRefs(dbFileUrl));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -4955,7 +4942,6 @@ GetStorageConnection(const nsAString& aDatabaseFilePath,
PersistenceType aPersistenceType,
const nsACString& aGroup,
const nsACString& aOrigin,
- uint32_t aTelemetryId,
mozIStorageConnection** aConnection)
{
MOZ_ASSERT(!NS_IsMainThread());
@@ -4974,7 +4960,6 @@ GetStorageConnection(const nsAString& aDatabaseFilePath,
aPersistenceType,
aGroup,
aOrigin,
- aTelemetryId,
aConnection);
}
@@ -6296,7 +6281,6 @@ private:
const nsCString mId;
const nsString mFilePath;
uint32_t mActiveMutableFileCount;
- const uint32_t mTelemetryId;
const PersistenceType mPersistenceType;
const bool mFileHandleDisabled;
const bool mChromeWriteAccessAllowed;
@@ -6313,7 +6297,6 @@ public:
const Maybe<ContentParentId>& aOptionalContentParentId,
const nsACString& aGroup,
const nsACString& aOrigin,
- uint32_t aTelemetryId,
FullDatabaseMetadata* aMetadata,
FileManager* aFileManager,
already_AddRefed<DirectoryLock> aDirectoryLock,
@@ -6372,12 +6355,6 @@ public:
return mId;
}
- uint32_t
- TelemetryId() const
- {
- return mTelemetryId;
- }
-
PersistenceType
Type() const
{
@@ -7673,8 +7650,6 @@ class OpenDatabaseOp final
// cycles.
VersionChangeOp* mVersionChangeOp;
- uint32_t mTelemetryId;
-
public:
OpenDatabaseOp(Factory* aFactory,
already_AddRefed<ContentParent> aContentParent,
@@ -10302,13 +10277,6 @@ typedef nsDataHashtable<nsIDHashKey, DatabaseLoggingInfo*>
StaticAutoPtr<DatabaseLoggingInfoHashtable> gLoggingInfoHashtable;
-typedef nsDataHashtable<nsUint32HashKey, uint32_t> TelemetryIdHashtable;
-
-StaticAutoPtr<TelemetryIdHashtable> gTelemetryIdHashtable;
-
-// Protects all reads and writes to gTelemetryIdHashtable.
-StaticAutoPtr<Mutex> gTelemetryIdMutex;
-
#ifdef DEBUG
StaticRefPtr<DEBUGThreadSlower> gDEBUGThreadSlower;
@@ -10404,88 +10372,6 @@ DecreaseBusyCount()
}
}
-uint32_t
-TelemetryIdForFile(nsIFile* aFile)
-{
- // May be called on any thread!
-
- MOZ_ASSERT(aFile);
- MOZ_ASSERT(gTelemetryIdMutex);
-
- // The storage directory is structured like this:
- //
- // <profile>/storage/<persistence>/<origin>/idb/<filename>.sqlite
- //
- // For the purposes of this function we're only concerned with the
- // <persistence>, <origin>, and <filename> pieces.
-
- nsString filename;
- MOZ_ALWAYS_SUCCEEDS(aFile->GetLeafName(filename));
-
- // Make sure we were given a database file.
- NS_NAMED_LITERAL_STRING(sqliteExtension, ".sqlite");
-
- MOZ_ASSERT(StringEndsWith(filename, sqliteExtension));
-
- filename.Truncate(filename.Length() - sqliteExtension.Length());
-
- // Get the "idb" directory.
- nsCOMPtr<nsIFile> idbDirectory;
- MOZ_ALWAYS_SUCCEEDS(aFile->GetParent(getter_AddRefs(idbDirectory)));
-
- DebugOnly<nsString> idbLeafName;
- MOZ_ASSERT(NS_SUCCEEDED(idbDirectory->GetLeafName(idbLeafName)));
- MOZ_ASSERT(static_cast<nsString&>(idbLeafName).EqualsLiteral("idb"));
-
- // Get the <origin> directory.
- nsCOMPtr<nsIFile> originDirectory;
- MOZ_ALWAYS_SUCCEEDS(
- idbDirectory->GetParent(getter_AddRefs(originDirectory)));
-
- nsString origin;
- MOZ_ALWAYS_SUCCEEDS(originDirectory->GetLeafName(origin));
-
- // Any databases in these directories are owned by the application and should
- // not have their filenames masked. Hopefully they also appear in the
- // Telemetry.cpp whitelist.
- if (origin.EqualsLiteral("chrome") ||
- origin.EqualsLiteral("moz-safe-about+home")) {
- return 0;
- }
-
- // Get the <persistence> directory.
- nsCOMPtr<nsIFile> persistenceDirectory;
- MOZ_ALWAYS_SUCCEEDS(
- originDirectory->GetParent(getter_AddRefs(persistenceDirectory)));
-
- nsString persistence;
- MOZ_ALWAYS_SUCCEEDS(persistenceDirectory->GetLeafName(persistence));
-
- NS_NAMED_LITERAL_STRING(separator, "*");
-
- uint32_t hashValue = HashString(persistence + separator +
- origin + separator +
- filename);
-
- MutexAutoLock lock(*gTelemetryIdMutex);
-
- if (!gTelemetryIdHashtable) {
- gTelemetryIdHashtable = new TelemetryIdHashtable();
- }
-
- uint32_t id;
- if (!gTelemetryIdHashtable->Get(hashValue, &id)) {
- static uint32_t sNextId = 1;
-
- // We're locked, no need for atomics.
- id = sNextId++;
-
- gTelemetryIdHashtable->Put(hashValue, id);
- }
-
- return id;
-}
-
} // namespace
/*******************************************************************************
@@ -12265,7 +12151,6 @@ ConnectionPool::GetOrCreateConnection(const Database* aDatabase,
aDatabase->Type(),
aDatabase->Group(),
aDatabase->Origin(),
- aDatabase->TelemetryId(),
getter_AddRefs(storageConnection));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -14134,7 +14019,6 @@ Database::Database(Factory* aFactory,
const Maybe<ContentParentId>& aOptionalContentParentId,
const nsACString& aGroup,
const nsACString& aOrigin,
- uint32_t aTelemetryId,
FullDatabaseMetadata* aMetadata,
FileManager* aFileManager,
already_AddRefed<DirectoryLock> aDirectoryLock,
@@ -14151,7 +14035,6 @@ Database::Database(Factory* aFactory,
, mId(aMetadata->mDatabaseId)
, mFilePath(aMetadata->mFilePath)
, mActiveMutableFileCount(0)
- , mTelemetryId(aTelemetryId)
, mPersistenceType(aMetadata->mCommonMetadata.persistenceType())
, mFileHandleDisabled(aFileHandleDisabled)
, mChromeWriteAccessAllowed(aChromeWriteAccessAllowed)
@@ -17391,8 +17274,7 @@ FileManager::InitDirectory(nsIFile* aDirectory,
nsIFile* aDatabaseFile,
PersistenceType aPersistenceType,
const nsACString& aGroup,
- const nsACString& aOrigin,
- uint32_t aTelemetryId)
+ const nsACString& aOrigin)
{
AssertIsOnIOThread();
MOZ_ASSERT(aDirectory);
@@ -17464,7 +17346,6 @@ FileManager::InitDirectory(nsIFile* aDirectory,
aPersistenceType,
aGroup,
aOrigin,
- aTelemetryId,
getter_AddRefs(connection));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -17648,11 +17529,6 @@ QuotaClient::QuotaClient()
{
AssertIsOnBackgroundThread();
MOZ_ASSERT(!sInstance, "We expect this to be a singleton!");
- MOZ_ASSERT(!gTelemetryIdMutex);
-
- // Always create this so that later access to gTelemetryIdHashtable can be
- // properly synchronized.
- gTelemetryIdMutex = new Mutex("IndexedDB gTelemetryIdMutex");
sInstance = this;
}
@@ -17661,14 +17537,8 @@ QuotaClient::~QuotaClient()
{
AssertIsOnBackgroundThread();
MOZ_ASSERT(sInstance == this, "We expect this to be a singleton!");
- MOZ_ASSERT(gTelemetryIdMutex);
MOZ_ASSERT(!mMaintenanceThreadPool);
- // No one else should be able to touch gTelemetryIdHashtable now that the
- // QuotaClient has gone away.
- gTelemetryIdHashtable = nullptr;
- gTelemetryIdMutex = nullptr;
-
sInstance = nullptr;
}
@@ -17942,8 +17812,7 @@ QuotaClient::InitOrigin(PersistenceType aPersistenceType,
initInfo.mDatabaseFile,
aPersistenceType,
aGroup,
- aOrigin,
- TelemetryIdForFile(initInfo.mDatabaseFile));
+ aOrigin);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@@ -19036,7 +18905,6 @@ DatabaseMaintenance::PerformMaintenanceOnDatabase()
mPersistenceType,
mGroup,
mOrigin,
- TelemetryIdForFile(databaseFile),
getter_AddRefs(connection));
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
@@ -21653,7 +21521,6 @@ OpenDatabaseOp::OpenDatabaseOp(Factory* aFactory,
, mMetadata(new FullDatabaseMetadata(aParams.metadata()))
, mRequestedVersion(aParams.metadata().version())
, mVersionChangeOp(nullptr)
- , mTelemetryId(0)
{
if (mContentParent) {
// This is a little scary but it looks safe to call this off the main thread
@@ -21762,8 +21629,6 @@ OpenDatabaseOp::DoDatabaseWork()
return rv;
}
- mTelemetryId = TelemetryIdForFile(dbFile);
-
#ifdef DEBUG
nsString databaseFilePath;
rv = dbFile->GetPath(databaseFilePath);
@@ -21794,7 +21659,6 @@ OpenDatabaseOp::DoDatabaseWork()
persistenceType,
mGroup,
mOrigin,
- mTelemetryId,
getter_AddRefs(connection));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -22677,7 +22541,6 @@ OpenDatabaseOp::EnsureDatabaseActor()
mOptionalContentParentId,
mGroup,
mOrigin,
- mTelemetryId,
mMetadata,
mFileManager,
mDirectoryLock.forget(),
diff --git a/dom/indexedDB/FileManager.h b/dom/indexedDB/FileManager.h
index da917f431..0fba46ec0 100644
--- a/dom/indexedDB/FileManager.h
+++ b/dom/indexedDB/FileManager.h
@@ -58,8 +58,7 @@ public:
nsIFile* aDatabaseFile,
PersistenceType aPersistenceType,
const nsACString& aGroup,
- const nsACString& aOrigin,
- uint32_t aTelemetryId);
+ const nsACString& aOrigin);
static nsresult
GetUsage(nsIFile* aDirectory, uint64_t* aUsage);