Skip to content

Commit

Permalink
Make SQLiteTransaction notify SQLiteDatabaseTracker on macOS
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259062
rdar://112027513

Reviewed by Chris Dumez and Brent Fulgham.

In 265791@main we enabled SQLiteDatabaseTracker on macOS, but it still does nothing because
SQLiteTransaction doesn't notify it. Change SQLiteTransaction to notify the tracker about ongoing
transactions on macOS as well.

* Source/WebCore/platform/sql/SQLiteTransaction.cpp:
(WebCore::SQLiteTransaction::begin):
(WebCore::SQLiteTransaction::commit):
(WebCore::SQLiteTransaction::rollback):
(WebCore::SQLiteTransaction::stop):

Canonical link: https://commits.webkit.org/265918@main
  • Loading branch information
bnham committed Jul 10, 2023
1 parent 9bf05cc commit 722cf99
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions Source/WebCore/platform/sql/SQLiteTransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
#include "SQLiteTransaction.h"

#include "SQLiteDatabase.h"

#if PLATFORM(IOS_FAMILY)
#include "SQLiteDatabaseTracker.h"
#endif

namespace WebCore {

Expand Down Expand Up @@ -58,18 +55,14 @@ void SQLiteTransaction::begin()
// any statements. If that happens, this transaction will fail.
// http://www.sqlite.org/lang_transaction.html
// http://www.sqlite.org/lockingv3.html#locking
#if PLATFORM(IOS_FAMILY)
SQLiteDatabaseTracker::incrementTransactionInProgressCount();
#endif
if (m_readOnly)
m_inProgress = m_db.executeCommand("BEGIN"_s);
else
m_inProgress = m_db.executeCommand("BEGIN IMMEDIATE"_s);
m_db.m_transactionInProgress = m_inProgress;
#if PLATFORM(IOS_FAMILY)
if (!m_inProgress)
SQLiteDatabaseTracker::decrementTransactionInProgressCount();
#endif
}
}

Expand All @@ -79,10 +72,8 @@ void SQLiteTransaction::commit()
ASSERT(m_db.m_transactionInProgress);
m_inProgress = !m_db.executeCommand("COMMIT"_s);
m_db.m_transactionInProgress = m_inProgress;
#if PLATFORM(IOS_FAMILY)
if (!m_inProgress)
SQLiteDatabaseTracker::decrementTransactionInProgressCount();
#endif
}
}

Expand All @@ -97,9 +88,7 @@ void SQLiteTransaction::rollback()
m_db.executeCommand("ROLLBACK"_s);
m_inProgress = false;
m_db.m_transactionInProgress = false;
#if PLATFORM(IOS_FAMILY)
SQLiteDatabaseTracker::decrementTransactionInProgressCount();
#endif
}
}

Expand All @@ -108,9 +97,7 @@ void SQLiteTransaction::stop()
if (m_inProgress) {
m_inProgress = false;
m_db.m_transactionInProgress = false;
#if PLATFORM(IOS_FAMILY)
SQLiteDatabaseTracker::decrementTransactionInProgressCount();
#endif
}
}

Expand Down

0 comments on commit 722cf99

Please sign in to comment.