-
jsbell@chromium.org authored
https://bugs.webkit.org/show_bug.cgi?id=97570 Reviewed by Tony Chang. Source/WebCore: Implement spec logic for allowing read-only transactions, and read-write transactions with non-overlapping scopes, to run concurrently. Transactions all still run in the same thread with tasks triggered via timers, so tasks and the underlying database operations are interleaved rather than truly parallelized. Within IDBTransactionCoordinator, rename started->queued, running->started to match spec terminology and clear up confusion. Test: storage/indexeddb/transaction-coordination-across-databases.html storage/indexeddb/transaction-coordination-within-database.html storage/indexeddb/transaction-readwrite-exclusive.html storage/indexeddb/transaction-scope-sequencing.html storage/indexeddb/transaction-starvation.html * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: Use IDBTransaction::Mode enum (WebCore::IDBDatabaseBackendImpl::createTransaction): * Modules/indexeddb/IDBDatabaseBackendImpl.h: Ditto. (IDBDatabaseBackendImpl): * Modules/indexeddb/IDBDatabaseBackendInterface.h: Ditto. (IDBDatabaseBackendInterface): * Modules/indexeddb/IDBTransactionBackendImpl.cpp: Convert scope as a HashSet for fast intersecting. (WebCore::IDBTransactionBackendImpl::create): (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl): * Modules/indexeddb/IDBTransactionBackendImpl.h: (IDBTransactionBackendImpl): (WebCore::IDBTransactionBackendImpl::mode): (WebCore::IDBTransactionBackendImpl::scope): * Modules/indexeddb/IDBTransactionCoordinator.cpp: Spec logic goes here. (WebCore::IDBTransactionCoordinator::processStartedTransactions): Extend this method to test all plausibly runnable transactions. (WebCore): (WebCore::IDBTransactionCoordinator::canRunTransaction): Test to see if one particular transaction can be run. (WebCore::IDBTransactionCoordinator::doScopesOverlap): Do a quick intersection test between transaction scopes. * Modules/indexeddb/IDBTransactionCoordinator.h: (IDBTransactionCoordinator): Source/WebKit/chromium: Map to IDBTransaction::Mode enum as appropriate. * src/IDBDatabaseBackendProxy.cpp: (WebKit::IDBDatabaseBackendProxy::createTransaction): * src/IDBDatabaseBackendProxy.h: (IDBDatabaseBackendProxy): * src/WebIDBDatabaseImpl.cpp: (WebKit::WebIDBDatabaseImpl::createTransaction): * tests/IDBDatabaseBackendTest.cpp: LayoutTests: New tests for parallel transactions, update existing tests that relied on sequential execution. * storage/indexeddb/database-close-expected.txt: * storage/indexeddb/mozilla/clear-expected.txt: * storage/indexeddb/mozilla/resources/clear.js: Split up transaction steps. * storage/indexeddb/resources/database-close.js: Don't log on individual transaction completion. * storage/indexeddb/resources/transaction-coordination-within-database.js: Added. * storage/indexeddb/resources/transaction-scope-sequencing.js: Added. * storage/indexeddb/resources/transaction-starvation.js: Added. * storage/indexeddb/transaction-coordination-within-database-expected.txt: Added. * storage/indexeddb/transaction-coordination-within-database.html: Added. * storage/indexeddb/transaction-scope-sequencing-expected.txt: Added. * storage/indexeddb/transaction-scope-sequencing.html: Added. * storage/indexeddb/transaction-starvation-expected.txt: Added. * storage/indexeddb/transaction-starvation.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136782 268f45cc-cd09-0410-ab3c-d52691b4dbfc
5e62a2fe