From 38896528d72776032004fd4586132a2ed4b5631e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 5 May 2022 18:11:55 +0000 Subject: [PATCH] Bug 1767989 - Apply readability-make-member-function-const on dom/indexedDB r=dom-storage-reviewers,janv Differential Revision: https://phabricator.services.mozilla.com/D145624 --- dom/indexedDB/ActorsChild.cpp | 9 +++++---- dom/indexedDB/ActorsChild.h | 10 ++++++---- dom/indexedDB/ActorsParent.cpp | 19 ++++++++++--------- dom/indexedDB/DatabaseFileManager.h | 3 ++- dom/indexedDB/IDBFileHandle.cpp | 2 +- dom/indexedDB/IDBFileHandle.h | 2 +- dom/indexedDB/IDBTransaction.cpp | 11 ++++++----- dom/indexedDB/IDBTransaction.h | 8 ++++---- 8 files changed, 35 insertions(+), 29 deletions(-) diff --git a/dom/indexedDB/ActorsChild.cpp b/dom/indexedDB/ActorsChild.cpp index 49c435f40cf8..ac1db5939fc3 100644 --- a/dom/indexedDB/ActorsChild.cpp +++ b/dom/indexedDB/ActorsChild.cpp @@ -1239,7 +1239,8 @@ bool BackgroundFactoryChild::DeallocPBackgroundIDBFactoryRequestChild( PBackgroundIDBDatabaseChild* BackgroundFactoryChild::AllocPBackgroundIDBDatabaseChild( - const DatabaseSpec& aSpec, PBackgroundIDBFactoryRequestChild* aRequest) { + const DatabaseSpec& aSpec, + PBackgroundIDBFactoryRequestChild* aRequest) const { AssertIsOnOwningThread(); auto* const request = static_cast(aRequest); @@ -1651,7 +1652,7 @@ BackgroundDatabaseChild::AllocPBackgroundIDBDatabaseFileChild( } bool BackgroundDatabaseChild::DeallocPBackgroundIDBDatabaseFileChild( - PBackgroundIDBDatabaseFileChild* aActor) { + PBackgroundIDBDatabaseFileChild* aActor) const { AssertIsOnOwningThread(); MOZ_ASSERT(aActor); @@ -1752,7 +1753,7 @@ BackgroundDatabaseChild::RecvPBackgroundIDBVersionChangeTransactionConstructor( PBackgroundMutableFileChild* BackgroundDatabaseChild::AllocPBackgroundMutableFileChild( - const nsString& aName, const nsString& aType) { + const nsString& aName, const nsString& aType) const { AssertIsOnOwningThread(); return new BackgroundMutableFileChild(aName, aType); @@ -2265,7 +2266,7 @@ BackgroundMutableFileChild::AllocPBackgroundFileHandleChild( } bool BackgroundMutableFileChild::DeallocPBackgroundFileHandleChild( - PBackgroundFileHandleChild* aActor) { + PBackgroundFileHandleChild* aActor) const { AssertIsOnOwningThread(); MOZ_ASSERT(aActor); diff --git a/dom/indexedDB/ActorsChild.h b/dom/indexedDB/ActorsChild.h index 96adb0c98cc8..8fd9de26d018 100644 --- a/dom/indexedDB/ActorsChild.h +++ b/dom/indexedDB/ActorsChild.h @@ -114,7 +114,8 @@ class BackgroundFactoryChild final : public PBackgroundIDBFactoryChild { PBackgroundIDBFactoryRequestChild* aActor); PBackgroundIDBDatabaseChild* AllocPBackgroundIDBDatabaseChild( - const DatabaseSpec& aSpec, PBackgroundIDBFactoryRequestChild* aRequest); + const DatabaseSpec& aSpec, + PBackgroundIDBFactoryRequestChild* aRequest) const; bool DeallocPBackgroundIDBDatabaseChild(PBackgroundIDBDatabaseChild* aActor); @@ -261,7 +262,7 @@ class BackgroundDatabaseChild final : public PBackgroundIDBDatabaseChild { const IPCBlob& aIPCBlob); bool DeallocPBackgroundIDBDatabaseFileChild( - PBackgroundIDBDatabaseFileChild* aActor); + PBackgroundIDBDatabaseFileChild* aActor) const; PBackgroundIDBDatabaseRequestChild* AllocPBackgroundIDBDatabaseRequestChild( const DatabaseRequestParams& aParams); @@ -281,7 +282,7 @@ class BackgroundDatabaseChild final : public PBackgroundIDBDatabaseChild { const int64_t& aNextObjectStoreId, const int64_t& aNextIndexId) override; PBackgroundMutableFileChild* AllocPBackgroundMutableFileChild( - const nsString& aName, const nsString& aType); + const nsString& aName, const nsString& aType) const; bool DeallocPBackgroundMutableFileChild(PBackgroundMutableFileChild* aActor); @@ -493,7 +494,8 @@ class BackgroundMutableFileChild final : public PBackgroundMutableFileChild { PBackgroundFileHandleChild* AllocPBackgroundFileHandleChild( const FileMode& aMode); - bool DeallocPBackgroundFileHandleChild(PBackgroundFileHandleChild* aActor); + bool DeallocPBackgroundFileHandleChild( + PBackgroundFileHandleChild* aActor) const; }; class BackgroundRequestChild final : public BackgroundRequestChildBase, diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index e1dbc97655fc..3b9d1ba47b20 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -1583,7 +1583,7 @@ class ConnectionPool final { void PerformIdleDatabaseMaintenance(DatabaseInfo& aDatabaseInfo); - void CloseDatabase(DatabaseInfo& aDatabaseInfo); + void CloseDatabase(DatabaseInfo& aDatabaseInfo) const; bool CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId); }; @@ -3638,7 +3638,8 @@ class CreateIndexOp final : public VersionChangeTransactionOp { nsresult InsertDataFromObjectStore(DatabaseConnection* aConnection); - nsresult InsertDataFromObjectStoreInternal(DatabaseConnection* aConnection); + nsresult InsertDataFromObjectStoreInternal( + DatabaseConnection* aConnection) const; bool Init(TransactionBase& aTransaction) override; @@ -3688,9 +3689,9 @@ class DeleteIndexOp final : public VersionChangeTransactionOp { ~DeleteIndexOp() override = default; - nsresult RemoveReferencesToIndex(DatabaseConnection* aConnection, - const Key& aObjectDataKey, - nsTArray& aIndexValues); + nsresult RemoveReferencesToIndex( + DatabaseConnection* aConnection, const Key& aObjectDataKey, + nsTArray& aIndexValues) const; nsresult DoDatabaseWork(DatabaseConnection* aConnection) override; }; @@ -8653,7 +8654,7 @@ void ConnectionPool::PerformIdleDatabaseMaintenance( NS_DISPATCH_NORMAL)); } -void ConnectionPool::CloseDatabase(DatabaseInfo& aDatabaseInfo) { +void ConnectionPool::CloseDatabase(DatabaseInfo& aDatabaseInfo) const { AssertIsOnOwningThread(); MOZ_DIAGNOSTIC_ASSERT(!aDatabaseInfo.TotalTransactionCount()); aDatabaseInfo.mThreadInfo.AssertValid(); @@ -12413,7 +12414,7 @@ nsresult DatabaseFileManager::SyncDeleteFile(const int64_t aId) { } nsresult DatabaseFileManager::SyncDeleteFile(nsIFile& aFile, - nsIFile& aJournalFile) { + nsIFile& aJournalFile) const { QuotaManager* const quotaManager = EnforcingQuota() ? QuotaManager::Get() : nullptr; MOZ_ASSERT_IF(EnforcingQuota(), quotaManager); @@ -18437,7 +18438,7 @@ nsresult CreateIndexOp::InsertDataFromObjectStore( } nsresult CreateIndexOp::InsertDataFromObjectStoreInternal( - DatabaseConnection* aConnection) { + DatabaseConnection* aConnection) const { MOZ_ASSERT(aConnection); aConnection->AssertIsOnConnectionThread(); MOZ_ASSERT(mMaybeUniqueIndexTable); @@ -18759,7 +18760,7 @@ DeleteIndexOp::DeleteIndexOp(SafeRefPtr aTransaction, nsresult DeleteIndexOp::RemoveReferencesToIndex( DatabaseConnection* aConnection, const Key& aObjectStoreKey, - nsTArray& aIndexValues) { + nsTArray& aIndexValues) const { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); MOZ_ASSERT(aConnection); diff --git a/dom/indexedDB/DatabaseFileManager.h b/dom/indexedDB/DatabaseFileManager.h index 4e1205c4fb12..19086b51ac9e 100644 --- a/dom/indexedDB/DatabaseFileManager.h +++ b/dom/indexedDB/DatabaseFileManager.h @@ -87,7 +87,8 @@ class DatabaseFileManager final // XXX When getting rid of FileHelper, this method should be removed/made // private. - [[nodiscard]] nsresult SyncDeleteFile(nsIFile& aFile, nsIFile& aJournalFile); + [[nodiscard]] nsresult SyncDeleteFile(nsIFile& aFile, + nsIFile& aJournalFile) const; [[nodiscard]] nsresult AsyncDeleteFile(int64_t aFileId); diff --git a/dom/indexedDB/IDBFileHandle.cpp b/dom/indexedDB/IDBFileHandle.cpp index f3286fe77413..b316ee5cd644 100644 --- a/dom/indexedDB/IDBFileHandle.cpp +++ b/dom/indexedDB/IDBFileHandle.cpp @@ -369,7 +369,7 @@ void IDBFileHandle::Abort(ErrorResult& aRv) { Abort(); } -bool IDBFileHandle::CheckState(ErrorResult& aRv) { +bool IDBFileHandle::CheckState(ErrorResult& aRv) const { if (!IsOpen()) { aRv.Throw(NS_ERROR_DOM_FILEHANDLE_INACTIVE_ERR); return false; diff --git a/dom/indexedDB/IDBFileHandle.h b/dom/indexedDB/IDBFileHandle.h index 540eeccd92a2..e00b51253563 100644 --- a/dom/indexedDB/IDBFileHandle.h +++ b/dom/indexedDB/IDBFileHandle.h @@ -208,7 +208,7 @@ class IDBFileHandle final : public DOMEventTargetHelper, IDBFileHandle(IDBMutableFile* aMutableFile, FileMode aMode); ~IDBFileHandle(); - bool CheckState(ErrorResult& aRv); + bool CheckState(ErrorResult& aRv) const; bool CheckStateAndArgumentsForRead(uint64_t aSize, ErrorResult& aRv); diff --git a/dom/indexedDB/IDBTransaction.cpp b/dom/indexedDB/IDBTransaction.cpp index df46d3e020d2..40fd397753fc 100644 --- a/dom/indexedDB/IDBTransaction.cpp +++ b/dom/indexedDB/IDBTransaction.cpp @@ -530,7 +530,7 @@ void IDBTransaction::DeleteObjectStore(const int64_t aObjectStoreId) { } void IDBTransaction::RenameObjectStore(const int64_t aObjectStoreId, - const nsAString& aName) { + const nsAString& aName) const { AssertIsOnOwningThread(); MOZ_ASSERT(aObjectStoreId); MOZ_ASSERT(Mode::VersionChange == mMode); @@ -542,8 +542,9 @@ void IDBTransaction::RenameObjectStore(const int64_t aObjectStoreId, aObjectStoreId, nsString(aName))); } -void IDBTransaction::CreateIndex(IDBObjectStore* const aObjectStore, - const indexedDB::IndexMetadata& aMetadata) { +void IDBTransaction::CreateIndex( + IDBObjectStore* const aObjectStore, + const indexedDB::IndexMetadata& aMetadata) const { AssertIsOnOwningThread(); MOZ_ASSERT(aObjectStore); MOZ_ASSERT(aMetadata.id()); @@ -557,7 +558,7 @@ void IDBTransaction::CreateIndex(IDBObjectStore* const aObjectStore, } void IDBTransaction::DeleteIndex(IDBObjectStore* const aObjectStore, - const int64_t aIndexId) { + const int64_t aIndexId) const { AssertIsOnOwningThread(); MOZ_ASSERT(aObjectStore); MOZ_ASSERT(aIndexId); @@ -572,7 +573,7 @@ void IDBTransaction::DeleteIndex(IDBObjectStore* const aObjectStore, void IDBTransaction::RenameIndex(IDBObjectStore* const aObjectStore, const int64_t aIndexId, - const nsAString& aName) { + const nsAString& aName) const { AssertIsOnOwningThread(); MOZ_ASSERT(aObjectStore); MOZ_ASSERT(aIndexId); diff --git a/dom/indexedDB/IDBTransaction.h b/dom/indexedDB/IDBTransaction.h index ffbb9db43188..65fefddfe5f1 100644 --- a/dom/indexedDB/IDBTransaction.h +++ b/dom/indexedDB/IDBTransaction.h @@ -250,15 +250,15 @@ class IDBTransaction final void DeleteObjectStore(int64_t aObjectStoreId); - void RenameObjectStore(int64_t aObjectStoreId, const nsAString& aName); + void RenameObjectStore(int64_t aObjectStoreId, const nsAString& aName) const; void CreateIndex(IDBObjectStore* aObjectStore, - const indexedDB::IndexMetadata& aMetadata); + const indexedDB::IndexMetadata& aMetadata) const; - void DeleteIndex(IDBObjectStore* aObjectStore, int64_t aIndexId); + void DeleteIndex(IDBObjectStore* aObjectStore, int64_t aIndexId) const; void RenameIndex(IDBObjectStore* aObjectStore, int64_t aIndexId, - const nsAString& aName); + const nsAString& aName) const; void Abort(IDBRequest* aRequest);