Clean up the DB classes in preparation for a bigger refactoring.
https://bugs.webkit.org/show_bug.cgi?id=39041

Reviewed by Adam Barth.

* storage/ChangeVersionWrapper.cpp:
* storage/ChangeVersionWrapper.h:
* storage/Database.cpp:
(WebCore::Database::Database):
(WebCore::Database::lastActionChangedDatabase):
(WebCore::Database::lastActionWasInsert):
(WebCore::Database::inProgressTransactionCompleted):
(WebCore::Database::securityOrigin):
* storage/Database.h:
(WebCore::Database::sqliteDatabase):
(WebCore::Database::databaseDebugName):
* storage/DatabaseTask.cpp:
(WebCore::DatabaseTransactionTask::doPerformTask):
* storage/DatabaseTask.h:
* storage/SQLStatement.cpp:
(WebCore::SQLStatement::execute):
* storage/SQLStatement.h:
* storage/SQLTransaction.cpp:
(WebCore::SQLTransaction::SQLTransaction):
(WebCore::SQLTransaction::openTransactionAndPreflight):
(WebCore::SQLTransaction::runStatements):
(WebCore::SQLTransaction::runCurrentStatement):
(WebCore::SQLTransaction::postflightAndCommit):
(WebCore::SQLTransaction::cleanupAfterSuccessCallback):
(WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback):
* storage/SQLTransaction.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60508 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ba1a1ac..67318e77 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-06-01  Dumitru Daniliuc  <dumi@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Clean up the DB classes in preparation for a bigger refactoring.
+        https://bugs.webkit.org/show_bug.cgi?id=39041
+
+        * storage/ChangeVersionWrapper.cpp:
+        * storage/ChangeVersionWrapper.h:
+        * storage/Database.cpp:
+        (WebCore::Database::Database):
+        (WebCore::Database::lastActionChangedDatabase):
+        (WebCore::Database::lastActionWasInsert):
+        (WebCore::Database::inProgressTransactionCompleted):
+        (WebCore::Database::securityOrigin):
+        * storage/Database.h:
+        (WebCore::Database::sqliteDatabase):
+        (WebCore::Database::databaseDebugName):
+        * storage/DatabaseTask.cpp:
+        (WebCore::DatabaseTransactionTask::doPerformTask):
+        * storage/DatabaseTask.h:
+        * storage/SQLStatement.cpp:
+        (WebCore::SQLStatement::execute):
+        * storage/SQLStatement.h:
+        * storage/SQLTransaction.cpp:
+        (WebCore::SQLTransaction::SQLTransaction):
+        (WebCore::SQLTransaction::openTransactionAndPreflight):
+        (WebCore::SQLTransaction::runStatements):
+        (WebCore::SQLTransaction::runCurrentStatement):
+        (WebCore::SQLTransaction::postflightAndCommit):
+        (WebCore::SQLTransaction::cleanupAfterSuccessCallback):
+        (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback):
+        * storage/SQLTransaction.h:
+
 2010-06-01  Rob Buis  <rwlbuis@gmail.com>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/storage/ChangeVersionWrapper.cpp b/WebCore/storage/ChangeVersionWrapper.cpp
index 17a9407..66ca63f 100644
--- a/WebCore/storage/ChangeVersionWrapper.cpp
+++ b/WebCore/storage/ChangeVersionWrapper.cpp
@@ -30,6 +30,9 @@
 
 #if ENABLE(DATABASE)
 #include "Database.h"
+#include "SQLError.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
diff --git a/WebCore/storage/ChangeVersionWrapper.h b/WebCore/storage/ChangeVersionWrapper.h
index b14fe55..86cc182 100644
--- a/WebCore/storage/ChangeVersionWrapper.h
+++ b/WebCore/storage/ChangeVersionWrapper.h
@@ -32,9 +32,12 @@
 
 #include "PlatformString.h"
 #include "SQLTransaction.h"
+#include <wtf/Forward.h>
 
 namespace WebCore {
 
+class SQLError;
+
 class ChangeVersionWrapper : public SQLTransactionWrapper {
 public:
     static PassRefPtr<ChangeVersionWrapper> create(const String& oldVersion, const String& newVersion) { return adoptRef(new ChangeVersionWrapper(oldVersion, newVersion)); }
diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp
index 0644df5..8e40a15 100644
--- a/WebCore/storage/Database.cpp
+++ b/WebCore/storage/Database.cpp
@@ -29,8 +29,6 @@
 #include "config.h"
 #include "Database.h"
 
-#include <wtf/StdLibExtras.h>
-
 #if ENABLE(DATABASE)
 #include "ChangeVersionWrapper.h"
 #include "DatabaseAuthorizer.h"
@@ -40,21 +38,25 @@
 #include "DatabaseTracker.h"
 #include "Document.h"
 #include "ExceptionCode.h"
-#include "Frame.h"
 #include "InspectorController.h"
 #include "Logging.h"
 #include "NotImplemented.h"
 #include "Page.h"
-#include "OriginQuotaManager.h"
-#include "ScriptController.h"
-#include "SQLiteDatabase.h"
-#include "SQLiteFileSystem.h"
-#include "SQLiteStatement.h"
-#include "SQLResultSet.h"
+#include "SQLTransactionCallback.h"
 #include "SQLTransactionClient.h"
 #include "SQLTransactionCoordinator.h"
-
-#endif // ENABLE(DATABASE)
+#include "SQLTransactionErrorCallback.h"
+#include "SQLiteStatement.h"
+#include "ScriptController.h"
+#include "ScriptExecutionContext.h"
+#include "SecurityOrigin.h"
+#include "StringHash.h"
+#include "VoidCallback.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/StdLibExtras.h>
 
 #if USE(JSC)
 #include "JSDOMWindow.h"
@@ -71,8 +73,6 @@
     return name;
 }
 
-#if ENABLE(DATABASE)
-
 static bool isDatabaseAvailable = true;
 
 void Database::setIsAvailable(bool available)
@@ -213,8 +213,8 @@
     , m_creationCallback(creationCallback)
 {
     ASSERT(m_scriptExecutionContext.get());
-    m_mainThreadSecurityOrigin = m_scriptExecutionContext->securityOrigin();
-    m_databaseThreadSecurityOrigin = m_mainThreadSecurityOrigin->threadsafeCopy();
+    m_contextThreadSecurityOrigin = m_scriptExecutionContext->securityOrigin();
+    m_databaseThreadSecurityOrigin = m_contextThreadSecurityOrigin->threadsafeCopy();
     if (m_name.isNull())
         m_name = "";
 
@@ -491,6 +491,18 @@
     m_databaseAuthorizer->setReadOnly();
 }
 
+bool Database::lastActionChangedDatabase()
+{
+    ASSERT(m_databaseAuthorizer);
+    return m_databaseAuthorizer->lastActionChangedDatabase();
+}
+
+bool Database::lastActionWasInsert()
+{
+    ASSERT(m_databaseAuthorizer);
+    return m_databaseAuthorizer->lastActionWasInsert();
+}
+
 static int guidForOriginAndName(const String& origin, const String& name)
 {
     String stringID;
@@ -643,6 +655,13 @@
         scheduleTransaction();
 }
 
+void Database::inProgressTransactionCompleted()
+{
+    MutexLocker locker(m_transactionInProgressMutex);
+    m_transactionInProgress = false;
+    scheduleTransaction();
+}
+
 void Database::scheduleTransaction()
 {
     ASSERT(!m_transactionInProgressMutex.tryLock()); // Locked by caller.
@@ -780,8 +799,8 @@
 
 SecurityOrigin* Database::securityOrigin() const
 {
-    if (scriptExecutionContext()->isContextThread())
-        return m_mainThreadSecurityOrigin.get();
+    if (m_scriptExecutionContext->isContextThread())
+        return m_contextThreadSecurityOrigin.get();
     if (currentThread() == m_scriptExecutionContext->databaseThread()->getThreadID())
         return m_databaseThreadSecurityOrigin.get();
     return 0;
@@ -818,6 +837,6 @@
         m_sqliteDatabase.runIncrementalVacuumCommand();
 }
 
-#endif // ENABLE(DATABASE)
-
 } // namespace WebCore
+
+#endif // ENABLE(DATABASE)
diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h
index 890d98c..4e29c09 100644
--- a/WebCore/storage/Database.h
+++ b/WebCore/storage/Database.h
@@ -31,42 +31,31 @@
 
 #if ENABLE(DATABASE)
 #include "PlatformString.h"
-#include "SecurityOrigin.h"
 #include "SQLiteDatabase.h"
-#include "SQLTransaction.h"
-#include "StringHash.h"
-#include "Timer.h"
-#include "VoidCallback.h"
-
-#include <wtf/Forward.h>
-#include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Deque.h>
-#else
-#include "PlatformString.h"
+#ifndef NDEBUG
+#include "SecurityOrigin.h"
 #endif
 
-#if ENABLE(DATABASE)
+#include <wtf/Deque.h>
+#include <wtf/Forward.h>
+
 namespace WebCore {
 
 class DatabaseAuthorizer;
 class DatabaseCallback;
 class DatabaseThread;
 class ScriptExecutionContext;
-class SQLResultSet;
+class SecurityOrigin;
+class SQLTransaction;
 class SQLTransactionCallback;
 class SQLTransactionClient;
 class SQLTransactionCoordinator;
 class SQLTransactionErrorCallback;
-class SQLValue;
+class VoidCallback;
 
 typedef int ExceptionCode;
 
 class Database : public ThreadSafeShared<Database> {
-    friend class DatabaseTransactionTask;
-    friend class SQLStatement;
-    friend class SQLTransaction;
 public:
     static void setIsAvailable(bool);
     static bool isAvailable();
@@ -74,15 +63,12 @@
     ~Database();
 
     // Direct support for the DOM API
-    static PassRefPtr<Database> openDatabase(ScriptExecutionContext* context, const String& name,
-                                             const String& expectedVersion, const String& displayName,
-                                             unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,
-                                             ExceptionCode&);
+    static PassRefPtr<Database> openDatabase(ScriptExecutionContext*, const String& name, const String& expectedVersion, const String& displayName,
+                                             unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, ExceptionCode&);
     String version() const;
-    void changeVersion(const String& oldVersion, const String& newVersion,
-                       PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
-                       PassRefPtr<VoidCallback> successCallback);
-    void transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
+    void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>,
+                       PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
+    void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
                      PassRefPtr<VoidCallback> successCallback, bool readOnly);
 
     // Internal engine support
@@ -91,11 +77,14 @@
     void disableAuthorizer();
     void enableAuthorizer();
     void setAuthorizerReadOnly();
+    bool lastActionChangedDatabase();
+    bool lastActionWasInsert();
 
     Vector<String> tableNames();
 
     ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext.get(); }
     SecurityOrigin* securityOrigin() const;
+    SQLiteDatabase& sqliteDatabase() { return m_sqliteDatabase; }
     String stringIdentifier() const;
     String displayName() const;
     unsigned long estimatedSize() const;
@@ -127,6 +116,10 @@
 
     bool performOpenAndVerify(ExceptionCode&);
 
+    void inProgressTransactionCompleted();
+    void scheduleTransactionCallback(SQLTransaction*);
+    void scheduleTransactionStep(SQLTransaction*, bool immediately = false);
+
     Vector<String> performGetTableNames();
     void performCreationCallback();
 
@@ -136,15 +129,12 @@
     void incrementalVacuumIfNeeded();
 
 private:
-    Database(ScriptExecutionContext* context, const String& name,
-             const String& expectedVersion, const String& displayName,
-             unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback);
+    Database(ScriptExecutionContext*, const String& name, const String& expectedVersion,
+             const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>);
 
     bool openAndVerifyVersion(ExceptionCode&);
 
     void scheduleTransaction();
-    void scheduleTransactionCallback(SQLTransaction*);
-    void scheduleTransactionStep(SQLTransaction* transaction, bool immediately = false);
 
     Deque<RefPtr<SQLTransaction> > m_transactionQueue;
     Mutex m_transactionInProgressMutex;
@@ -154,7 +144,7 @@
     static void deliverPendingCallback(void*);
 
     RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
-    RefPtr<SecurityOrigin> m_mainThreadSecurityOrigin;
+    RefPtr<SecurityOrigin> m_contextThreadSecurityOrigin;
     RefPtr<SecurityOrigin> m_databaseThreadSecurityOrigin;
     String m_name;
     int m_guid;
@@ -177,21 +167,12 @@
     RefPtr<DatabaseCallback> m_creationCallback;
 
 #ifndef NDEBUG
-    String databaseDebugName() const { return m_mainThreadSecurityOrigin->toString() + "::" + m_name; }
+    String databaseDebugName() const { return m_contextThreadSecurityOrigin->toString() + "::" + m_name; }
 #endif
 };
 
 } // namespace WebCore
 
-#else
-
-namespace WebCore {
-class Database : public ThreadSafeShared<Database> {
-public:
-    static const String& databaseInfoTableName();
-};
-} // namespace WebCore
-
 #endif // ENABLE(DATABASE)
 
 #endif // Database_h
diff --git a/WebCore/storage/DatabaseTask.cpp b/WebCore/storage/DatabaseTask.cpp
index a8038c3..8d5f0a8 100644
--- a/WebCore/storage/DatabaseTask.cpp
+++ b/WebCore/storage/DatabaseTask.cpp
@@ -143,11 +143,8 @@
 
 void DatabaseTransactionTask::doPerformTask()
 {
-    if (m_transaction->performNextStep()) {
-        // The transaction is complete, we can move on to the next one.
-        MutexLocker locker(m_transaction->database()->m_transactionInProgressMutex);
-        m_transaction->database()->scheduleTransaction();
-    }
+    if (m_transaction->performNextStep())
+        m_transaction->database()->inProgressTransactionCompleted();
 }
 
 #ifndef NDEBUG
diff --git a/WebCore/storage/DatabaseTask.h b/WebCore/storage/DatabaseTask.h
index b473f8f..1a820a5 100644
--- a/WebCore/storage/DatabaseTask.h
+++ b/WebCore/storage/DatabaseTask.h
@@ -32,6 +32,7 @@
 #include "Database.h"
 #include "ExceptionCode.h"
 #include "PlatformString.h"
+#include "SQLTransaction.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
@@ -40,13 +41,6 @@
 
 namespace WebCore {
 
-class DatabaseTask;
-class DatabaseThread;
-class SQLValue;
-class SQLCallback;
-class SQLTransaction;
-class VersionChangeCallback;
-
 // Can be used to wait until DatabaseTask is completed.
 // Has to be passed into DatabaseTask::create to be associated with the task.
 class DatabaseTaskSynchronizer : public Noncopyable {
diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp
index 2e1aea2..cd96535 100644
--- a/WebCore/storage/SQLStatement.cpp
+++ b/WebCore/storage/SQLStatement.cpp
@@ -31,12 +31,10 @@
 #if ENABLE(DATABASE)
 
 #include "Database.h"
-#include "DatabaseAuthorizer.h"
 #include "Logging.h"
 #include "SQLError.h"
 #include "SQLiteDatabase.h"
 #include "SQLiteStatement.h"
-#include "SQLResultSet.h"
 #include "SQLStatementCallback.h"
 #include "SQLStatementErrorCallback.h"
 #include "SQLTransaction.h"
@@ -73,7 +71,7 @@
     if (m_readOnly)
         db->setAuthorizerReadOnly();
 
-    SQLiteDatabase* database = &db->m_sqliteDatabase;
+    SQLiteDatabase* database = &db->sqliteDatabase();
 
     SQLiteStatement statement(*database, m_statement);
     int result = statement.prepare();
@@ -130,7 +128,7 @@
         }
     } else if (result == SQLResultDone) {
         // Didn't find anything, or was an insert
-        if (db->m_databaseAuthorizer->lastActionWasInsert())
+        if (db->lastActionWasInsert())
             resultSet->setInsertId(database->lastInsertRowID());
     } else if (result == SQLResultFull) {
         // Return the Quota error - the delegate will be asked for more space and this statement might be re-run
diff --git a/WebCore/storage/SQLStatement.h b/WebCore/storage/SQLStatement.h
index f01f7bf..89af377 100644
--- a/WebCore/storage/SQLStatement.h
+++ b/WebCore/storage/SQLStatement.h
@@ -31,23 +31,18 @@
 #if ENABLE(DATABASE)
 
 #include "PlatformString.h"
-
-#include "SQLError.h"
 #include "SQLResultSet.h"
-#include "SQLStatementCallback.h"
-#include "SQLStatementErrorCallback.h"
 #include "SQLValue.h"
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Threading.h>
+#include <wtf/Forward.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
 class Database;
+class SQLError;
+class SQLStatementCallback;
+class SQLStatementErrorCallback;
 class SQLTransaction;
-class String;
 
 class SQLStatement : public ThreadSafeShared<SQLStatement> {
 public:
@@ -66,7 +61,7 @@
 
     SQLError* sqlError() const { return m_error.get(); }
 private:
-    SQLStatement(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback, bool readOnly);
+    SQLStatement(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, bool readOnly);
 
     void setFailureDueToQuota();
     void clearFailureDueToQuota();
diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp
index 7f16b63..82e9f79 100644
--- a/WebCore/storage/SQLTransaction.cpp
+++ b/WebCore/storage/SQLTransaction.cpp
@@ -31,26 +31,26 @@
 
 #if ENABLE(DATABASE)
 
-#include "ChromeClient.h"
 #include "Database.h"
-#include "DatabaseAuthorizer.h"
-#include "DatabaseDetails.h"
 #include "DatabaseThread.h"
 #include "ExceptionCode.h"
 #include "Logging.h"
-#include "Page.h"
 #include "PlatformString.h"
 #include "ScriptExecutionContext.h"
-#include "Settings.h"
 #include "SQLError.h"
 #include "SQLiteTransaction.h"
-#include "SQLResultSet.h"
 #include "SQLStatement.h"
 #include "SQLStatementCallback.h"
 #include "SQLStatementErrorCallback.h"
+#include "SQLTransactionCallback.h"
 #include "SQLTransactionClient.h"
 #include "SQLTransactionCoordinator.h"
+#include "SQLTransactionErrorCallback.h"
 #include "SQLValue.h"
+#include "VoidCallback.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
 
 // There's no way of knowing exactly how much more space will be required when a statement hits the quota limit.
 // For now, we'll arbitrarily choose currentQuota + 1mb.
@@ -65,8 +65,8 @@
     return adoptRef(new SQLTransaction(db, callback, errorCallback, successCallback, wrapper, readOnly));
 }
 
-SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback,
-                               PassRefPtr<SQLTransactionWrapper> wrapper, bool readOnly)
+SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
+                               PassRefPtr<VoidCallback> successCallback, PassRefPtr<SQLTransactionWrapper> wrapper, bool readOnly)
     : m_nextStep(&SQLTransaction::acquireLock)
     , m_executeSqlAllowed(false)
     , m_database(db)
@@ -234,7 +234,7 @@
 
 void SQLTransaction::openTransactionAndPreflight()
 {
-    ASSERT(!m_database->m_sqliteDatabase.transactionInProgress());
+    ASSERT(!m_database->sqliteDatabase().transactionInProgress());
     ASSERT(m_lockAcquired);
 
     LOG(StorageAPI, "Opening and preflighting transaction %p", this);
@@ -248,18 +248,18 @@
 
     // Set the maximum usage for this transaction if this transactions is not read-only
     if (!m_readOnly)
-        m_database->m_sqliteDatabase.setMaximumSize(m_database->maximumSize());
+        m_database->sqliteDatabase().setMaximumSize(m_database->maximumSize());
 
     ASSERT(!m_sqliteTransaction);
-    m_sqliteTransaction.set(new SQLiteTransaction(m_database->m_sqliteDatabase, m_readOnly));
+    m_sqliteTransaction.set(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly));
 
-    m_database->m_databaseAuthorizer->disable();
+    m_database->disableAuthorizer();
     m_sqliteTransaction->begin();
-    m_database->m_databaseAuthorizer->enable();
+    m_database->enableAuthorizer();
 
     // Transaction Steps 1+2 - Open a transaction to the database, jumping to the error callback if that fails
     if (!m_sqliteTransaction->inProgress()) {
-        ASSERT(!m_database->m_sqliteDatabase.transactionInProgress());
+        ASSERT(!m_database->sqliteDatabase().transactionInProgress());
         m_sqliteTransaction.clear();
         m_transactionError = SQLError::create(0, "unable to open a transaction to the database");
         handleTransactionError(false);
@@ -268,7 +268,7 @@
 
     // Transaction Steps 3 - Peform preflight steps, jumping to the error callback if they fail
     if (m_wrapper && !m_wrapper->performPreflight(this)) {
-        ASSERT(!m_database->m_sqliteDatabase.transactionInProgress());
+        ASSERT(!m_database->sqliteDatabase().transactionInProgress());
         m_sqliteTransaction.clear();
         m_transactionError = m_wrapper->sqlError();
         if (!m_transactionError)
@@ -326,7 +326,7 @@
             // m_shouldRetryCurrentStatement is set to true only when a statement exceeds
             // the quota, which can happen only in a read-write transaction. Therefore, there
             // is no need to check here if the transaction is read-write.
-            m_database->m_sqliteDatabase.setMaximumSize(m_database->maximumSize());
+            m_database->sqliteDatabase().setMaximumSize(m_database->maximumSize());
         } else {
             // If the current statement has already been run, failed due to quota constraints, and we're not retrying it,
             // that means it ended in an error.  Handle it now
@@ -363,10 +363,10 @@
     if (!m_currentStatement)
         return false;
 
-    m_database->m_databaseAuthorizer->reset();
+    m_database->resetAuthorizer();
 
     if (m_currentStatement->execute(m_database.get())) {
-        if (m_database->m_databaseAuthorizer->lastActionChangedDatabase()) {
+        if (m_database->lastActionChangedDatabase()) {
             // Flag this transaction as having changed the database for later delegate notification
             m_modifiedDatabase = true;
             // Also dirty the size of this database file for calculating quota usage
@@ -455,9 +455,9 @@
     // Transacton Step 8+9 - Commit the transaction, jumping to the error callback if that fails
     ASSERT(m_sqliteTransaction);
 
-    m_database->m_databaseAuthorizer->disable();
+    m_database->disableAuthorizer();
     m_sqliteTransaction->commit();
-    m_database->m_databaseAuthorizer->enable();
+    m_database->enableAuthorizer();
 
     // If the commit failed, the transaction will still be marked as "in progress"
     if (m_sqliteTransaction->inProgress()) {
@@ -509,7 +509,7 @@
     // Transaction Step 11 - End transaction steps
     // There is no next step
     LOG(StorageAPI, "Transaction %p is complete\n", this);
-    ASSERT(!m_database->m_sqliteDatabase.transactionInProgress());
+    ASSERT(!m_database->sqliteDatabase().transactionInProgress());
     m_sqliteTransaction.clear();
     m_nextStep = 0;
 
@@ -559,15 +559,15 @@
 {
     ASSERT(m_lockAcquired);
 
-    m_database->m_databaseAuthorizer->disable();
+    m_database->disableAuthorizer();
     if (m_sqliteTransaction) {
         // Transaction Step 12 - Rollback the transaction.
         m_sqliteTransaction->rollback();
 
-        ASSERT(!m_database->m_sqliteDatabase.transactionInProgress());
+        ASSERT(!m_database->sqliteDatabase().transactionInProgress());
         m_sqliteTransaction.clear();
     }
-    m_database->m_databaseAuthorizer->enable();
+    m_database->enableAuthorizer();
 
     // Transaction Step 12 - Any still-pending statements in the transaction are discarded.
     {
@@ -577,7 +577,7 @@
 
     // Transaction is complete!  There is no next step
     LOG(StorageAPI, "Transaction %p is complete with an error\n", this);
-    ASSERT(!m_database->m_sqliteDatabase.transactionInProgress());
+    ASSERT(!m_database->sqliteDatabase().transactionInProgress());
     m_nextStep = 0;
 
     // Now release our callbacks, to break reference cycles.
diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h
index 1b02d01..3cef036 100644
--- a/WebCore/storage/SQLTransaction.h
+++ b/WebCore/storage/SQLTransaction.h
@@ -32,14 +32,9 @@
 
 #include <wtf/Threading.h>
 
-#include "SQLiteTransaction.h"
 #include "SQLStatement.h"
-#include "SQLTransactionCallback.h"
-#include "SQLTransactionErrorCallback.h"
 #include <wtf/Deque.h>
 #include <wtf/Forward.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -48,9 +43,12 @@
 
 class Database;
 class SQLError;
+class SQLiteTransaction;
 class SQLStatementCallback;
 class SQLStatementErrorCallback;
 class SQLTransaction;
+class SQLTransactionCallback;
+class SQLTransactionErrorCallback;
 class SQLValue;
 class String;
 class VoidCallback;
@@ -72,7 +70,7 @@
     ~SQLTransaction();
 
     void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments,
-                    PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> callbackError, ExceptionCode& e);
+                    PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, ExceptionCode&);
 
     void lockAcquired();
     bool performNextStep();