Skip to content

Commit

Permalink
Bug 1791767 - Use a serial event target to debug IDB connection threa…
Browse files Browse the repository at this point in the history
…ds. r=dom-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D190598
  • Loading branch information
jjjalkanen committed Oct 13, 2023
1 parent 15ce5d8 commit 418dea5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dom/indexedDB/ActorsParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1612,14 +1612,14 @@ struct ConnectionPool::DatabaseInfo final {
bool mClosing;

#ifdef DEBUG
PRThread* mDEBUGConnectionThread;
nsISerialEventTarget* mDEBUGConnectionEventTarget;
#endif

DatabaseInfo(ConnectionPool* aConnectionPool, const nsACString& aDatabaseId);

void AssertIsOnConnectionThread() const {
MOZ_ASSERT(mDEBUGConnectionThread);
MOZ_ASSERT(PR_GetCurrentThread() == mDEBUGConnectionThread);
MOZ_ASSERT(mDEBUGConnectionEventTarget);
MOZ_ASSERT(GetCurrentSerialEventTarget() == mDEBUGConnectionEventTarget);
}

uint64_t TotalTransactionCount() const {
Expand Down Expand Up @@ -7642,7 +7642,7 @@ ConnectionPool::GetOrCreateConnection(const Database& aDatabase) {
return dbInfo->mConnection;
}

MOZ_ASSERT(!dbInfo->mDEBUGConnectionThread);
MOZ_ASSERT(!dbInfo->mDEBUGConnectionEventTarget);

QM_TRY_UNWRAP(
MovingNotNull<nsCOMPtr<mozIStorageConnection>> storageConnection,
Expand All @@ -7661,7 +7661,7 @@ ConnectionPool::GetOrCreateConnection(const Database& aDatabase) {
NS_ConvertUTF16toUTF8(aDatabase.FilePath()).get()));

#ifdef DEBUG
dbInfo->mDEBUGConnectionThread = PR_GetCurrentThread();
dbInfo->mDEBUGConnectionEventTarget = GetCurrentSerialEventTarget();
#endif

return connection;
Expand Down Expand Up @@ -8483,7 +8483,7 @@ ConnectionPool::CloseConnectionRunnable::Run() {
mDatabaseInfo.mConnection = nullptr;

#ifdef DEBUG
mDatabaseInfo.mDEBUGConnectionThread = nullptr;
mDatabaseInfo.mDEBUGConnectionEventTarget = nullptr;
#endif
}

Expand All @@ -8509,7 +8509,7 @@ ConnectionPool::DatabaseInfo::DatabaseInfo(ConnectionPool* aConnectionPool,
mClosing(false)
#ifdef DEBUG
,
mDEBUGConnectionThread(nullptr)
mDEBUGConnectionEventTarget(nullptr)
#endif
{
AssertIsOnBackgroundThread();
Expand Down

0 comments on commit 418dea5

Please sign in to comment.