Squashed commit of the following:

commit 3e6cb737b3b823b4bf177b9e0c2fcfcc38baf46d
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Nov 13 16:22:36 2007 -0800

    Changelog for commit

commit 4be13a5ef17685368e68a76292b785c99da1d7f2
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Nov 13 16:19:34 2007 -0800

    Make inspector work with new API

commit c500ed90c32b31fbc37a183c8ae5427f36b9ccc2
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Nov 13 14:37:16 2007 -0800

    Woops!

commit c61b147f35a2801c340f82054d177914da6ccde5
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Nov 13 11:45:40 2007 -0800

    Ander's review comments

commit f3dc2683acc5730cbab8758226adae3e35f7263b
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 12 18:05:21 2007 -0800

    Initial vcproj changes after the rebase

commit c8cf9be275479ff1fb39b911e5165f07fcd5ae34
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 12 18:02:30 2007 -0800

    Fixed Changelog a bit

commit c9790cde9b79e25690f1c0b34b9c1e77d2f4449f
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 12 16:53:48 2007 -0800

    Finish the rebase/trunk merge

commit 663ad85619ec677eb5c52bed3c59b8b3f50de624
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Nov 6 11:54:26 2007 -0800

    VCProj changes for new SQL api + blind attempt at keeping qt/gtk going

commit 2aceeb3bdfa6894bb4e93c0b129867059e9cdad7
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 15:27:55 2007 -0800

    Changelog edit cleanup

commit a05f11fa4fa0ba935eb28df6d9628f29a4074d7a
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 15:25:27 2007 -0800

    Changelog entries and small style cleanup

commit a2d34a78d06f446f4bdb6ea1797dfb91cfc336fe
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 13:37:10 2007 -0800

    Minor edit

commit eaf0aa9c07cfeb54df312c130677ecbc60728c5f
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 13:32:20 2007 -0800

    Do version check at time of executeSql

commit 3bac84615badcc810f44ebf14d1679bffd4cc8fb
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 13:04:14 2007 -0800

    Newline = t3h gone

commit de7cfcf737b1a6143b74f1cc60955c317877ca27
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 13:02:11 2007 -0800

    Example + inspector fixes

commit 536b119c219de72c97fe6756e226a36bef5e6880
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 11:47:30 2007 -0800

    DatabaseExample works

commit fff79aa99dbf47955bc37ca325928460fc41a59e
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 10:36:59 2007 -0800

    Remove the old, now unused DatabaseCallback

commit 06bc8e16ad346b755f767ce8e7849da819ccf96f
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 09:57:36 2007 -0800

    Sort project file

commit 741084d108ec994ff513e18c3d7a3153f6dd6bb5
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Nov 5 09:30:37 2007 -0800

    Sort the project file

commit 2e77cec4337db174f56269b7fb406d81ebb1de7d
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Nov 1 16:01:03 2007 -0700

    Yay!  Change version even works!

commit 05c2ed1f22e3b689dd453ea300154492937f46db
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Nov 1 15:19:56 2007 -0700

    Nuke some DRT changes

commit 9b5b9b25c45d7d4720e4ddf4a31f163fb4f7faf2
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Nov 1 15:05:59 2007 -0700

    Nuke some printfs

commit 8503eecdefa95278a15246bb4eed2dccb69af12a
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Nov 1 13:44:32 2007 -0700

    Added "current transaction" to Database and reworked how scheduling goes

commit f70354c9a84d654d28894ab3c6b13679ce494fc3
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Nov 1 11:49:26 2007 -0700

    Things are largely working.  Still need to clean up loose ends in the sticky notes demo and do further testing

commit 417665cd15f020c22af5691577e5c8a072630839
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Nov 1 00:00:47 2007 -0700

    Transaction steps are almost locked up completely.  Still need the SQLError for the transaction error callback and actually implementing ::execute() on the SQLStatement

commit 752d572acd4d1d9832976b4869284e554845205a
Author: Anders Carlsson <andersca@apple.com>
Date:   Wed Oct 31 18:52:55 2007 -0700

    Forgot this.

commit 2c8f2689d212296961a841c579a2f93609858862
Author: Anders Carlsson <andersca@apple.com>
Date:   Wed Oct 31 18:31:05 2007 -0700

    Merge.

commit 7540d4fa7ef858400d9f834cba976a439394412d
Author: Brady Eidson <beidson@apple.com>
Date:   Wed Oct 31 17:14:30 2007 -0700

    Even closer!

commit 143a70a5d026ab9fab1b5de91f826effcd481527
Author: Brady Eidson <beidson@apple.com>
Date:   Wed Oct 31 16:43:31 2007 -0700

    Merge project file correctly

commit 11207e7b6e391a4052fc41f6db42ce30449c7e3e
Author: Anders Carlsson <andersca@apple.com>
Date:   Wed Oct 31 11:04:35 2007 -0700

    Remove more unused methods.

commit 9a0d306d467eb9aa8c19825da03b7abe318c609c
Author: Anders Carlsson <andersca@apple.com>
Date:   Wed Oct 31 11:01:35 2007 -0700

    Add SQLTransactionCallback.idl

commit 12e2fa2858145e3895320293462ec441c35a7e3d
Author: Anders Carlsson <andersca@apple.com>
Date:   Wed Oct 31 10:47:17 2007 -0700

    Fix build.

commit 02f4631705b0f6e0bd3c715c64f4938ea53f4670
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Oct 30 23:36:24 2007 -0700

    All steps now take place in the right order, following the right rules - only thing missing is the actual SQL executing!

commit 6a8c0d7d2beb745c070c55b14beac9a47d373fc4
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Oct 30 18:20:35 2007 -0700

    Closer and closer we roll

commit f945446453ae48a28d6e2f3dcce4660feae0da79
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Oct 30 17:59:25 2007 -0700

    Things are really rolling - transaction steps 1-5 are called as expected.  Downhill from here

commit 138b49b62bc8f3d05b1171e280d403e8b15ef9c4
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Oct 30 14:50:14 2007 -0700

    Use pointer-to-member functions for the transaction steps...  !!!

commit 3eb4f794861827f5c88cd8c36efb144cdc537bd5
Author: Anders Carlsson <andersca@apple.com>
Date:   Tue Oct 30 14:45:59 2007 -0700

    Remove more old cruft.

commit f18835f0709b4aff00903738974dbebb11a224f0
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Oct 30 13:55:05 2007 -0700

    Restore that comment

commit 35b2eac5ac3ec338cc2a8a4fe611f85e62c72dd6
Author: Brady Eidson <beidson@apple.com>
Date:   Tue Oct 30 12:08:29 2007 -0700

    Closer, still, to the new model working.  Lotsa little tweaks

commit a8476702a7d9bb38b8e15966e837ceca5858e9b2
Author: Anders Carlsson <andersca@apple.com>
Date:   Tue Oct 30 11:23:02 2007 -0700

    Wrap changeVersion.

commit aa0d8cc6aaaf674de341996555306eb9f122de3c
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Oct 29 22:35:16 2007 -0700

    Dummy callback as part of transaction steps acheived!  And other architectural changes

commit 01c0a92daf764375be79753bc7bc417aa0205168
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Oct 29 18:23:00 2007 -0700

    Have a the first chunk of transaction steps occuring asynchronously with stubs and printf()s - should be downhill from here.  Also updated the DatabaseExample.html for the portion of the new API that works so far.

commit 6b6e9e7a064424cd6b70489de80c79e7ae950b38
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Oct 29 17:32:30 2007 -0700

    Made DatabaseTasks create mutex/conditions on demand, and renamed the internal sqlitedatabase

commit 99d06513090c2b4e04edda82d82108cf97da245a
Author: Anders Carlsson <andersca@apple.com>
Date:   Mon Oct 29 16:30:52 2007 -0700

    Fix bug.

commit 83def2ce73fa001f5bda3e152ca60e58c563dbed
Author: Anders Carlsson <andersca@apple.com>
Date:   Mon Oct 29 15:17:45 2007 -0700

    Remove some cruft.

commit 9f2c8c21d06d6b379426449357f1ee00a25faeee
Author: Anders Carlsson <andersca@apple.com>
Date:   Mon Oct 29 14:45:54 2007 -0700

    More bindings.

commit 9eae9135ed17179b7bcd225648272d24b76de8b9
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Oct 29 14:19:34 2007 -0700

    Adapt to new openDatabase() method

commit 2e1dad857b190634f4394475e925d2dc518ae1fe
Author: Brady Eidson <beidson@apple.com>
Date:   Mon Oct 29 12:05:53 2007 -0700

    More infrastructure changes for the new spec, getting really close now!

commit b0d8ca9dc7ffe1a424070d5f8587346eca56b76b
Author: Brady Eidson <beidson@apple.com>
Date:   Fri Oct 26 17:25:41 2007 -0700

    More stubbing of infrastructure

commit bb8c6528208a24f129af9a8c09763989e5723157
Author: Anders Carlsson <andersca@apple.com>
Date:   Fri Oct 26 15:38:16 2007 -0700

    Remove SQLVersionChangeCallback.h

commit c77ec8b1d2a7c8cb7a6a0bc42b089c34541cdf83
Author: Brady Eidson <beidson@apple.com>
Date:   Fri Oct 26 15:28:08 2007 -0700

    Make it build (removed the old changeVersion)

commit e205fd2d6cb0cd4e6dd47cf4b6609196d0d8e87d
Author: Brady Eidson <beidson@apple.com>
Date:   Fri Oct 26 14:53:15 2007 -0700

    Even more progress in the architecture change

commit 322f576e2ed8c584244335f918302169c81ea39f
Author: Anders Carlsson <andersca@apple.com>
Date:   Fri Oct 26 14:52:22 2007 -0700

    Add JSSQLTransactionCustom.cpp.

commit 22d0b184e1d5d92574b5caf2b73eb6c7faae84be
Author: Anders Carlsson <andersca@apple.com>
Date:   Fri Oct 26 13:21:55 2007 -0700

    Add new API to Database.

commit 910660c7668f2728850990f8984045de9e41423f
Author: Anders Carlsson <andersca@apple.com>
Date:   Fri Oct 26 11:48:33 2007 -0700

    Add more .IDL files

commit 4d0cbb5b3e8c57076ce0cb743f8a52a5e31c0219
Author: Brady Eidson <beidson@apple.com>
Date:   Fri Oct 26 11:20:54 2007 -0700

    Further groundwork for new API (does not build)

commit d6420aacd1bf610ca53eced12e61ecd074f31bd7
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Oct 25 18:02:23 2007 -0700

    Further stubs and adaptations to the new API

commit ea80b0c14037cfbdccf322146b26b62df2aa8211
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Oct 25 15:51:43 2007 -0700

    Remove closeTransaction()

commit 4e701837674e07111da80a476135f5b73e25210f
Author: Brady Eidson <beidson@apple.com>
Date:   Thu Oct 25 14:05:40 2007 -0700

    Further stubbing and API-matching cleanup

commit f667cf3c7847069a6720296710876394954611bd
Author: Anders Carlsson <andersca@apple.com>
Date:   Wed Oct 24 16:32:58 2007 -0700

    Add extra arguments to Window.openDatabase.

commit efbbe3016a31a9c4a717de25d831406288f8126d
Author: Anders Carlsson <andersca@apple.com>
Date:   Wed Oct 24 14:21:22 2007 -0700

    cleanup.

commit b70a8252a588eee36d06835bad5793361ced35c5
Author: Anders Carlsson <andersca@apple.com>
Date:   Wed Oct 24 12:31:06 2007 -0700

    Stub out a couple of new classes.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h
index 13348f5..d99ed10 100644
--- a/WebCore/storage/SQLTransaction.h
+++ b/WebCore/storage/SQLTransaction.h
@@ -25,18 +25,89 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 #ifndef SQLTransaction_h
 #define SQLTransaction_h
 
 #include "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 {
 
+typedef int ExceptionCode;
+
+class Database;
+class SQLError;
+class SQLStatementCallback;
+class SQLStatementErrorCallback;
+class SQLTransaction;
+class SQLValue;
+class String;
+
+class SQLTransactionWrapper : public ThreadSafeShared<SQLTransactionWrapper> {
+public:
+    virtual ~SQLTransactionWrapper() { }
+    virtual bool performPreflight(SQLTransaction*) = 0;
+    virtual bool performPostflight(SQLTransaction*) = 0;
+    
+    virtual SQLError* sqlError() const = 0;
+};
+
 class SQLTransaction : public ThreadSafeShared<SQLTransaction> {
+public:
+    SQLTransaction(Database*, PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<SQLTransactionWrapper>);
+    
+    void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, 
+                    PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> callbackError, ExceptionCode& e);
+                                        
+    bool performNextStep();
+    void performPendingCallback();
+    
+    Database* database() { return m_database; }
+    
+private:
+    typedef void (SQLTransaction::*TransactionStepMethod)();
+    TransactionStepMethod m_nextStep;
+    
+    void enqueueStatement(PassRefPtr<SQLStatement>);
+    
+    void openTransactionAndPreflight();
+    void deliverTransactionCallback();
+    void scheduleToRunStatements();
+    void runStatements();
+    void getNextStatement();
+    bool runCurrentStatement();
+    void deliverStatementCallback();
+    void postflightAndCommit();
+    void handleTransactionError(bool inCallback);
+    void deliverTransactionErrorCallback();
+    void cleanupAfterTransactionErrorCallback();
+
+    RefPtr<SQLStatement> m_currentStatement;
+    
+    bool m_executeSqlAllowed;
+    
+    Database* m_database;
+    RefPtr<SQLTransactionWrapper> m_wrapper;
+    RefPtr<SQLTransactionCallback> m_callback;
+    RefPtr<SQLTransactionErrorCallback> m_errorCallback;
+    RefPtr<SQLError> m_transactionError;
+    bool m_shouldCommitAfterErrorCallback;
+    
+    Mutex m_statementMutex;
+    Deque<RefPtr<SQLStatement> > m_statementQueue;
+
+    OwnPtr<SQLiteTransaction> m_sqliteTransaction;
 };
     
 } // namespace WebCore
 
 #endif // SQLTransaction_h
-