Reviewed by Brady.
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Nov 2007 00:42:55 +0000 (00:42 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Nov 2007 00:42:55 +0000 (00:42 +0000)
        Pass a VoidCallback to Database::transaction and Database::changeVersion.
        This is not yet hooked up to the database machinery.

        * WebCore.vcproj/WebCore.vcproj:
        * bindings/js/JSDatabaseCustom.cpp:
        (WebCore::JSDatabase::changeVersion):
        (WebCore::JSDatabase::transaction):
        * storage/Database.cpp:
        (WebCore::Database::changeVersion):
        (WebCore::Database::transaction):
        * storage/Database.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27832 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/bindings/js/JSDatabaseCustom.cpp
WebCore/storage/Database.cpp
WebCore/storage/Database.h

index 67233dba9dc38ce2bb3c1ad0857eca829f55b46e..25a0ab0a19430d3e1ef0bc3c21a0e6a2b8c4811e 100644 (file)
@@ -1,3 +1,19 @@
+2007-11-15  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Brady.
+
+        Pass a VoidCallback to Database::transaction and Database::changeVersion.
+        This is not yet hooked up to the database machinery.
+        
+        * WebCore.vcproj/WebCore.vcproj:
+        * bindings/js/JSDatabaseCustom.cpp:
+        (WebCore::JSDatabase::changeVersion):
+        (WebCore::JSDatabase::transaction):
+        * storage/Database.cpp:
+        (WebCore::Database::changeVersion):
+        (WebCore::Database::transaction):
+        * storage/Database.h:
+
 2007-11-15  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Adam.
index e5d510f61144d0bd173ff8b84a2e1ce8d396fd3a..fe66b8a363b2c988a06a75352105bb5e566e2074 100644 (file)
                                RelativePath="..\html\HTMLViewSourceDocument.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\html\VoidCallback.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\html\VoidCallback.h"\r
+                               >\r
+                       </File>\r
                </Filter>\r
                <Filter\r
                        Name="bindings"\r
index fc009b76387370de4ad5dcf9e8a7453280461161..c4e9265005a4c3e1bc2b7b7df29a7dc5c4b90b98 100644 (file)
@@ -36,6 +36,7 @@
 #include "kjs_window.h"
 #include "JSCustomSQLTransactionCallback.h"
 #include "JSCustomSQLTransactionErrorCallback.h"
+#include "JSCustomVoidCallback.h"
 #include "PlatformString.h"
 #include "SQLValue.h"
 #include <kjs/array_instance.h>
@@ -60,8 +61,8 @@ JSValue* JSDatabase::changeVersion(ExecState* exec, const List& args)
     }
     
     RefPtr<SQLTransactionCallback> callback(new JSCustomSQLTransactionCallback(object, frame));
+    
     RefPtr<SQLTransactionErrorCallback> errorCallback;
-        
     if (!args[3]->isNull()) {
         if (!(object = args[3]->getObject())) {
             setDOMException(exec, TYPE_MISMATCH_ERR);
@@ -71,7 +72,17 @@ JSValue* JSDatabase::changeVersion(ExecState* exec, const List& args)
         errorCallback = new JSCustomSQLTransactionErrorCallback(object, frame);
     }
     
-    m_impl->changeVersion(oldVersion, newVersion, callback.release(), errorCallback.release());
+    RefPtr<VoidCallback> successCallback;
+    if (!args[4]->isNull()) {
+        bool ok;
+        successCallback = toVoidCallback(exec, args[4], ok);
+        if (!ok) {
+            setDOMException(exec, TYPE_MISMATCH_ERR);
+            return jsUndefined();
+        }
+    }
+    
+    m_impl->changeVersion(oldVersion, newVersion, callback.release(), errorCallback.release(), successCallback.release());
     
     return jsUndefined();
 }
@@ -101,8 +112,17 @@ JSValue* JSDatabase::transaction(ExecState* exec, const List& args)
         errorCallback = new JSCustomSQLTransactionErrorCallback(object, frame);
     }
 
+    RefPtr<VoidCallback> successCallback;
+    if (args.size() > 2 && !args[2]->isNull()) {
+        bool ok;
+        successCallback = toVoidCallback(exec, args[2], ok);
+        if (!ok) {
+            setDOMException(exec, TYPE_MISMATCH_ERR);
+            return jsUndefined();
+        }
+    }
     
-    m_impl->transaction(callback.release(), errorCallback.release());
+    m_impl->transaction(callback.release(), errorCallback.release(), successCallback.release());
 
     return jsUndefined();
 }
index 0e56ca8dfe2226dc690888e8e2973b6f2403abf1..0b83be49e015244afa628cb7cf6211e6d632f1fa 100644 (file)
@@ -418,12 +418,14 @@ void Database::performTransactionStep()
 }
 
 void Database::changeVersion(const String& oldVersion, const String& newVersion, 
-                             PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback)
+                             PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
+                             PassRefPtr<VoidCallback> successCallback)
 {
     scheduleTransaction(new SQLTransaction(this, callback, errorCallback, new ChangeVersionWrapper(oldVersion, newVersion)));
 }
 
-void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback)
+void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
+                           PassRefPtr<VoidCallback> successCallback)
 {
     scheduleTransaction(new SQLTransaction(this, callback, errorCallback, 0));
 }
index 6f5d86a341283e06ab74a930fdac9bd4263608fc..189335a4250d51940e827a38b12607468874749c 100644 (file)
@@ -38,6 +38,7 @@
 #include "StringHash.h"
 #include "Threading.h"
 #include "Timer.h"
+#include "VoidCallback.h"
 
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
@@ -67,8 +68,10 @@ public:
     static PassRefPtr<Database> openDatabase(Document* document, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, ExceptionCode&);
     String version() const;
     void changeVersion(const String& oldVersion, const String& newVersion, 
-                       PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback);
-    void transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback);
+                       PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
+                       PassRefPtr<VoidCallback> successCallback);
+    void transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
+                     PassRefPtr<VoidCallback> successCallback);
     
 // Internal engine support
     void databaseThreadGoingAway();