IndexedDB: One transaction coordinator per database
authorjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 18:51:33 +0000 (18:51 +0000)
committerjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 18:51:33 +0000 (18:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97501

Reviewed by Tony Chang.

Source/WebCore:

Per the IDB spec, transactions only need to be sequenced within databases.
The implementation was using one coordinator per factory backend (effectively
a singleton), which would prevent parallel execution of transactions in different
databases. Moved ownership of the transaction coordinator to the database backend.

Tests: storage/indexeddb/transaction-coordination-across-databases.html
       storage/indexeddb/transaction-readwrite-exclusive.html

* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::create):
(WebCore):
(WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl):
* Modules/indexeddb/IDBDatabaseBackendImpl.h:
(IDBDatabaseBackendImpl):
* Modules/indexeddb/IDBFactoryBackendImpl.cpp:
(WebCore::IDBFactoryBackendImpl::deleteDatabase):
(WebCore::IDBFactoryBackendImpl::open):
* Modules/indexeddb/IDBFactoryBackendImpl.h:
(WebCore):
(IDBFactoryBackendImpl):
* Modules/indexeddb/IDBTransactionCoordinator.cpp:
(WebCore::IDBTransactionCoordinator::create):
(WebCore::IDBTransactionCoordinator::IDBTransactionCoordinator):
* Modules/indexeddb/IDBTransactionCoordinator.h:
(IDBTransactionCoordinator):

Source/WebKit/chromium:

Remove obsolete argument.

* tests/IDBDatabaseBackendTest.h:

LayoutTests:

Test that transactions can be parallelized across databases, and ensure that
read/write transactions with overlapping scopes are not parallelized within a
database.

* storage/indexeddb/resources/transaction-coordination-across-databases.js: Added.
* storage/indexeddb/resources/transaction-readwrite-exclusive.js: Added.
* storage/indexeddb/transaction-coordination-across-databases-expected.txt: Added.
* storage/indexeddb/transaction-coordination-across-databases.html: Added.
* storage/indexeddb/transaction-readwrite-exclusive-expected.txt: Added.
* storage/indexeddb/transaction-readwrite-exclusive.html: Added.

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

16 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/resources/transaction-coordination-across-databases.js [new file with mode: 0644]
LayoutTests/storage/indexeddb/resources/transaction-readwrite-exclusive.js [new file with mode: 0644]
LayoutTests/storage/indexeddb/transaction-coordination-across-databases-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/transaction-coordination-across-databases.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/transaction-readwrite-exclusive-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/transaction-readwrite-exclusive.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBTransactionCoordinator.cpp
Source/WebCore/Modules/indexeddb/IDBTransactionCoordinator.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp

index 510af8e..64fb698 100644 (file)
@@ -1,3 +1,21 @@
+2012-09-25  Joshua Bell  <jsbell@chromium.org>
+
+        IndexedDB: One transaction coordinator per database
+        https://bugs.webkit.org/show_bug.cgi?id=97501
+
+        Reviewed by Tony Chang.
+
+        Test that transactions can be parallelized across databases, and ensure that
+        read/write transactions with overlapping scopes are not parallelized within a
+        database.
+
+        * storage/indexeddb/resources/transaction-coordination-across-databases.js: Added.
+        * storage/indexeddb/resources/transaction-readwrite-exclusive.js: Added.
+        * storage/indexeddb/transaction-coordination-across-databases-expected.txt: Added.
+        * storage/indexeddb/transaction-coordination-across-databases.html: Added.
+        * storage/indexeddb/transaction-readwrite-exclusive-expected.txt: Added.
+        * storage/indexeddb/transaction-readwrite-exclusive.html: Added.
+
 2012-09-25  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r129517.
diff --git a/LayoutTests/storage/indexeddb/resources/transaction-coordination-across-databases.js b/LayoutTests/storage/indexeddb/resources/transaction-coordination-across-databases.js
new file mode 100644 (file)
index 0000000..08fa64b
--- /dev/null
@@ -0,0 +1,133 @@
+if (this.importScripts) {
+    importScripts('../../../fast/js/resources/js-test-pre.js');
+    importScripts('shared.js');
+}
+
+description("Check that transactions in different databases can run in parallel.");
+
+function test()
+{
+    removeVendorPrefixes();
+    setDBNameFromPath();
+    evalAndLog("dbname1 = dbname + '1'");
+    evalAndLog("dbname2 = dbname + '2'");
+
+    deleteDatabase1();
+}
+
+function deleteDatabase1()
+{
+    preamble();
+    request = evalAndLog("indexedDB.deleteDatabase(dbname1)");
+    request.onerror = unexpectedBlockedCallback;
+    request.onblocked = unexpectedBlockedCallback;
+    request.onsuccess = deleteDatabase2;
+}
+
+function deleteDatabase2()
+{
+    preamble();
+    request = evalAndLog("indexedDB.deleteDatabase(dbname2)");
+    request.onerror = unexpectedBlockedCallback;
+    request.onblocked = unexpectedBlockedCallback;
+    request.onsuccess = openDatabase1;
+}
+
+function openDatabase1()
+{
+    preamble();
+    request = evalAndLog("indexedDB.open(dbname1, 1)");
+    request.onerror = unexpectedBlockedCallback;
+    request.onblocked = unexpectedBlockedCallback;
+    request.onupgradeneeded = function openOnUpgradeNeeded1(evt) {
+        preamble(evt);
+        evalAndLog("db1 = event.target.result");
+        evalAndLog("store1 = db1.createObjectStore('store')");
+        evalAndLog("store1.put(0, 0)");
+    };
+    request.onsuccess = function openOnSuccess1(evt) {
+        preamble(evt);
+        evalAndLog("db1 = event.target.result");
+        openDatabase2();
+    };
+}
+
+function openDatabase2()
+{
+    preamble();
+    request = evalAndLog("indexedDB.open(dbname2, 1)");
+    request.onerror = unexpectedBlockedCallback;
+    request.onblocked = unexpectedBlockedCallback;
+    request.onupgradeneeded = function onUpgradeNeeded2(evt) {
+        preamble(evt);
+        evalAndLog("db2 = event.target.result");
+        evalAndLog("store2 = db2.createObjectStore('store')");
+    };
+    request.onsuccess = function openOnSuccess2(evt) {
+        preamble(evt);
+        evalAndLog("db2 = event.target.result");
+        startWork();
+    };
+}
+
+function startWork()
+{
+    preamble();
+    evalAndLog("transaction1 = db1.transaction('store', 'readwrite')");
+    transaction1.onabort = unexpectedAbortCallback;
+    transaction1.oncomplete = onTransactionComplete;
+    evalAndLog("transaction2 = db2.transaction('store', 'readwrite')");
+    transaction1.onabort = unexpectedAbortCallback;
+    transaction2.oncomplete = onTransactionComplete;
+
+    evalAndLog("transaction1PutSuccess = false");
+    evalAndLog("transaction2PutSuccess = false");
+
+    debug("Keep both transactions alive until each has reported at least one successful operation");
+
+    function doTransaction1Put() {
+        // NOTE: No logging since execution order is not deterministic.
+        request = transaction1.objectStore('store').put(0, 0);
+        request.onerror = unexpectedErrorCallback;
+        request.onsuccess = function() {
+            transaction1PutSuccess = true;
+            if (!transaction2PutSuccess)
+                doTransaction1Put();
+        };
+    }
+
+    function doTransaction2Put() {
+        // NOTE: No logging since execution order is not deterministic.
+        request = transaction2.objectStore('store').put(0, 0);
+        request.onerror = unexpectedErrorCallback;
+        request.onsuccess = function() {
+            transaction2PutSuccess = true;
+            if (!transaction1PutSuccess)
+                doTransaction2Put();
+        };
+    }
+
+    doTransaction1Put();
+    doTransaction2Put();
+}
+
+transactionCompletionCount = 0;
+function onTransactionComplete(evt)
+{
+    preamble(evt);
+
+    ++transactionCompletionCount;
+    if (transactionCompletionCount < 2) {
+        debug("first transaction complete, still waiting...");
+        return;
+    }
+
+    shouldBeTrue("transaction1PutSuccess");
+    shouldBeTrue("transaction2PutSuccess");
+
+    evalAndLog("db1.close()");
+    evalAndLog("db2.close()");
+    finishJSTest();
+}
+
+test();
diff --git a/LayoutTests/storage/indexeddb/resources/transaction-readwrite-exclusive.js b/LayoutTests/storage/indexeddb/resources/transaction-readwrite-exclusive.js
new file mode 100644 (file)
index 0000000..526102c
--- /dev/null
@@ -0,0 +1,107 @@
+if (this.importScripts) {
+    importScripts('../../../fast/js/resources/js-test-pre.js');
+    importScripts('shared.js');
+}
+
+description("Check that readwrite transactions with overlapping scopes do not run in parallel.");
+
+function test()
+{
+    removeVendorPrefixes();
+    setDBNameFromPath();
+
+    request = evalAndLog("indexedDB.deleteDatabase(dbname)");
+    request.onerror = unexpectedBlockedCallback;
+    request.onblocked = unexpectedBlockedCallback;
+    request.onsuccess = openConnection1;
+}
+
+function openConnection1()
+{
+    preamble();
+    request = evalAndLog("indexedDB.open(dbname, 1)");
+    request.onerror = unexpectedBlockedCallback;
+    request.onblocked = unexpectedBlockedCallback;
+    request.onupgradeneeded = function openOnUpgradeNeeded1(evt) {
+        preamble(evt);
+        evalAndLog("db = event.target.result");
+        evalAndLog("store = db.createObjectStore('store')");
+    };
+    request.onsuccess = function openOnSuccess(evt) {
+        preamble(evt);
+        evalAndLog("db1 = event.target.result");
+        openConnection2();
+    };
+}
+
+function openConnection2()
+{
+    preamble();
+    request = evalAndLog("indexedDB.open(dbname, 1)");
+    request.onerror = unexpectedBlockedCallback;
+    request.onblocked = unexpectedBlockedCallback;
+    request.onupgradeneeded = unexpectedUpgradeNeededCallback;
+    request.onsuccess = function openOnSuccess2(evt) {
+        preamble(evt);
+        evalAndLog("db2 = event.target.result");
+        startWork();
+    };
+}
+
+function startWork()
+{
+    preamble();
+    evalAndLog("transaction1 = db1.transaction('store', 'readwrite')");
+    transaction1.onabort = unexpectedAbortCallback;
+    evalAndLog("transaction2 = db2.transaction('store', 'readwrite')");
+    transaction1.onabort = unexpectedAbortCallback;
+
+    evalAndLog("transaction1PutSuccess = false");
+    evalAndLog("transaction1Complete = false");
+    evalAndLog("transaction2PutSuccess = false");
+    evalAndLog("transaction2Complete = false");
+
+    debug("");
+    debug("Keep transaction1 alive for a while and ensure transaction2 doesn't start");
+
+    evalAndLog("count = 0");
+
+    (function doTransaction1Put() {
+        request = evalAndLog("transaction1.objectStore('store').put(1, count++)");
+        request.onerror = unexpectedErrorCallback;
+        request.onsuccess = function put1OnSuccess(evt) {
+            preamble(evt);
+            evalAndLog("transaction1PutSuccess = true");
+            if (count < 5) {
+                doTransaction1Put();
+            }
+        };
+    }());
+
+    transaction1.oncomplete = function onTransaction1Complete(evt) {
+        preamble(evt);
+        evalAndLog("transaction1Complete = true");
+        shouldBeFalse("transaction2PutSuccess");
+        shouldBeFalse("transaction2Complete");
+    };
+
+    request = evalAndLog("transaction2.objectStore('store').put(2, 0)");
+    request.onerror = unexpectedErrorCallback;
+    request.onsuccess = function put2OnSuccess(evt) {
+        preamble(evt);
+        evalAndLog("transaction2PutSuccess = true");
+        shouldBeTrue("transaction1Complete");
+    };
+
+    transaction2.oncomplete = function onTransaction2Complete(evt) {
+        preamble(evt);
+        evalAndLog("transaction2Complete = true");
+        shouldBeTrue("transaction1PutSuccess");
+        shouldBeTrue("transaction1Complete");
+        shouldBeTrue("transaction2PutSuccess");
+
+        finishJSTest();
+    };
+}
+
+test();
diff --git a/LayoutTests/storage/indexeddb/transaction-coordination-across-databases-expected.txt b/LayoutTests/storage/indexeddb/transaction-coordination-across-databases-expected.txt
new file mode 100644 (file)
index 0000000..8504912
--- /dev/null
@@ -0,0 +1,57 @@
+Check that transactions in different databases can run in parallel.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+dbname = "transaction-coordination-across-databases.html"
+dbname1 = dbname + '1'
+dbname2 = dbname + '2'
+
+deleteDatabase1():
+indexedDB.deleteDatabase(dbname1)
+
+deleteDatabase2():
+indexedDB.deleteDatabase(dbname2)
+
+openDatabase1():
+indexedDB.open(dbname1, 1)
+
+openOnUpgradeNeeded1():
+db1 = event.target.result
+store1 = db1.createObjectStore('store')
+store1.put(0, 0)
+
+openOnSuccess1():
+db1 = event.target.result
+
+openDatabase2():
+indexedDB.open(dbname2, 1)
+
+onUpgradeNeeded2():
+db2 = event.target.result
+store2 = db2.createObjectStore('store')
+
+openOnSuccess2():
+db2 = event.target.result
+
+startWork():
+transaction1 = db1.transaction('store', 'readwrite')
+transaction2 = db2.transaction('store', 'readwrite')
+transaction1PutSuccess = false
+transaction2PutSuccess = false
+Keep both transactions alive until each has reported at least one successful operation
+
+onTransactionComplete():
+first transaction complete, still waiting...
+
+onTransactionComplete():
+PASS transaction1PutSuccess is true
+PASS transaction2PutSuccess is true
+db1.close()
+db2.close()
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/transaction-coordination-across-databases.html b/LayoutTests/storage/indexeddb/transaction-coordination-across-databases.html
new file mode 100644 (file)
index 0000000..6ca741c
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<script src="resources/transaction-coordination-across-databases.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/transaction-readwrite-exclusive-expected.txt b/LayoutTests/storage/indexeddb/transaction-readwrite-exclusive-expected.txt
new file mode 100644 (file)
index 0000000..d9df0b6
--- /dev/null
@@ -0,0 +1,76 @@
+Check that readwrite transactions with overlapping scopes do not run in parallel.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+dbname = "transaction-readwrite-exclusive.html"
+indexedDB.deleteDatabase(dbname)
+
+openConnection1():
+indexedDB.open(dbname, 1)
+
+openOnUpgradeNeeded1():
+db = event.target.result
+store = db.createObjectStore('store')
+
+openOnSuccess():
+db1 = event.target.result
+
+openConnection2():
+indexedDB.open(dbname, 1)
+
+openOnSuccess2():
+db2 = event.target.result
+
+startWork():
+transaction1 = db1.transaction('store', 'readwrite')
+transaction2 = db2.transaction('store', 'readwrite')
+transaction1PutSuccess = false
+transaction1Complete = false
+transaction2PutSuccess = false
+transaction2Complete = false
+
+Keep transaction1 alive for a while and ensure transaction2 doesn't start
+count = 0
+transaction1.objectStore('store').put(1, count++)
+transaction2.objectStore('store').put(2, 0)
+
+put1OnSuccess():
+transaction1PutSuccess = true
+transaction1.objectStore('store').put(1, count++)
+
+put1OnSuccess():
+transaction1PutSuccess = true
+transaction1.objectStore('store').put(1, count++)
+
+put1OnSuccess():
+transaction1PutSuccess = true
+transaction1.objectStore('store').put(1, count++)
+
+put1OnSuccess():
+transaction1PutSuccess = true
+transaction1.objectStore('store').put(1, count++)
+
+put1OnSuccess():
+transaction1PutSuccess = true
+
+onTransaction1Complete():
+transaction1Complete = true
+PASS transaction2PutSuccess is false
+PASS transaction2Complete is false
+
+put2OnSuccess():
+transaction2PutSuccess = true
+PASS transaction1Complete is true
+
+onTransaction2Complete():
+transaction2Complete = true
+PASS transaction1PutSuccess is true
+PASS transaction1Complete is true
+PASS transaction2PutSuccess is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/transaction-readwrite-exclusive.html b/LayoutTests/storage/indexeddb/transaction-readwrite-exclusive.html
new file mode 100644 (file)
index 0000000..08640ba
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<script src="resources/transaction-readwrite-exclusive.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 8121ef8..7a94ccb 100644 (file)
@@ -1,3 +1,36 @@
+2012-09-25  Joshua Bell  <jsbell@chromium.org>
+
+        IndexedDB: One transaction coordinator per database
+        https://bugs.webkit.org/show_bug.cgi?id=97501
+
+        Reviewed by Tony Chang.
+
+        Per the IDB spec, transactions only need to be sequenced within databases.
+        The implementation was using one coordinator per factory backend (effectively
+        a singleton), which would prevent parallel execution of transactions in different
+        databases. Moved ownership of the transaction coordinator to the database backend.
+
+        Tests: storage/indexeddb/transaction-coordination-across-databases.html
+               storage/indexeddb/transaction-readwrite-exclusive.html
+
+        * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::create):
+        (WebCore):
+        (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl):
+        * Modules/indexeddb/IDBDatabaseBackendImpl.h:
+        (IDBDatabaseBackendImpl):
+        * Modules/indexeddb/IDBFactoryBackendImpl.cpp:
+        (WebCore::IDBFactoryBackendImpl::deleteDatabase):
+        (WebCore::IDBFactoryBackendImpl::open):
+        * Modules/indexeddb/IDBFactoryBackendImpl.h:
+        (WebCore):
+        (IDBFactoryBackendImpl):
+        * Modules/indexeddb/IDBTransactionCoordinator.cpp:
+        (WebCore::IDBTransactionCoordinator::create):
+        (WebCore::IDBTransactionCoordinator::IDBTransactionCoordinator):
+        * Modules/indexeddb/IDBTransactionCoordinator.h:
+        (IDBTransactionCoordinator):
+
 2012-09-25  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r129517.
index b92979f..713568b 100644 (file)
@@ -119,9 +119,9 @@ private:
     RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks;
 };
 
-PassRefPtr<IDBDatabaseBackendImpl> IDBDatabaseBackendImpl::create(const String& name, IDBBackingStore* database, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
+PassRefPtr<IDBDatabaseBackendImpl> IDBDatabaseBackendImpl::create(const String& name, IDBBackingStore* database, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
 {
-    RefPtr<IDBDatabaseBackendImpl> backend = adoptRef(new IDBDatabaseBackendImpl(name, database, coordinator, factory, uniqueIdentifier));
+    RefPtr<IDBDatabaseBackendImpl> backend = adoptRef(new IDBDatabaseBackendImpl(name, database, factory, uniqueIdentifier));
     if (!backend->openInternal())
         return 0;
     return backend.release();
@@ -131,7 +131,7 @@ namespace {
 const char* NoStringVersion = "";
 }
 
-IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, IDBBackingStore* backingStore, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
+IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, IDBBackingStore* backingStore, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
     : m_backingStore(backingStore)
     , m_id(InvalidId)
     , m_name(name)
@@ -139,7 +139,7 @@ IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, IDBBackingSto
     , m_intVersion(IDBDatabaseMetadata::NoIntVersion)
     , m_identifier(uniqueIdentifier)
     , m_factory(factory)
-    , m_transactionCoordinator(coordinator)
+    , m_transactionCoordinator(IDBTransactionCoordinator::create())
 {
     ASSERT(!m_name.isNull());
 }
index 112ba3d..5ad51ba 100644 (file)
@@ -47,7 +47,7 @@ class IDBTransactionCoordinator;
 
 class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface {
 public:
-    static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, IDBBackingStore* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
+    static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, IDBBackingStore* database, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
     virtual ~IDBDatabaseBackendImpl();
 
     PassRefPtr<IDBBackingStore> backingStore() const;
@@ -75,7 +75,7 @@ public:
     void transactionFinishedAndAbortFired(PassRefPtr<IDBTransactionBackendImpl>);
 
 private:
-    IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
+    IDBDatabaseBackendImpl(const String& name, IDBBackingStore* database, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
 
     bool openInternal();
     void runIntVersionChangeTransaction(int64_t requestedVersion, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>);
@@ -106,7 +106,7 @@ private:
     typedef HashMap<String, RefPtr<IDBObjectStoreBackendImpl> > ObjectStoreMap;
     ObjectStoreMap m_objectStores;
 
-    RefPtr<IDBTransactionCoordinator> m_transactionCoordinator;
+    OwnPtr<IDBTransactionCoordinator> m_transactionCoordinator;
     RefPtr<IDBTransactionBackendImpl> m_runningVersionChangeTransaction;
 
     typedef HashSet<IDBTransactionBackendImpl*> TransactionSet;
index c7ef860..68e7d3a 100644 (file)
@@ -55,7 +55,6 @@ static String computeUniqueIdentifier(const String& name, SecurityOrigin* securi
 }
 
 IDBFactoryBackendImpl::IDBFactoryBackendImpl()
-    : m_transactionCoordinator(IDBTransactionCoordinator::create())
 {
 }
 
@@ -118,7 +117,7 @@ void IDBFactoryBackendImpl::deleteDatabase(const String& name, PassRefPtr<IDBCal
         return;
     }
 
-    RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get(), m_transactionCoordinator.get(), this, uniqueIdentifier);
+    RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get(), this, uniqueIdentifier);
     if (databaseBackend) {
         m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.get());
         databaseBackend->deleteDatabase(callbacks);
@@ -164,7 +163,7 @@ void IDBFactoryBackendImpl::open(const String& name, int64_t version, PassRefPtr
             return;
         }
 
-        databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get(), m_transactionCoordinator.get(), this, uniqueIdentifier);
+        databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get(), this, uniqueIdentifier);
         if (databaseBackend)
             m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.get());
         else {
index 3ae0703..7a020fb 100644 (file)
@@ -41,7 +41,6 @@ class DOMStringList;
 
 class IDBBackingStore;
 class IDBDatabaseBackendImpl;
-class IDBTransactionCoordinator;
 
 class IDBFactoryBackendImpl : public IDBFactoryBackendInterface {
 public:
@@ -71,8 +70,6 @@ private:
     typedef HashMap<String, IDBBackingStore*> IDBBackingStoreMap;
     IDBBackingStoreMap m_backingStoreMap;
 
-    RefPtr<IDBTransactionCoordinator> m_transactionCoordinator;
-
     // Only one instance of the factory should exist at any given time.
     static IDBFactoryBackendImpl* idbFactoryBackendImpl;
 };
index edaff2c..6db0d70 100644 (file)
 
 namespace WebCore {
 
-PassRefPtr<IDBTransactionCoordinator> IDBTransactionCoordinator::create()
+PassOwnPtr<IDBTransactionCoordinator> IDBTransactionCoordinator::create()
 {
-    return adoptRef(new IDBTransactionCoordinator());
+    return adoptPtr(new IDBTransactionCoordinator());
 }
 
-IDBTransactionCoordinator::IDBTransactionCoordinator() 
+IDBTransactionCoordinator::IDBTransactionCoordinator()
 {
 }
 
index ef99e73..a75b7be 100644 (file)
@@ -40,9 +40,9 @@ class IDBTransactionCallbacks;
 class IDBDatabaseBackendImpl;
 
 // Transactions are executed in the order the were created.
-class IDBTransactionCoordinator : public RefCounted<IDBTransactionCoordinator> {
+class IDBTransactionCoordinator {
 public:
-    static PassRefPtr<IDBTransactionCoordinator> create();
+    static PassOwnPtr<IDBTransactionCoordinator> create();
     virtual ~IDBTransactionCoordinator();
 
     // Called by transactions as they start and finish.
index 18b3dcb..7467bbc 100644 (file)
@@ -1,3 +1,14 @@
+2012-09-25  Joshua Bell  <jsbell@chromium.org>
+
+        IndexedDB: One transaction coordinator per database
+        https://bugs.webkit.org/show_bug.cgi?id=97501
+
+        Reviewed by Tony Chang.
+
+        Remove obsolete argument.
+
+        * tests/IDBDatabaseBackendTest.h:
+
 2012-09-25  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r129517.
index 459dd4b..b6b3667 100644 (file)
@@ -32,7 +32,6 @@
 #include "IDBFakeBackingStore.h"
 #include "IDBIndexBackendImpl.h"
 #include "IDBObjectStoreBackendImpl.h"
-#include "IDBTransactionCoordinator.h"
 #include "WebIDBDatabaseCallbacksImpl.h"
 #include "WebIDBDatabaseImpl.h"
 
@@ -53,9 +52,8 @@ TEST(IDBDatabaseBackendTest, BackingStoreRetention)
     RefPtr<IDBFakeBackingStore> backingStore = adoptRef(new IDBFakeBackingStore());
     EXPECT_TRUE(backingStore->hasOneRef());
 
-    IDBTransactionCoordinator* coordinator = 0;
     IDBFactoryBackendImpl* factory = 0;
-    RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), coordinator, factory, "uniqueid");
+    RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), factory, "uniqueid");
     EXPECT_GT(backingStore->refCount(), 1);
 
     const bool autoIncrement = false;
@@ -118,9 +116,8 @@ TEST(IDBDatabaseBackendTest, ConnectionLifecycle)
     RefPtr<IDBFakeBackingStore> backingStore = adoptRef(new IDBFakeBackingStore());
     EXPECT_TRUE(backingStore->hasOneRef());
 
-    IDBTransactionCoordinator* coordinator = 0;
     IDBFactoryBackendImpl* factory = 0;
-    RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), coordinator, factory, "uniqueid");
+    RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), factory, "uniqueid");
     EXPECT_GT(backingStore->refCount(), 1);
 
     RefPtr<MockIDBCallbacks> request1 = MockIDBCallbacks::create();
@@ -177,9 +174,8 @@ TEST(IDBDatabaseBackendTest, ForcedClose)
     RefPtr<IDBFakeBackingStore> backingStore = adoptRef(new IDBFakeBackingStore());
     EXPECT_TRUE(backingStore->hasOneRef());
 
-    IDBTransactionCoordinator* coordinator = 0;
     IDBFactoryBackendImpl* factory = 0;
-    RefPtr<IDBDatabaseBackendImpl> backend = IDBDatabaseBackendImpl::create("db", backingStore.get(), coordinator, factory, "uniqueid");
+    RefPtr<IDBDatabaseBackendImpl> backend = IDBDatabaseBackendImpl::create("db", backingStore.get(), factory, "uniqueid");
     EXPECT_GT(backingStore->refCount(), 1);
 
     RefPtr<FakeIDBDatabaseCallbacks> connection = FakeIDBDatabaseCallbacks::create();