зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1655067 - Replace raw pointer input parameters by reference; r=dom-workers-and-storage-reviewers,sg
Depends on D85972 Differential Revision: https://phabricator.services.mozilla.com/D84836
This commit is contained in:
Родитель
3bfe487458
Коммит
c142edf3a3
|
@ -39,7 +39,7 @@ Connection::Close() {
|
|||
|
||||
// If we are closing here, then Cache must not have a transaction
|
||||
// open anywhere else. This may fail if storage is corrupted.
|
||||
Unused << NS_WARN_IF(NS_FAILED(db::IncrementalVacuum(this)));
|
||||
Unused << NS_WARN_IF(NS_FAILED(db::IncrementalVacuum(*this)));
|
||||
|
||||
return mBase->Close();
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ nsresult OpenDBConnection(const QuotaInfo& aQuotaInfo, nsIFile* aDBFile,
|
|||
}
|
||||
}
|
||||
|
||||
rv = db::InitializeConnection(conn);
|
||||
rv = db::InitializeConnection(*conn);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -29,73 +29,84 @@ struct SavedResponse;
|
|||
namespace db {
|
||||
|
||||
// Note, this cannot be executed within a transaction.
|
||||
nsresult CreateOrMigrateSchema(mozIStorageConnection* aConn);
|
||||
nsresult CreateOrMigrateSchema(mozIStorageConnection& aConn);
|
||||
|
||||
// Note, this cannot be executed within a transaction.
|
||||
nsresult InitializeConnection(mozIStorageConnection* aConn);
|
||||
nsresult InitializeConnection(mozIStorageConnection& aConn);
|
||||
|
||||
nsresult CreateCacheId(mozIStorageConnection* aConn, CacheId* aCacheIdOut);
|
||||
nsresult CreateCacheId(mozIStorageConnection& aConn, CacheId* aCacheIdOut);
|
||||
|
||||
nsresult DeleteCacheId(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult DeleteCacheId(mozIStorageConnection& aConn, CacheId aCacheId,
|
||||
nsTArray<nsID>& aDeletedBodyIdListOut,
|
||||
int64_t* aDeletedPaddingSizeOut);
|
||||
|
||||
nsresult FindOrphanedCacheIds(mozIStorageConnection* aConn,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult FindOrphanedCacheIds(mozIStorageConnection& aConn,
|
||||
nsTArray<CacheId>& aOrphanedListOut);
|
||||
|
||||
nsresult FindOverallPaddingSize(mozIStorageConnection* aConn,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult FindOverallPaddingSize(mozIStorageConnection& aConn,
|
||||
int64_t* aOverallPaddingSizeOut);
|
||||
|
||||
nsresult GetKnownBodyIds(mozIStorageConnection* aConn,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult GetKnownBodyIds(mozIStorageConnection& aConn,
|
||||
nsTArray<nsID>& aBodyIdListOut);
|
||||
|
||||
nsresult CacheMatch(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult CacheMatch(mozIStorageConnection& aConn, CacheId aCacheId,
|
||||
const CacheRequest& aRequest,
|
||||
const CacheQueryParams& aParams, bool* aFoundResponseOut,
|
||||
SavedResponse* aSavedResponseOut);
|
||||
|
||||
nsresult CacheMatchAll(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult CacheMatchAll(mozIStorageConnection& aConn, CacheId aCacheId,
|
||||
const Maybe<CacheRequest>& aMaybeRequest,
|
||||
const CacheQueryParams& aParams,
|
||||
nsTArray<SavedResponse>& aSavedResponsesOut);
|
||||
|
||||
nsresult CachePut(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult CachePut(mozIStorageConnection& aConn, CacheId aCacheId,
|
||||
const CacheRequest& aRequest, const nsID* aRequestBodyId,
|
||||
const CacheResponse& aResponse, const nsID* aResponseBodyId,
|
||||
nsTArray<nsID>& aDeletedBodyIdListOut,
|
||||
int64_t* aDeletedPaddingSizeOut);
|
||||
|
||||
nsresult CacheDelete(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult CacheDelete(mozIStorageConnection& aConn, CacheId aCacheId,
|
||||
const CacheRequest& aRequest,
|
||||
const CacheQueryParams& aParams,
|
||||
nsTArray<nsID>& aDeletedBodyIdListOut,
|
||||
int64_t* aDeletedPaddingSizeOut, bool* aSuccessOut);
|
||||
|
||||
nsresult CacheKeys(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult CacheKeys(mozIStorageConnection& aConn, CacheId aCacheId,
|
||||
const Maybe<CacheRequest>& aMaybeRequest,
|
||||
const CacheQueryParams& aParams,
|
||||
nsTArray<SavedRequest>& aSavedRequestsOut);
|
||||
|
||||
nsresult StorageMatch(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult StorageMatch(mozIStorageConnection& aConn, Namespace aNamespace,
|
||||
const CacheRequest& aRequest,
|
||||
const CacheQueryParams& aParams, bool* aFoundResponseOut,
|
||||
SavedResponse* aSavedResponseOut);
|
||||
|
||||
nsresult StorageGetCacheId(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
// ToDo: Use Result for output parameters.
|
||||
nsresult StorageGetCacheId(mozIStorageConnection& aConn, Namespace aNamespace,
|
||||
const nsAString& aKey, bool* aFoundCacheOut,
|
||||
CacheId* aCacheIdOut);
|
||||
|
||||
nsresult StoragePutCache(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
nsresult StoragePutCache(mozIStorageConnection& aConn, Namespace aNamespace,
|
||||
const nsAString& aKey, CacheId aCacheId);
|
||||
|
||||
nsresult StorageForgetCache(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
nsresult StorageForgetCache(mozIStorageConnection& aConn, Namespace aNamespace,
|
||||
const nsAString& aKey);
|
||||
|
||||
nsresult StorageGetKeys(mozIStorageConnection* aConn, Namespace aNamespace,
|
||||
nsresult StorageGetKeys(mozIStorageConnection& aConn, Namespace aNamespace,
|
||||
nsTArray<nsString>& aKeysOut);
|
||||
|
||||
// Note, this works best when its NOT executed within a transaction.
|
||||
nsresult IncrementalVacuum(mozIStorageConnection* aConn);
|
||||
nsresult IncrementalVacuum(mozIStorageConnection& aConn);
|
||||
|
||||
// We will wipe out databases with a schema versions less than this. Newer
|
||||
// versions will be migrated on open to the latest schema version.
|
||||
|
|
|
@ -871,7 +871,7 @@ nsresult LockedUpdateDirectoryPaddingFile(nsIFile* aBaseDir,
|
|||
|
||||
// We don't need to add the aIncreaseSize or aDecreaseSize here, because
|
||||
// it's already encompassed within the database.
|
||||
rv = db::FindOverallPaddingSize(aConn, ¤tPaddingSize);
|
||||
rv = db::FindOverallPaddingSize(*aConn, ¤tPaddingSize);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ nsresult LockedUpdateDirectoryPaddingFile(nsIFile* aBaseDir,
|
|||
}
|
||||
|
||||
int64_t paddingSizeFromDB = 0;
|
||||
rv = db::FindOverallPaddingSize(aConn, &paddingSizeFromDB);
|
||||
rv = db::FindOverallPaddingSize(*aConn, &paddingSizeFromDB);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ nsresult LockedUpdateDirectoryPaddingFile(nsIFile* aBaseDir,
|
|||
|
||||
#ifdef DEBUG
|
||||
int64_t paddingSizeFromDB = 0;
|
||||
rv = db::FindOverallPaddingSize(aConn, &paddingSizeFromDB);
|
||||
rv = db::FindOverallPaddingSize(*aConn, &paddingSizeFromDB);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -996,7 +996,7 @@ nsresult LockedDirectoryPaddingRestore(nsIFile* aBaseDir,
|
|||
}
|
||||
|
||||
int64_t paddingSize = 0;
|
||||
rv = db::FindOverallPaddingSize(aConn, &paddingSize);
|
||||
rv = db::FindOverallPaddingSize(*aConn, &paddingSize);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class SetupAction final : public SyncDBAction {
|
|||
}
|
||||
|
||||
// executes in its own transaction
|
||||
rv = db::CreateOrMigrateSchema(aConn);
|
||||
rv = db::CreateOrMigrateSchema(*aConn);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class SetupAction final : public SyncDBAction {
|
|||
|
||||
// Clean up orphaned Cache objects
|
||||
AutoTArray<CacheId, 8> orphanedCacheIdList;
|
||||
nsresult rv = db::FindOrphanedCacheIds(aConn, orphanedCacheIdList);
|
||||
nsresult rv = db::FindOrphanedCacheIds(*aConn, orphanedCacheIdList);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ class SetupAction final : public SyncDBAction {
|
|||
for (uint32_t i = 0; i < orphanedCacheIdList.Length(); ++i) {
|
||||
AutoTArray<nsID, 16> deletedBodyIdList;
|
||||
int64_t deletedPaddingSize = 0;
|
||||
rv = db::DeleteCacheId(aConn, orphanedCacheIdList[i], deletedBodyIdList,
|
||||
&deletedPaddingSize);
|
||||
rv = db::DeleteCacheId(*aConn, orphanedCacheIdList[i],
|
||||
deletedBodyIdList, &deletedPaddingSize);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ class SetupAction final : public SyncDBAction {
|
|||
|
||||
// Clean up orphaned body objects
|
||||
AutoTArray<nsID, 64> knownBodyIdList;
|
||||
rv = db::GetKnownBodyIds(aConn, knownBodyIdList);
|
||||
rv = db::GetKnownBodyIds(*aConn, knownBodyIdList);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ class Manager::DeleteOrphanedCacheAction final : public SyncDBAction {
|
|||
mozStorageTransaction trans(aConn, false,
|
||||
mozIStorageConnection::TRANSACTION_IMMEDIATE);
|
||||
|
||||
nsresult rv = db::DeleteCacheId(aConn, mCacheId, mDeletedBodyIdList,
|
||||
nsresult rv = db::DeleteCacheId(*aConn, mCacheId, mDeletedBodyIdList,
|
||||
&mDeletedPaddingSize);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -555,7 +555,7 @@ class Manager::CacheMatchAction final : public Manager::BaseAction {
|
|||
virtual nsresult RunSyncWithDBOnTarget(
|
||||
const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
|
||||
mozIStorageConnection* aConn) override {
|
||||
nsresult rv = db::CacheMatch(aConn, mCacheId, mArgs.request(),
|
||||
nsresult rv = db::CacheMatch(*aConn, mCacheId, mArgs.request(),
|
||||
mArgs.params(), &mFoundResponse, &mResponse);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -622,7 +622,7 @@ class Manager::CacheMatchAllAction final : public Manager::BaseAction {
|
|||
virtual nsresult RunSyncWithDBOnTarget(
|
||||
const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
|
||||
mozIStorageConnection* aConn) override {
|
||||
nsresult rv = db::CacheMatchAll(aConn, mCacheId, mArgs.maybeRequest(),
|
||||
nsresult rv = db::CacheMatchAll(*aConn, mCacheId, mArgs.maybeRequest(),
|
||||
mArgs.params(), mSavedResponses);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -853,7 +853,7 @@ class Manager::CachePutAllAction final : public DBAction {
|
|||
}
|
||||
|
||||
int64_t deletedPaddingSize = 0;
|
||||
rv = db::CachePut(mConn, mCacheId, e.mRequest,
|
||||
rv = db::CachePut(*mConn, mCacheId, e.mRequest,
|
||||
e.mRequestStream ? &e.mRequestBodyId : nullptr,
|
||||
e.mResponse,
|
||||
e.mResponseStream ? &e.mResponseBodyId : nullptr,
|
||||
|
@ -1092,7 +1092,7 @@ class Manager::CacheDeleteAction final : public Manager::BaseAction {
|
|||
mozIStorageConnection::TRANSACTION_IMMEDIATE);
|
||||
|
||||
nsresult rv =
|
||||
db::CacheDelete(aConn, mCacheId, mArgs.request(), mArgs.params(),
|
||||
db::CacheDelete(*aConn, mCacheId, mArgs.request(), mArgs.params(),
|
||||
mDeletedBodyIdList, &mDeletedPaddingSize, &mSuccess);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -1155,7 +1155,7 @@ class Manager::CacheKeysAction final : public Manager::BaseAction {
|
|||
virtual nsresult RunSyncWithDBOnTarget(
|
||||
const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
|
||||
mozIStorageConnection* aConn) override {
|
||||
nsresult rv = db::CacheKeys(aConn, mCacheId, mArgs.maybeRequest(),
|
||||
nsresult rv = db::CacheKeys(*aConn, mCacheId, mArgs.maybeRequest(),
|
||||
mArgs.params(), mSavedRequests);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -1221,7 +1221,7 @@ class Manager::StorageMatchAction final : public Manager::BaseAction {
|
|||
const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
|
||||
mozIStorageConnection* aConn) override {
|
||||
nsresult rv =
|
||||
db::StorageMatch(aConn, mNamespace, mArgs.request(), mArgs.params(),
|
||||
db::StorageMatch(*aConn, mNamespace, mArgs.request(), mArgs.params(),
|
||||
&mFoundResponse, &mSavedResponse);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -1284,7 +1284,7 @@ class Manager::StorageHasAction final : public Manager::BaseAction {
|
|||
const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
|
||||
mozIStorageConnection* aConn) override {
|
||||
CacheId cacheId;
|
||||
return db::StorageGetCacheId(aConn, mNamespace, mArgs.key(), &mCacheFound,
|
||||
return db::StorageGetCacheId(*aConn, mNamespace, mArgs.key(), &mCacheFound,
|
||||
&cacheId);
|
||||
}
|
||||
|
||||
|
@ -1318,7 +1318,7 @@ class Manager::StorageOpenAction final : public Manager::BaseAction {
|
|||
|
||||
// Look for existing cache
|
||||
bool cacheFound;
|
||||
nsresult rv = db::StorageGetCacheId(aConn, mNamespace, mArgs.key(),
|
||||
nsresult rv = db::StorageGetCacheId(*aConn, mNamespace, mArgs.key(),
|
||||
&cacheFound, &mCacheId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -1328,12 +1328,12 @@ class Manager::StorageOpenAction final : public Manager::BaseAction {
|
|||
return rv;
|
||||
}
|
||||
|
||||
rv = db::CreateCacheId(aConn, &mCacheId);
|
||||
rv = db::CreateCacheId(*aConn, &mCacheId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = db::StoragePutCache(aConn, mNamespace, mArgs.key(), mCacheId);
|
||||
rv = db::StoragePutCache(*aConn, mNamespace, mArgs.key(), mCacheId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -1379,8 +1379,8 @@ class Manager::StorageDeleteAction final : public Manager::BaseAction {
|
|||
mozIStorageConnection::TRANSACTION_IMMEDIATE);
|
||||
|
||||
bool exists;
|
||||
nsresult rv = db::StorageGetCacheId(aConn, mNamespace, mArgs.key(), &exists,
|
||||
&mCacheId);
|
||||
nsresult rv = db::StorageGetCacheId(*aConn, mNamespace, mArgs.key(),
|
||||
&exists, &mCacheId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -1392,7 +1392,7 @@ class Manager::StorageDeleteAction final : public Manager::BaseAction {
|
|||
|
||||
// Don't delete the removing padding size here, we'll delete it on
|
||||
// DeleteOrphanedCacheAction.
|
||||
rv = db::StorageForgetCache(aConn, mNamespace, mArgs.key());
|
||||
rv = db::StorageForgetCache(*aConn, mNamespace, mArgs.key());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -1446,7 +1446,7 @@ class Manager::StorageKeysAction final : public Manager::BaseAction {
|
|||
virtual nsresult RunSyncWithDBOnTarget(
|
||||
const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
|
||||
mozIStorageConnection* aConn) override {
|
||||
return db::StorageGetKeys(aConn, mNamespace, mKeys);
|
||||
return db::StorageGetKeys(*aConn, mNamespace, mKeys);
|
||||
}
|
||||
|
||||
virtual void Complete(Listener* aListener, ErrorResult&& aRv) override {
|
||||
|
|
|
@ -179,7 +179,7 @@ static nsresult LockedGetPaddingSizeFromDB(nsIFile* aDir,
|
|||
// by QuotaClient::GetUsageForOrigin which may run at any time (there's no
|
||||
// guarantee that SetupAction::RunSyncWithDBOnTarget already checked the
|
||||
// schema for the given origin).
|
||||
rv = mozilla::dom::cache::db::CreateOrMigrateSchema(conn);
|
||||
rv = mozilla::dom::cache::db::CreateOrMigrateSchema(*conn);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче