Make SQLTransactionBackend a member of SQLTransaction
https://bugs.webkit.org/show_bug.cgi?id=160741

Reviewed by Tim Horton.

This is another step towards merging SQLTransaction and SQLTransactionBackend.

* Modules/webdatabase/Database.cpp:
(WebCore::Database::performClose):
(WebCore::Database::scheduleTransaction):
(WebCore::Database::scheduleTransactionStep):
(WebCore::Database::runTransaction):
* Modules/webdatabase/Database.h:
* Modules/webdatabase/DatabaseTask.cpp:
(WebCore::DatabaseTransactionTask::DatabaseTransactionTask):
(WebCore::DatabaseTransactionTask::~DatabaseTransactionTask):
(WebCore::DatabaseTransactionTask::doPerformTask):
* Modules/webdatabase/DatabaseTask.h:
(WebCore::DatabaseTransactionTask::transaction):
* Modules/webdatabase/DatabaseThread.cpp:
* Modules/webdatabase/SQLTransaction.cpp:
(WebCore::SQLTransaction::SQLTransaction):
(WebCore::SQLTransaction::deliverTransactionCallback):
(WebCore::SQLTransaction::deliverTransactionErrorCallback):
(WebCore::SQLTransaction::deliverStatementCallback):
(WebCore::SQLTransaction::deliverQuotaIncreaseCallback):
(WebCore::SQLTransaction::deliverSuccessCallback):
(WebCore::SQLTransaction::executeSQL):
(WebCore::SQLTransaction::computeNextStateAndCleanupIfNeeded):
(WebCore::SQLTransaction::setBackend): Deleted.
* Modules/webdatabase/SQLTransaction.h:
(WebCore::SQLTransaction::backend):
* Modules/webdatabase/SQLTransactionBackend.cpp:
(WebCore::SQLTransactionBackend::SQLTransactionBackend):
(WebCore::SQLTransactionBackend::doCleanup):
(WebCore::SQLTransactionBackend::computeNextStateAndCleanupIfNeeded):
(WebCore::SQLTransactionBackend::acquireLock):
(WebCore::SQLTransactionBackend::lockAcquired):
(WebCore::SQLTransactionBackend::openTransactionAndPreflight):
(WebCore::SQLTransactionBackend::runCurrentStatement):
(WebCore::SQLTransactionBackend::handleCurrentStatementError):
(WebCore::SQLTransactionBackend::handleTransactionError):
(WebCore::SQLTransactionBackend::postflightAndCommit):
(WebCore::SQLTransactionBackend::requestTransitToState):
(WebCore::SQLTransactionBackend::create): Deleted.
* Modules/webdatabase/SQLTransactionBackend.h:
* Modules/webdatabase/SQLTransactionCoordinator.cpp:
(WebCore::getDatabaseIdentifier):
(WebCore::SQLTransactionCoordinator::processPendingTransactions):
(WebCore::SQLTransactionCoordinator::acquireLock):
(WebCore::SQLTransactionCoordinator::releaseLock):
(WebCore::SQLTransactionCoordinator::shutdown):
* Modules/webdatabase/SQLTransactionCoordinator.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@204338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h b/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h
index 9cdc208..71c1723 100644
--- a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h
+++ b/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.h
@@ -47,11 +47,10 @@
 class SQLTransactionWrapper;
 class SQLValue;
 
-class SQLTransactionBackend : public ThreadSafeRefCounted<SQLTransactionBackend>, public SQLTransactionStateMachine<SQLTransactionBackend> {
+class SQLTransactionBackend : public SQLTransactionStateMachine<SQLTransactionBackend> {
 public:
-    static Ref<SQLTransactionBackend> create(Database*, RefPtr<SQLTransaction>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
-
-    virtual ~SQLTransactionBackend();
+    SQLTransactionBackend(Database*, SQLTransaction&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
+    ~SQLTransactionBackend();
 
     void lockAcquired();
     void performNextStep();
@@ -68,7 +67,6 @@
     void executeSQL(std::unique_ptr<SQLStatement>);
     
 private:
-    SQLTransactionBackend(Database*, RefPtr<SQLTransaction>&&, RefPtr<SQLTransactionWrapper>&&, bool readOnly);
 
     void doCleanup();
 
@@ -96,7 +94,7 @@
     void acquireOriginLock();
     void releaseOriginLockIfNeeded();
 
-    RefPtr<SQLTransaction> m_frontend; // Has a reference cycle, and will break in doCleanup().
+    SQLTransaction& m_frontend;
     std::unique_ptr<SQLStatement> m_currentStatementBackend;
 
     RefPtr<Database> m_database;