WebCore: Implementing DatabaseSync::transaction() and DatabaseSync::changeVersion().
authordumi@chromium.org <dumi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jul 2010 04:46:52 +0000 (04:46 +0000)
committerdumi@chromium.org <dumi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jul 2010 04:46:52 +0000 (04:46 +0000)
commit3c0775b8a8cce662b14e14e1975f7d7982a6cfde
treec3d1455aac06303e029e505b38e3b7afafe2634c
parent98b710450dfbd9fd48cfd697376a9865e98054e5
WebCore: Implementing DatabaseSync::transaction() and DatabaseSync::changeVersion().
https://bugs.webkit.org/show_bug.cgi?id=40607

Reviewed by Darin Fisher

Tests: fast/workers/storage/change-version-handle-reuse-sync.html
       fast/workers/storage/change-version-sync.html
       fast/workers/storage/empty-statement-sync.html
       fast/workers/storage/execute-sql-args-sync.html
       fast/workers/storage/executesql-accepts-only-one-statement-sync.html
       fast/workers/storage/multiple-transactions-on-different-handles-sync.html
       fast/workers/storage/open-database-creation-callback-sync.html
       fast/workers/storage/open-database-empty-version-sync.html
       fast/workers/storage/open-database-inputs-sync.html
       fast/workers/storage/open-database-set-empty-version-sync.html
       fast/workers/storage/open-database-while-transaction-in-progress-sync.html
       fast/workers/storage/sql-data-types-sync.html
       fast/workers/storage/sql-exception-codes-sync.html
       fast/workers/storage/test-authorizer-sync.html
       fast/workers/storage/transaction-in-transaction-sync.html

* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* storage/AbstractDatabase.cpp:
(WebCore::AbstractDatabase::maximumSize):
(WebCore::AbstractDatabase::incrementalVacuumIfNeeded):
* storage/AbstractDatabase.h:
(WebCore::AbstractDatabase::sqliteDatabase):
* storage/ChangeVersionWrapper.cpp:
(WebCore::ChangeVersionWrapper::performPreflight):
(WebCore::ChangeVersionWrapper::performPostflight):
* storage/Database.cpp:
(WebCore::Database::performGetTableNames):
* storage/Database.h:
* storage/DatabaseAuthorizer.cpp:
(WebCore::DatabaseAuthorizer::createVTable):
(WebCore::DatabaseAuthorizer::dropVTable):
* storage/DatabaseCallback.h:
* storage/DatabaseSync.cpp:
(WebCore::ChangeVersionPreflightStep::create):
(WebCore::ChangeVersionPreflightStep::performStep):
(WebCore::ChangeVersionPreflightStep::ChangeVersionPreflightStep):
(WebCore::ChangeVersionPostflightStep::create):
(WebCore::ChangeVersionPostflightStep::performStep):
(WebCore::ChangeVersionPostflightStep::ChangeVersionPostflightStep):
(WebCore::DatabaseSync::changeVersion):
(WebCore::DatabaseSync::transaction):
(WebCore::DatabaseSync::runTransaction):
* storage/DatabaseSync.h:
* storage/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::getMaxSizeForDatabase):
* storage/SQLError.h:
* storage/SQLResultSet.cpp:
* storage/SQLResultSet.h:
* storage/SQLStatementCallback.h:
* storage/SQLStatementErrorCallback.h:
* storage/SQLStatementSync.cpp: Copied from WebCore/storage/SQLStatement.cpp.
(WebCore::SQLStatementSync::SQLStatementSync):
(WebCore::SQLStatementSync::execute):
* storage/SQLStatementSync.h: Added.
* storage/SQLTransaction.cpp:
(WebCore::SQLTransaction::runCurrentStatement):
(WebCore::SQLTransaction::deliverQuotaIncreaseCallback):
(WebCore::SQLTransaction::postflightAndCommit):
* storage/SQLTransaction.h:
* storage/SQLTransactionCallback.h:
* storage/SQLTransactionClient.cpp:
(WebCore::SQLTransactionClient::didCommitWriteTransaction):
(WebCore::SQLTransactionClient::didExecuteStatement):
(WebCore::SQLTransactionClient::didExceedQuota):
* storage/SQLTransactionClient.h:
* storage/SQLTransactionErrorCallback.h:
* storage/SQLTransactionSync.cpp:
(WebCore::transactionClient):
(WebCore::SQLTransactionSync::create):
(WebCore::SQLTransactionSync::SQLTransactionSync):
(WebCore::SQLTransactionSync::~SQLTransactionSync):
(WebCore::SQLTransactionSync::executeSQL):
(WebCore::SQLTransactionSync::begin):
(WebCore::SQLTransactionSync::execute):
(WebCore::SQLTransactionSync::commit):
(WebCore::SQLTransactionSync::rollback):
* storage/SQLTransactionSync.h:
(WebCore::SQLTransactionSync::SQLTransactionSyncOptionalStep::~SQLTransactionSyncOptionalStep):
* storage/SQLTransactionSyncCallback.h:
* storage/chromium/SQLTransactionClientChromium.cpp:
(WebCore::SQLTransactionClient::didCommitWriteTransaction):
(WebCore::SQLTransactionClient::didExecuteStatement):
(WebCore::SQLTransactionClient::didExceedQuota):

LayoutTests: Porting as many async DB tests as possible to sync DBs.
https://bugs.webkit.org/show_bug.cgi?id=40607

Reviewed by Darin Fisher.

* fast/workers/storage/change-version-handle-reuse-sync-expected.txt: Added.
* fast/workers/storage/change-version-handle-reuse-sync.html: Added.
* fast/workers/storage/change-version-sync-expected.txt: Added.
* fast/workers/storage/change-version-sync.html: Added.
* fast/workers/storage/empty-statement-sync-expected.txt: Added.
* fast/workers/storage/empty-statement-sync.html: Added.
* fast/workers/storage/execute-sql-args-sync-expected.txt: Added.
* fast/workers/storage/execute-sql-args-sync.html: Added.
* fast/workers/storage/executesql-accepts-only-one-statement-sync-expected.txt: Added.
* fast/workers/storage/executesql-accepts-only-one-statement-sync.html: Added.
* fast/workers/storage/multiple-transactions-on-different-handles-sync-expected.txt: Added.
* fast/workers/storage/multiple-transactions-on-different-handles-sync.html: Added.
* fast/workers/storage/open-database-creation-callback-sync-expected.txt: Added.
* fast/workers/storage/open-database-creation-callback-sync.html: Added.
* fast/workers/storage/open-database-empty-version-sync-expected.txt: Added.
* fast/workers/storage/open-database-empty-version-sync.html: Added.
* fast/workers/storage/open-database-inputs-sync-expected.txt: Copied from LayoutTests/fast/workers/storage/open-database-sync-inputs-expected.txt.
* fast/workers/storage/open-database-inputs-sync.html: Copied from LayoutTests/fast/workers/storage/open-database-sync-inputs.html.
* fast/workers/storage/open-database-set-empty-version-sync-expected.txt: Added.
* fast/workers/storage/open-database-set-empty-version-sync.html: Added.
* fast/workers/storage/open-database-sync-inputs-expected.txt: Removed.
* fast/workers/storage/open-database-sync-inputs.html: Removed.
* fast/workers/storage/open-database-while-transaction-in-progress-sync-expected.txt: Added.
* fast/workers/storage/open-database-while-transaction-in-progress-sync.html: Added.
* fast/workers/storage/resources/change-version-handle-reuse-sync.js: Added.
(catch):
* fast/workers/storage/resources/change-version-sync-1.js: Added.
():
(try):
* fast/workers/storage/resources/change-version-sync-2.js: Added.
* fast/workers/storage/resources/empty-statement-sync.js: Added.
* fast/workers/storage/resources/execute-sql-args-sync.js: Added.
(throwOnToStringObject.toString):
(var):
():
(runTransactionTest):
(runTransactionTests):
* fast/workers/storage/resources/executesql-accepts-only-one-statement-sync.js: Added.
(executeStatement):
* fast/workers/storage/resources/multiple-transactions-on-different-handles-sync.js: Added.
(runTransaction):
(var):
* fast/workers/storage/resources/multiple-transactions-sync.js: Added.
(checkCompletion):
(runTest.db):
(runTest):
* fast/workers/storage/resources/open-database-creation-callback-sync.js: Added.
* fast/workers/storage/resources/open-database-empty-version-sync.js: Added.
* fast/workers/storage/resources/open-database-inputs-sync.js: Copied from LayoutTests/fast/workers/storage/resources/open-database-sync-inputs.js.
* fast/workers/storage/resources/open-database-set-empty-version-sync.js: Added.
* fast/workers/storage/resources/open-database-sync-inputs.js: Removed.
* fast/workers/storage/resources/open-database-while-transaction-in-progress-sync.js: Added.
(openTestDatabase):
* fast/workers/storage/resources/sql-data-types-sync.js: Added.
():
(testDBValues):
* fast/workers/storage/resources/sql-exception-codes-sync.js: Added.
(testTransaction):
():
(testInvalidStatement):
(testIncorrectNumberOfBindParameters):
(testBindParameterOfWrongType.badString.toString):
(testBindParameterOfWrongType):
(testVersionMismatch.testTransaction):
(testVersionMismatch):
* fast/workers/storage/resources/test-authorizer-sync.js: Added.
(cleanup):
(executeStatement):
(createTableCallback):
(createStatementsCallback):
(otherStatementsCallback):
(dropStatementsCallback):
(testReadWriteMode):
(testReadOnlyMode):
* fast/workers/storage/resources/transaction-in-transaction-sync.js: Added.
* fast/workers/storage/sql-data-types-sync-expected.txt: Added.
* fast/workers/storage/sql-data-types-sync.html: Added.
* fast/workers/storage/sql-exception-codes-sync-expected.txt: Added.
* fast/workers/storage/sql-exception-codes-sync.html: Added.
* fast/workers/storage/test-authorizer-sync-expected.txt: Added.
* fast/workers/storage/test-authorizer-sync.html: Added.
* fast/workers/storage/transaction-in-transaction-sync-expected.txt: Added.
* fast/workers/storage/transaction-in-transaction-sync.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63278 268f45cc-cd09-0410-ab3c-d52691b4dbfc
85 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/workers/storage/change-version-handle-reuse-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/change-version-handle-reuse-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/change-version-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/change-version-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/empty-statement-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/empty-statement-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/execute-sql-args-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/execute-sql-args-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/executesql-accepts-only-one-statement-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/executesql-accepts-only-one-statement-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/multiple-transactions-on-different-handles-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/multiple-transactions-on-different-handles-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/open-database-creation-callback-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/open-database-creation-callback-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/open-database-empty-version-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/open-database-empty-version-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt [moved from LayoutTests/fast/workers/storage/open-database-sync-inputs-expected.txt with 100% similarity]
LayoutTests/fast/workers/storage/open-database-inputs-sync.html [moved from LayoutTests/fast/workers/storage/open-database-sync-inputs.html with 77% similarity]
LayoutTests/fast/workers/storage/open-database-set-empty-version-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/open-database-set-empty-version-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/open-database-while-transaction-in-progress-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/open-database-while-transaction-in-progress-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/change-version-handle-reuse-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/change-version-sync-1.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/change-version-sync-2.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/empty-statement-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/execute-sql-args-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/executesql-accepts-only-one-statement-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/multiple-transactions-on-different-handles-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/multiple-transactions-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/open-database-creation-callback-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/open-database-empty-version-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/open-database-inputs-sync.js [moved from LayoutTests/fast/workers/storage/resources/open-database-sync-inputs.js with 100% similarity]
LayoutTests/fast/workers/storage/resources/open-database-set-empty-version-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/open-database-while-transaction-in-progress-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/sql-data-types-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/sql-exception-codes-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/test-authorizer-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/resources/transaction-in-transaction-sync.js [new file with mode: 0644]
LayoutTests/fast/workers/storage/sql-data-types-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/sql-data-types-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/sql-exception-codes-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/sql-exception-codes-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/test-authorizer-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/test-authorizer-sync.html [new file with mode: 0644]
LayoutTests/fast/workers/storage/transaction-in-transaction-sync-expected.txt [new file with mode: 0644]
LayoutTests/fast/workers/storage/transaction-in-transaction-sync.html [new file with mode: 0644]
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/storage/AbstractDatabase.cpp
WebCore/storage/AbstractDatabase.h
WebCore/storage/ChangeVersionWrapper.cpp
WebCore/storage/Database.cpp
WebCore/storage/Database.h
WebCore/storage/DatabaseAuthorizer.cpp
WebCore/storage/DatabaseCallback.h
WebCore/storage/DatabaseSync.cpp
WebCore/storage/DatabaseSync.h
WebCore/storage/DatabaseSync.idl
WebCore/storage/DatabaseTracker.cpp
WebCore/storage/SQLError.h
WebCore/storage/SQLResultSet.cpp
WebCore/storage/SQLResultSet.h
WebCore/storage/SQLStatementCallback.h
WebCore/storage/SQLStatementErrorCallback.h
WebCore/storage/SQLStatementSync.cpp [new file with mode: 0644]
WebCore/storage/SQLStatementSync.h [new file with mode: 0644]
WebCore/storage/SQLTransaction.cpp
WebCore/storage/SQLTransaction.h
WebCore/storage/SQLTransactionCallback.h
WebCore/storage/SQLTransactionClient.cpp
WebCore/storage/SQLTransactionClient.h
WebCore/storage/SQLTransactionErrorCallback.h
WebCore/storage/SQLTransactionSync.cpp
WebCore/storage/SQLTransactionSync.h
WebCore/storage/SQLTransactionSync.idl
WebCore/storage/SQLTransactionSyncCallback.h
WebCore/storage/SQLTransactionSyncCallback.idl
WebCore/storage/chromium/SQLTransactionClientChromium.cpp