Title: [191465] trunk
Revision
191465
Author
beid...@apple.com
Date
2015-10-22 12:10:15 -0700 (Thu, 22 Oct 2015)

Log Message

Modern IDB: Basic createObjectStore implementation.
https://bugs.webkit.org/show_bug.cgi?id=150455

Reviewed by Alex Christensen.

Source/WebCore:

Tests: storage/indexeddb/modern/createobjectstore-basic.html
       storage/indexeddb/modern/createobjectstore-failures.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
(WebCore::IDBClient::IDBConnectionToServer::didCreateObjectStore):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

* Modules/indexeddb/client/IDBDatabaseImpl.cpp:
(WebCore::IDBClient::IDBDatabase::objectStoreNames):
(WebCore::IDBClient::IDBDatabase::createObjectStore):
(WebCore::IDBClient::IDBDatabase::didAbortTransaction):
* Modules/indexeddb/client/IDBDatabaseImpl.h:
(WebCore::IDBClient::IDBDatabase::serverConnection):

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp: Added.
(WebCore::IDBClient::IDBObjectStore::create):
(WebCore::IDBClient::IDBObjectStore::IDBObjectStore):
(WebCore::IDBClient::IDBObjectStore::~IDBObjectStore):
(WebCore::IDBClient::IDBObjectStore::id):
(WebCore::IDBClient::IDBObjectStore::name):
(WebCore::IDBClient::IDBObjectStore::keyPathAny):
(WebCore::IDBClient::IDBObjectStore::keyPath):
(WebCore::IDBClient::IDBObjectStore::indexNames):
(WebCore::IDBClient::IDBObjectStore::transaction):
(WebCore::IDBClient::IDBObjectStore::autoIncrement):
(WebCore::IDBClient::IDBObjectStore::add):
(WebCore::IDBClient::IDBObjectStore::put):
(WebCore::IDBClient::IDBObjectStore::openCursor):
(WebCore::IDBClient::IDBObjectStore::get):
(WebCore::IDBClient::IDBObjectStore::deleteFunction):
(WebCore::IDBClient::IDBObjectStore::clear):
(WebCore::IDBClient::IDBObjectStore::createIndex):
(WebCore::IDBClient::IDBObjectStore::index):
(WebCore::IDBClient::IDBObjectStore::deleteIndex):
(WebCore::IDBClient::IDBObjectStore::count):
* Modules/indexeddb/client/IDBObjectStoreImpl.h: Added.

* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::requestCompleted):

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::serverConnection):
(WebCore::IDBClient::IDBTransaction::objectStore):
(WebCore::IDBClient::IDBTransaction::scheduleOperation):
(WebCore::IDBClient::IDBTransaction::operationTimerFired):
(WebCore::IDBClient::IDBTransaction::finishAbortOrCommit):
(WebCore::IDBClient::IDBTransaction::didAbort):
(WebCore::IDBClient::IDBTransaction::didCommit):
(WebCore::IDBClient::IDBTransaction::createObjectStore):
(WebCore::IDBClient::IDBTransaction::createObjectStoreOnServer):
(WebCore::IDBClient::IDBTransaction::didCreateObjectStoreOnServer):
* Modules/indexeddb/client/IDBTransactionImpl.h:
(WebCore::IDBClient::IDBTransaction::originalDatabaseInfo):
(WebCore::IDBClient::IDBTransaction::isVersionChange):

* Modules/indexeddb/client/TransactionOperation.h: Added.
(WebCore::IDBClient::TransactionOperation::perform):
(WebCore::IDBClient::TransactionOperation::completed):
(WebCore::IDBClient::TransactionOperation::identifier):
(WebCore::IDBClient::TransactionOperation::transactionIdentifier):
(WebCore::IDBClient::TransactionOperation::TransactionOperation):
(WebCore::IDBClient::createTransactionOperation):

* Modules/indexeddb/server/IDBConnectionToClient.cpp:
(WebCore::IDBServer::IDBConnectionToClient::didCreateObjectStore):
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::createObjectStore):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):
(WebCore::IDBServer::UniqueIDBDatabase::performCreateObjectStore):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformCreateObjectStore):
(WebCore::IDBServer::UniqueIDBDatabase::performAbortTransaction):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformAbortTransaction):
(WebCore::IDBServer::UniqueIDBDatabase::abortTransaction): Deleted.
* Modules/indexeddb/server/UniqueIDBDatabase.h:

* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didCreateObjectStore):
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:

* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::isVersionChange):
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::createObjectStore):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:

* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
(WebCore::IDBDatabaseInfo::hasObjectStore):
(WebCore::IDBDatabaseInfo::createNewObjectStore):
(WebCore::IDBDatabaseInfo::addExistingObjectStore):
(WebCore::IDBDatabaseInfo::objectStoreNames):
* Modules/indexeddb/shared/IDBDatabaseInfo.h:

* Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: Copied from Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp.
(WebCore::IDBObjectStoreInfo::IDBObjectStoreInfo):
(WebCore::IDBObjectStoreInfo::isolatedCopy):
* Modules/indexeddb/shared/IDBObjectStoreInfo.h: Copied from Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h.
(WebCore::IDBObjectStoreInfo::identifier):
(WebCore::IDBObjectStoreInfo::name):
(WebCore::IDBObjectStoreInfo::keyPath):
(WebCore::IDBObjectStoreInfo::autoIncrement):

* Modules/indexeddb/shared/IDBRequestData.cpp:
(WebCore::IDBRequestData::IDBRequestData):
(WebCore::IDBRequestData::requestIdentifier):
(WebCore::IDBRequestData::transactionIdentifier):
* Modules/indexeddb/shared/IDBRequestData.h:
(WebCore::IDBRequestData::databaseIdentifier):
(WebCore::IDBRequestData::requestIdentifier): Deleted.

* Modules/indexeddb/shared/IDBResultData.cpp:
(WebCore::IDBResultData::IDBResultData):
(WebCore::IDBResultData::createObjectStoreSuccess):
* Modules/indexeddb/shared/IDBResultData.h:

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::didCreateObjectStore):
(WebCore::InProcessIDBServer::createObjectStore):
* Modules/indexeddb/shared/InProcessIDBServer.h:

* platform/CrossThreadCopier.cpp:
(WebCore::IDBObjectStoreInfo>::copy):
* platform/CrossThreadCopier.h:

LayoutTests:

* storage/indexeddb/modern/createobjectstore-basic-expected.txt: Added.
* storage/indexeddb/modern/createobjectstore-basic.html: Added.
* storage/indexeddb/modern/createobjectstore-failures-expected.txt: Added.
* storage/indexeddb/modern/createobjectstore-failures.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (191464 => 191465)


--- trunk/LayoutTests/ChangeLog	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/LayoutTests/ChangeLog	2015-10-22 19:10:15 UTC (rev 191465)
@@ -1,3 +1,15 @@
+2015-10-22  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Basic createObjectStore implementation.
+        https://bugs.webkit.org/show_bug.cgi?id=150455
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/createobjectstore-basic-expected.txt: Added.
+        * storage/indexeddb/modern/createobjectstore-basic.html: Added.
+        * storage/indexeddb/modern/createobjectstore-failures-expected.txt: Added.
+        * storage/indexeddb/modern/createobjectstore-failures.html: Added.
+
 2015-10-22  Frederic Wang  <fred.w...@free.fr>
 
         [Mac] Add support for the USE_TYPO_METRICS flag

Added: trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt (0 => 191465)


--- trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,26 @@
+ALERT: Initial upgrade needed: Old version - 0 New version - 1
+ALERT: Object store names:
+ALERT: FirstAbortedObjectStore
+ALERT: Initial upgrade versionchange transaction aborted
+ALERT: Object store names:
+ALERT: Second upgrade needed: Old version - 0 New version - 1
+ALERT: Object store names:
+ALERT: Second upgrade versionchange transaction complete
+ALERT: Object store names:
+ALERT: FirstCommittedObjectStore
+ALERT: Third upgrade needed: Old version - 1 New version - 2
+ALERT: Object store names:
+ALERT: FirstCommittedObjectStore
+ALERT: SecondCommittedObjectStore
+ALERT: Third upgrade versionchange transaction complete
+ALERT: Object store names:
+ALERT: FirstCommittedObjectStore
+ALERT: SecondCommittedObjectStore
+ALERT: Fourth upgrade needed: Old version - 2 New version - 3
+ALERT: Object store names:
+ALERT: FirstCommittedObjectStore
+ALERT: SecondCommittedObjectStore
+ALERT: Done
+This test starts some version change transactions, creates some object stores, and variably commits or aborts the version change transactions.
+At various stages it verifies the object stores in the database are as-expected.
+

Added: trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic.html (0 => 191465)


--- trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic.html	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,134 @@
+This test starts some version change transactions, creates some object stores, and variably commits or aborts the version change transactions.<br>
+At various stages it verifies the object stores in the database are as-expected.<br>
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function dumpObjectStores(database) {
+    var list = database.objectStoreNames;
+    alert("Object store names:");
+    for (var i = 0; i < list.length; ++i) { 
+        alert(list[i]);
+    }
+}
+
+var createRequest = window.indexedDB.open("CreateObjectStoreTestDatabase", 1);
+
+createRequest._onupgradeneeded_ = function(event) {
+    alert("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+    var versionTransaction = createRequest.transaction;
+    var database = event.target.result;
+    var objectStore = database.createObjectStore("FirstAbortedObjectStore");
+
+    var f = function() {
+        versionTransaction.abort();
+    };
+
+    dumpObjectStores(database);    
+    setTimeout(f, 0);
+    
+    versionTransaction._onabort_ = function(event) {
+        alert("Initial upgrade versionchange transaction aborted");
+        dumpObjectStores(database);
+        continueTest1();
+        database.close();
+    }
+
+    versionTransaction._oncomplete_ = function(event) {
+        alert("Initial upgrade versionchange transaction unexpected complete");
+        done();
+    }
+
+    versionTransaction._onerror_ = function(event) {
+        alert("Initial upgrade versionchange transaction unexpected error" + event);
+        done();
+    }
+}
+
+function continueTest1()
+{
+    createRequest = window.indexedDB.open("CreateObjectStoreTestDatabase", 1);
+
+    createRequest._onupgradeneeded_ = function(event) {
+        alert("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+        var versionTransaction = createRequest.transaction;
+        var database = event.target.result;
+        dumpObjectStores(database);
+        var objectStore = database.createObjectStore("FirstCommittedObjectStore");
+
+        versionTransaction._onabort_ = function(event) {
+            alert("Second upgrade versionchange transaction unexpected abort");
+            done();
+        }
+
+        versionTransaction._oncomplete_ = function(event) {
+            alert("Second upgrade versionchange transaction complete");
+            dumpObjectStores(database);
+            continueTest2();
+            database.close();
+        }
+
+        versionTransaction._onerror_ = function(event) {
+            alert("Second upgrade versionchange transaction unexpected error" + event);
+            done();
+        }
+    }
+}
+
+function continueTest2()
+{
+    createRequest = window.indexedDB.open("CreateObjectStoreTestDatabase", 2);
+
+    createRequest._onupgradeneeded_ = function(event) {
+        alert("Third upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+        var versionTransaction = createRequest.transaction;
+        var database = event.target.result;
+        var objectStore = database.createObjectStore("SecondCommittedObjectStore");
+
+        dumpObjectStores(database);    
+    
+        versionTransaction._onabort_ = function(event) {
+            alert("Third upgrade versionchange transaction unexpected abort");
+            done();
+        }
+
+        versionTransaction._oncomplete_ = function(event) {
+            alert("Third upgrade versionchange transaction complete");
+            dumpObjectStores(database);
+            database.close(); 
+            continueTest3();
+        }
+
+        versionTransaction._onerror_ = function(event) {
+            alert("Third upgrade versionchange transaction unexpected error" + event);
+            done();
+        }
+    }
+}
+
+function continueTest3()
+{
+    createRequest = window.indexedDB.open("CreateObjectStoreTestDatabase", 3);
+
+    createRequest._onupgradeneeded_ = function(event) {
+        alert("Fourth upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+        var database = event.target.result;
+        dumpObjectStores(database);
+        done();
+    }
+}
+
+</script>
\ No newline at end of file

Added: trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-failures-expected.txt (0 => 191465)


--- trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-failures-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-failures-expected.txt	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,24 @@
+ALERT: Initial upgrade needed: Old version - 0 New version - 1
+ALERT: Failed to create object store with both autoincrement and an empty keypath: Error: InvalidAccessError: DOM IDBDatabase Exception 15
+ALERT: Object store names:
+ALERT: Failed to create object store with both autoincrement and a sequence keypath: Error: InvalidAccessError: DOM IDBDatabase Exception 15
+ALERT: Object store names:
+ALERT: Failed to create object store with invalid keyPath: Error: SyntaxError: DOM IDBDatabase Exception 12
+ALERT: Object store names:
+ALERT: Actually created an object store
+ALERT: Object store names:
+ALERT: TestObjectStore1
+ALERT: Failed to create TestObjectStore a second time: Error: ConstraintError: DOM IDBDatabase Exception 0
+ALERT: Object store names:
+ALERT: TestObjectStore1
+ALERT: Initial upgrade versionchange transaction complete
+ALERT: Object store names:
+ALERT: TestObjectStore1
+ALERT: Failed to create object store while there is no version change transaction: Error: InvalidStateError: DOM IDBDatabase Exception 11
+ALERT: Object store names:
+ALERT: TestObjectStore1
+ALERT: Failed to create object store outside of onupgradeneeded: Error: InvalidStateError: DOM IDBDatabase Exception 11
+ALERT: Object store names:
+ALERT: TestObjectStore1
+ALERT: Done
+This test exercises the obvious ways that IDBDatabase.createObjectStore can fail.

Added: trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-failures.html (0 => 191465)


--- trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-failures.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-failures.html	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,103 @@
+This test exercises the obvious ways that IDBDatabase.createObjectStore can fail.
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function dumpObjectStores(database) {
+    var list = database.objectStoreNames;
+    alert("Object store names:");
+    for (var i = 0; i < list.length; ++i) { 
+        alert(list[i]);
+    }
+}
+
+var createRequest = window.indexedDB.open("CreateObjectStoreFailuresTestDatabase", 1);
+var database;
+var versionTransaction;
+
+createRequest._onupgradeneeded_ = function(event) {
+    alert("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+    versionTransaction = createRequest.transaction;
+    database = event.target.result;
+
+    try {
+        var objectStore = database.createObjectStore('TestObjectStore', { autoIncrement: true , keyPath: "" });
+    } catch (e) {
+        alert("Failed to create object store with both autoincrement and an empty keypath: " + e);
+        dumpObjectStores(database);
+    }
+
+    try {
+        var objectStore = database.createObjectStore('TestObjectStore', { autoIncrement: true , keyPath: ['foo'] });
+    } catch (e) {
+        alert("Failed to create object store with both autoincrement and a sequence keypath: " + e);
+        dumpObjectStores(database);
+    }
+    
+    try {
+        var objectStore = database.createObjectStore('TestObjectStore', { keyPath: "'foo bar'"});
+    } catch (e) {
+        alert("Failed to create object store with invalid keyPath: " + e);
+        dumpObjectStores(database);
+    }
+
+    database.createObjectStore("TestObjectStore1");
+    alert("Actually created an object store");
+    dumpObjectStores(database);
+    
+    try {
+        database.createObjectStore("TestObjectStore1");
+    } catch(e) {
+        alert("Failed to create TestObjectStore a second time: " + e);
+        dumpObjectStores(database);
+    }
+
+    versionTransaction._onabort_ = function(event) {
+        alert("Initial upgrade versionchange unexpected abort");
+        done();
+    }
+
+    versionTransaction._oncomplete_ = function(event) {
+        alert("Initial upgrade versionchange transaction complete");
+        dumpObjectStores(database);
+
+        try {
+            database.createObjectStore("TestObjectStore2");
+        } catch(e) {
+            alert("Failed to create object store while there is no version change transaction: " + e);
+            dumpObjectStores(database);
+        }
+    
+        setTimeout(finishUp, 0);
+    }
+
+    versionTransaction._onerror_ = function(event) {
+        alert("Initial upgrade versionchange transaction unexpected error" + event);
+        done();
+    }
+}
+
+function finishUp()
+{
+    try {
+        database.createObjectStore("TestObjectStore99");
+    } catch(e) {
+        alert("Failed to create object store outside of onupgradeneeded: " + e);
+        dumpObjectStores(database);
+    }
+    
+    done();
+}
+
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/CMakeLists.txt (191464 => 191465)


--- trunk/Source/WebCore/CMakeLists.txt	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-10-22 19:10:15 UTC (rev 191465)
@@ -871,6 +871,7 @@
     Modules/indexeddb/client/IDBConnectionToServer.cpp
     Modules/indexeddb/client/IDBDatabaseImpl.cpp
     Modules/indexeddb/client/IDBFactoryImpl.cpp
+    Modules/indexeddb/client/IDBObjectStoreImpl.cpp
     Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp
     Modules/indexeddb/client/IDBRequestImpl.cpp
     Modules/indexeddb/client/IDBTransactionImpl.cpp
@@ -907,6 +908,7 @@
 
     Modules/indexeddb/shared/IDBDatabaseInfo.cpp
     Modules/indexeddb/shared/IDBError.cpp
+    Modules/indexeddb/shared/IDBObjectStoreInfo.cpp
     Modules/indexeddb/shared/IDBRequestData.cpp
     Modules/indexeddb/shared/IDBResourceIdentifier.cpp
     Modules/indexeddb/shared/IDBResultData.cpp

Modified: trunk/Source/WebCore/ChangeLog (191464 => 191465)


--- trunk/Source/WebCore/ChangeLog	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/ChangeLog	2015-10-22 19:10:15 UTC (rev 191465)
@@ -1,3 +1,143 @@
+2015-10-22  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: Basic createObjectStore implementation.
+        https://bugs.webkit.org/show_bug.cgi?id=150455
+
+        Reviewed by Alex Christensen.
+
+        Tests: storage/indexeddb/modern/createobjectstore-basic.html
+               storage/indexeddb/modern/createobjectstore-failures.html
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+        (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
+        (WebCore::IDBClient::IDBConnectionToServer::didCreateObjectStore):
+        * Modules/indexeddb/client/IDBConnectionToServer.h:
+        * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+        
+        * Modules/indexeddb/client/IDBDatabaseImpl.cpp:
+        (WebCore::IDBClient::IDBDatabase::objectStoreNames):
+        (WebCore::IDBClient::IDBDatabase::createObjectStore):
+        (WebCore::IDBClient::IDBDatabase::didAbortTransaction):
+        * Modules/indexeddb/client/IDBDatabaseImpl.h:
+        (WebCore::IDBClient::IDBDatabase::serverConnection):
+        
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp: Added.
+        (WebCore::IDBClient::IDBObjectStore::create):
+        (WebCore::IDBClient::IDBObjectStore::IDBObjectStore):
+        (WebCore::IDBClient::IDBObjectStore::~IDBObjectStore):
+        (WebCore::IDBClient::IDBObjectStore::id):
+        (WebCore::IDBClient::IDBObjectStore::name):
+        (WebCore::IDBClient::IDBObjectStore::keyPathAny):
+        (WebCore::IDBClient::IDBObjectStore::keyPath):
+        (WebCore::IDBClient::IDBObjectStore::indexNames):
+        (WebCore::IDBClient::IDBObjectStore::transaction):
+        (WebCore::IDBClient::IDBObjectStore::autoIncrement):
+        (WebCore::IDBClient::IDBObjectStore::add):
+        (WebCore::IDBClient::IDBObjectStore::put):
+        (WebCore::IDBClient::IDBObjectStore::openCursor):
+        (WebCore::IDBClient::IDBObjectStore::get):
+        (WebCore::IDBClient::IDBObjectStore::deleteFunction):
+        (WebCore::IDBClient::IDBObjectStore::clear):
+        (WebCore::IDBClient::IDBObjectStore::createIndex):
+        (WebCore::IDBClient::IDBObjectStore::index):
+        (WebCore::IDBClient::IDBObjectStore::deleteIndex):
+        (WebCore::IDBClient::IDBObjectStore::count):
+        * Modules/indexeddb/client/IDBObjectStoreImpl.h: Added.
+
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBOpenDBRequest::requestCompleted):
+
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::serverConnection):
+        (WebCore::IDBClient::IDBTransaction::objectStore):
+        (WebCore::IDBClient::IDBTransaction::scheduleOperation):
+        (WebCore::IDBClient::IDBTransaction::operationTimerFired):
+        (WebCore::IDBClient::IDBTransaction::finishAbortOrCommit):
+        (WebCore::IDBClient::IDBTransaction::didAbort):
+        (WebCore::IDBClient::IDBTransaction::didCommit):
+        (WebCore::IDBClient::IDBTransaction::createObjectStore):
+        (WebCore::IDBClient::IDBTransaction::createObjectStoreOnServer):
+        (WebCore::IDBClient::IDBTransaction::didCreateObjectStoreOnServer):
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+        (WebCore::IDBClient::IDBTransaction::originalDatabaseInfo):
+        (WebCore::IDBClient::IDBTransaction::isVersionChange):
+        
+        * Modules/indexeddb/client/TransactionOperation.h: Added.
+        (WebCore::IDBClient::TransactionOperation::perform):
+        (WebCore::IDBClient::TransactionOperation::completed):
+        (WebCore::IDBClient::TransactionOperation::identifier):
+        (WebCore::IDBClient::TransactionOperation::transactionIdentifier):
+        (WebCore::IDBClient::TransactionOperation::TransactionOperation):
+        (WebCore::IDBClient::createTransactionOperation):
+        
+        * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+        (WebCore::IDBServer::IDBConnectionToClient::didCreateObjectStore):
+        * Modules/indexeddb/server/IDBConnectionToClient.h:
+        * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
+        
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::createObjectStore):
+        * Modules/indexeddb/server/IDBServer.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):
+        (WebCore::IDBServer::UniqueIDBDatabase::performCreateObjectStore):
+        (WebCore::IDBServer::UniqueIDBDatabase::didPerformCreateObjectStore):
+        (WebCore::IDBServer::UniqueIDBDatabase::performAbortTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabase::didPerformAbortTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction): Deleted.
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCreateObjectStore):
+        * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::isVersionChange):
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::createObjectStore):
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
+        
+        * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
+        (WebCore::IDBDatabaseInfo::hasObjectStore):
+        (WebCore::IDBDatabaseInfo::createNewObjectStore):
+        (WebCore::IDBDatabaseInfo::addExistingObjectStore):
+        (WebCore::IDBDatabaseInfo::objectStoreNames):
+        * Modules/indexeddb/shared/IDBDatabaseInfo.h:
+        
+        * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: Copied from Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp.
+        (WebCore::IDBObjectStoreInfo::IDBObjectStoreInfo):
+        (WebCore::IDBObjectStoreInfo::isolatedCopy):
+        * Modules/indexeddb/shared/IDBObjectStoreInfo.h: Copied from Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h.
+        (WebCore::IDBObjectStoreInfo::identifier):
+        (WebCore::IDBObjectStoreInfo::name):
+        (WebCore::IDBObjectStoreInfo::keyPath):
+        (WebCore::IDBObjectStoreInfo::autoIncrement):
+
+        * Modules/indexeddb/shared/IDBRequestData.cpp:
+        (WebCore::IDBRequestData::IDBRequestData):
+        (WebCore::IDBRequestData::requestIdentifier):
+        (WebCore::IDBRequestData::transactionIdentifier):
+        * Modules/indexeddb/shared/IDBRequestData.h:
+        (WebCore::IDBRequestData::databaseIdentifier):
+        (WebCore::IDBRequestData::requestIdentifier): Deleted.
+
+        * Modules/indexeddb/shared/IDBResultData.cpp:
+        (WebCore::IDBResultData::IDBResultData):
+        (WebCore::IDBResultData::createObjectStoreSuccess):
+        * Modules/indexeddb/shared/IDBResultData.h:
+
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::didCreateObjectStore):
+        (WebCore::InProcessIDBServer::createObjectStore):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
+        * platform/CrossThreadCopier.cpp:
+        (WebCore::IDBObjectStoreInfo>::copy):
+        * platform/CrossThreadCopier.h:
+
 2015-10-22  Alex Christensen  <achristen...@webkit.org>
 
         Initial NSURLSession WebResourceLoader implementation

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -32,6 +32,7 @@
 #include "IDBRequestData.h"
 #include "IDBResultData.h"
 #include "Logging.h"
+#include "TransactionOperation.h"
 
 namespace WebCore {
 namespace IDBClient {
@@ -93,6 +94,26 @@
     request->requestCompleted(resultData);
 }
 
+void IDBConnectionToServer::createObjectStore(TransactionOperation& operation, const IDBObjectStoreInfo& info)
+{
+    LOG(IndexedDB, "IDBConnectionToServer::createObjectStore");
+
+    ASSERT(!m_activeOperations.contains(operation.identifier()));
+    m_activeOperations.set(operation.identifier(), &operation);
+
+    m_delegate->createObjectStore(IDBRequestData(operation), info);
+}
+
+void IDBConnectionToServer::didCreateObjectStore(const IDBResultData& resultData)
+{
+    LOG(IndexedDB, "IDBConnectionToServer::didCreateObjectStore");
+
+    auto operation = m_activeOperations.take(resultData.requestIdentifier());
+    ASSERT(operation);
+
+    operation->completed(resultData);
+}
+
 void IDBConnectionToServer::commitTransaction(IDBTransaction& transaction)
 {
     LOG(IndexedDB, "IDBConnectionToServer::commitTransaction");

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -30,6 +30,7 @@
 
 #include "IDBConnectionToServerDelegate.h"
 #include "IDBResourceIdentifier.h"
+#include "TransactionOperation.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/Ref.h>
@@ -38,6 +39,7 @@
 namespace WebCore {
 
 class IDBError;
+class IDBObjectStoreInfo;
 class IDBResultData;
 
 namespace IDBClient {
@@ -58,6 +60,9 @@
     void openDatabase(IDBOpenDBRequest&);
     void didOpenDatabase(const IDBResultData&);
 
+    void createObjectStore(TransactionOperation&, const IDBObjectStoreInfo&);
+    void didCreateObjectStore(const IDBResultData&);
+
     void commitTransaction(IDBTransaction&);
     void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
 
@@ -79,6 +84,7 @@
     HashMap<uint64_t, IDBDatabase*> m_databaseConnectionMap;
     HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_committingTransactions;
     HashMap<IDBResourceIdentifier, RefPtr<IDBTransaction>> m_abortingTransactions;
+    HashMap<IDBResourceIdentifier, RefPtr<TransactionOperation>> m_activeOperations;
 };
 
 } // namespace IDBClient

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -30,6 +30,7 @@
 
 namespace WebCore {
 
+class IDBObjectStoreInfo;
 class IDBRequestData;
 class IDBResourceIdentifier;
 
@@ -44,6 +45,7 @@
     virtual void openDatabase(IDBRequestData&) = 0;
     virtual void abortTransaction(IDBResourceIdentifier&) = 0;
     virtual void commitTransaction(IDBResourceIdentifier&) = 0;
+    virtual void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&) = 0;
     virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) = 0;
 
     virtual void ref() = 0;

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -30,6 +30,7 @@
 
 #include "EventQueue.h"
 #include "IDBConnectionToServer.h"
+#include "IDBDatabaseException.h"
 #include "IDBOpenDBRequestImpl.h"
 #include "IDBResultData.h"
 #include "IDBTransactionImpl.h"
@@ -73,20 +74,58 @@
 
 RefPtr<DOMStringList> IDBDatabase::objectStoreNames() const
 {
-    ASSERT_NOT_REACHED();
-    return nullptr;
+    RefPtr<DOMStringList> objectStoreNames = DOMStringList::create();
+    for (auto& name : m_info.objectStoreNames())
+        objectStoreNames->append(name);
+    objectStoreNames->sort();
+    return WTF::move(objectStoreNames);
 }
 
-RefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String&, const Dictionary&, ExceptionCode&)
+RefPtr<WebCore::IDBObjectStore> IDBDatabase::createObjectStore(const String&, const Dictionary&, ExceptionCode&)
 {
     ASSERT_NOT_REACHED();
     return nullptr;
 }
 
-RefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String&, const IDBKeyPath&, bool, ExceptionCode&)
+RefPtr<WebCore::IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, ExceptionCode& ec)
 {
-    ASSERT_NOT_REACHED();
-    return nullptr;
+    LOG(IndexedDB, "IDBDatabase::createObjectStore");
+
+    ASSERT(!m_versionChangeTransaction || m_versionChangeTransaction->isVersionChange());
+
+    if (!m_versionChangeTransaction) {
+        ec = IDBDatabaseException::InvalidStateError;
+        return nullptr;
+    }
+
+    if (!m_versionChangeTransaction->isActive()) {
+        ec = IDBDatabaseException::TransactionInactiveError;
+        return nullptr;
+    }
+
+    if (m_info.hasObjectStore(name)) {
+        ec = IDBDatabaseException::ConstraintError;
+        return nullptr;
+    }
+
+    if (!keyPath.isNull() && !keyPath.isValid()) {
+        ec = IDBDatabaseException::SyntaxError;
+        return nullptr;
+    }
+
+    if (autoIncrement && !keyPath.isNull()) {
+        if ((keyPath.type() == IndexedDB::KeyPathType::String && keyPath.string().isEmpty()) || keyPath.type() == IndexedDB::KeyPathType::Array) {
+            ec = IDBDatabaseException::InvalidAccessError;
+            return nullptr;
+        }
+    }
+
+    // Install the new ObjectStore into the connection's metadata.
+    IDBObjectStoreInfo info = m_info.createNewObjectStore(name, keyPath, autoIncrement);
+
+    // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
+    Ref<IDBObjectStore> objectStore = m_versionChangeTransaction->createObjectStore(info);
+    return adoptRef(&objectStore.leakRef());
 }
 
 RefPtr<WebCore::IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext*, const Vector<String>&, const String&, ExceptionCode&)
@@ -189,6 +228,12 @@
 void IDBDatabase::didAbortTransaction(IDBTransaction& transaction)
 {
     LOG(IndexedDB, "IDBDatabase::didAbortTransaction");
+
+    if (transaction.isVersionChange()) {
+        ASSERT(transaction.originalDatabaseInfo());
+        m_info = *transaction.originalDatabaseInfo();
+    }
+
     didCommitOrAbortTransaction(transaction);
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -53,8 +53,8 @@
     virtual uint64_t version() const override final;
     virtual RefPtr<DOMStringList> objectStoreNames() const override final;
 
-    virtual RefPtr<IDBObjectStore> createObjectStore(const String& name, const Dictionary&, ExceptionCode&) override final;
-    virtual RefPtr<IDBObjectStore> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBObjectStore> createObjectStore(const String& name, const Dictionary&, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBObjectStore> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionCode&) override final;
     virtual RefPtr<WebCore::IDBTransaction> transaction(ScriptExecutionContext*, const Vector<String>&, const String& mode, ExceptionCode&) override final;
     virtual RefPtr<WebCore::IDBTransaction> transaction(ScriptExecutionContext*, const String&, const String& mode, ExceptionCode&) override final;
     virtual void deleteObjectStore(const String& name, ExceptionCode&) override final;
@@ -80,6 +80,8 @@
 
     void fireVersionChangeEvent(uint64_t requestedVersion);
 
+    IDBConnectionToServer& serverConnection() { return m_serverConnection.get(); }
+
 private:
     IDBDatabase(ScriptExecutionContext&, IDBConnectionToServer&, const IDBResultData&);
 

Added: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (0 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBObjectStoreImpl.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBTransactionImpl.h"
+
+namespace WebCore {
+namespace IDBClient {
+
+Ref<IDBObjectStore> IDBObjectStore::create(const IDBObjectStoreInfo& info, IDBTransaction& transaction)
+{
+    return adoptRef(*new IDBObjectStore(info, transaction));
+}
+
+IDBObjectStore::IDBObjectStore(const IDBObjectStoreInfo& info, IDBTransaction& transaction)
+    : m_info(info)
+    , m_transaction(transaction)
+{
+}
+
+IDBObjectStore::~IDBObjectStore()
+{
+}
+
+int64_t IDBObjectStore::id() const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+const String IDBObjectStore::name() const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBAny> IDBObjectStore::keyPathAny() const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+const IDBKeyPath IDBObjectStore::keyPath() const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<DOMStringList> IDBObjectStore::indexNames() const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBTransaction> IDBObjectStore::transaction() const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+bool IDBObjectStore::autoIncrement() const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext*, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext*, const Deprecated::ScriptValue&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext*, IDBKeyRange*, const String&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext*, const Deprecated::ScriptValue&, const String&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext*, const Deprecated::ScriptValue&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::get(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::add(JSC::ExecState&, Deprecated::ScriptValue&, const Deprecated::ScriptValue&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState&, Deprecated::ScriptValue&, const Deprecated::ScriptValue&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext*, const Deprecated::ScriptValue&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::clear(ScriptExecutionContext*, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext*, const String&, const IDBKeyPath&, bool, bool, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBIndex> IDBObjectStore::index(const String&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+void IDBObjectStore::deleteIndex(const String&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext*, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext*, const Deprecated::ScriptValue&, ExceptionCode&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+} // namespace IDBClient
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)

Added: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h (0 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (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 IDBObjectStoreImpl_h
+#define IDBObjectStoreImpl_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBObjectStore.h"
+#include "IDBObjectStoreInfo.h"
+
+namespace WebCore {
+namespace IDBClient {
+
+class IDBTransaction;
+
+class IDBObjectStore : public WebCore::IDBObjectStore {
+public:
+    static Ref<IDBObjectStore> create(const IDBObjectStoreInfo&, IDBTransaction&);
+
+    virtual ~IDBObjectStore() override final;
+
+    // Implement the IDBObjectStore IDL
+    virtual int64_t id() const override final;
+    virtual const String name() const override final;
+    virtual RefPtr<WebCore::IDBAny> keyPathAny() const override final;
+    virtual const IDBKeyPath keyPath() const override final;
+    virtual RefPtr<DOMStringList> indexNames() const override final;
+    virtual RefPtr<WebCore::IDBTransaction> transaction() const override final;
+    virtual bool autoIncrement() const override final;
+
+    virtual RefPtr<WebCore::IDBRequest> add(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> put(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext*, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext*, const Deprecated::ScriptValue& key, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext*, IDBKeyRange*, const String& direction, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> openCursor(ScriptExecutionContext*, const Deprecated::ScriptValue& key, const String& direction, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> get(ScriptExecutionContext*, const Deprecated::ScriptValue& key, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> get(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> add(JSC::ExecState&, Deprecated::ScriptValue&, const Deprecated::ScriptValue& key, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> put(JSC::ExecState&, Deprecated::ScriptValue&, const Deprecated::ScriptValue& key, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> deleteFunction(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> deleteFunction(ScriptExecutionContext*, const Deprecated::ScriptValue& key, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBIndex> createIndex(ScriptExecutionContext*, const String& name, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBIndex> index(const String& name, ExceptionCode&) override final;
+    virtual void deleteIndex(const String& name, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext*, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBRequest> count(ScriptExecutionContext*, const Deprecated::ScriptValue& key, ExceptionCode&) override final;
+
+private:
+    IDBObjectStore(const IDBObjectStoreInfo&, IDBTransaction&);
+
+    IDBObjectStoreInfo m_info;
+    Ref<IDBTransaction> m_transaction;
+};
+
+} // namespace IDBClient
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBObjectStoreImpl_h

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -115,6 +115,8 @@
     case IDBResultType::OpenDatabaseUpgradeNeeded:
         onUpgradeNeeded(data);
         break;
+    default:
+        RELEASE_ASSERT_NOT_REACHED();
     }
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -34,8 +34,10 @@
 #include "IDBError.h"
 #include "IDBEventDispatcher.h"
 #include "IDBObjectStore.h"
+#include "IDBResultData.h"
 #include "Logging.h"
 #include "ScriptExecutionContext.h"
+#include "TransactionOperation.h"
 
 namespace WebCore {
 namespace IDBClient {
@@ -85,13 +87,18 @@
     return &m_database.get();
 }
 
+IDBConnectionToServer& IDBTransaction::serverConnection()
+{
+    return m_database->serverConnection();
+}
+
 RefPtr<DOMError> IDBTransaction::error() const
 {
     ASSERT_NOT_REACHED();
     return nullptr;
 }
 
-RefPtr<IDBObjectStore> IDBTransaction::objectStore(const String&, ExceptionCode&)
+RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String&, ExceptionCode&)
 {
     ASSERT_NOT_REACHED();
     return nullptr;
@@ -144,6 +151,16 @@
     m_activationTimer = nullptr;
 }
 
+void IDBTransaction::scheduleOperation(RefPtr<TransactionOperation>&& operation)
+{
+    ASSERT(!m_transactionOperationMap.contains(operation->identifier()));
+
+    m_transactionOperationQueue.append(operation);
+    m_transactionOperationMap.set(operation->identifier(), WTF::move(operation));
+
+    scheduleOperationTimer();
+}
+
 void IDBTransaction::scheduleOperationTimer()
 {
     if (!m_operationTimer.isActive())
@@ -157,10 +174,13 @@
     if (m_state == IndexedDB::TransactionState::Unstarted)
         return;
 
-    // FIXME: Once transactions can do things, like configure the database or insert data into it,
-    // those operations will be handled here, and will prevent the transaction from committing
-    // as long as outstanding operations exist.
+    if (!m_transactionOperationQueue.isEmpty()) {
+        auto operation = m_transactionOperationQueue.takeFirst();
+        operation->perform();
 
+        return;
+    }
+
     if (isActive())
         commit();
 }
@@ -179,6 +199,14 @@
     m_database->commitTransaction(*this);
 }
 
+void IDBTransaction::finishAbortOrCommit()
+{
+    ASSERT(m_state != IndexedDB::TransactionState::Finished);
+    m_state = IndexedDB::TransactionState::Finished;
+
+    m_originalDatabaseInfo = nullptr;
+}
+
 void IDBTransaction::didAbort(const IDBError& error)
 {
     LOG(IndexedDB, "IDBTransaction::didAbort");
@@ -190,7 +218,7 @@
     m_idbError = error;
     fireOnAbort();
 
-    m_state = IndexedDB::TransactionState::Finished;
+    finishAbortOrCommit();
 }
 
 void IDBTransaction::didCommit(const IDBError& error)
@@ -208,7 +236,7 @@
         fireOnAbort();
     }
 
-    m_state = IndexedDB::TransactionState::Finished;
+    finishAbortOrCommit();
 }
 
 void IDBTransaction::fireOnComplete()
@@ -249,6 +277,38 @@
     return IDBEventDispatcher::dispatch(event.get(), targets);
 }
 
+Ref<IDBObjectStore> IDBTransaction::createObjectStore(const IDBObjectStoreInfo& info)
+{
+    LOG(IndexedDB, "IDBTransaction::createObjectStore");
+    ASSERT(isVersionChange());
+
+    Ref<IDBObjectStore> objectStore = IDBObjectStore::create(info, *this);
+
+    auto operation = createTransactionOperation(*this, &IDBTransaction::didCreateObjectStoreOnServer, &IDBTransaction::createObjectStoreOnServer, info);
+    scheduleOperation(WTF::move(operation));
+
+    return WTF::move(objectStore);
+}
+
+void IDBTransaction::createObjectStoreOnServer(TransactionOperation& operation, const IDBObjectStoreInfo& info)
+{
+    LOG(IndexedDB, "IDBTransaction::createObjectStoreOnServer");
+
+    ASSERT(isActive());
+    ASSERT(isVersionChange());
+
+    m_database->serverConnection().createObjectStore(operation, info);
+}
+
+void IDBTransaction::didCreateObjectStoreOnServer(const IDBResultData& resultData)
+{
+    LOG(IndexedDB, "IDBTransaction::didCreateObjectStoreOnServer");
+
+    ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::CreateObjectStoreSuccess);
+
+    scheduleOperationTimer();
+}
+
 } // namespace IDBClient
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -30,16 +30,23 @@
 
 #include "IDBDatabaseInfo.h"
 #include "IDBError.h"
+#include "IDBObjectStoreImpl.h"
 #include "IDBTransaction.h"
 #include "IDBTransactionInfo.h"
 #include "IndexedDB.h"
 #include "Timer.h"
-#include <heap/StrongInlines.h>
+#include <wtf/Deque.h>
+#include <wtf/HashMap.h>
 
 namespace WebCore {
+
+class IDBObjectStoreInfo;
+class IDBResultData;
+
 namespace IDBClient {
 
 class IDBDatabase;
+class TransactionOperation;
 
 class IDBTransaction : public WebCore::IDBTransaction {
 public:
@@ -51,7 +58,7 @@
     virtual const String& mode() const override final;
     virtual WebCore::IDBDatabase* db() override final;
     virtual RefPtr<DOMError> error() const override final;
-    virtual RefPtr<IDBObjectStore> objectStore(const String& name, ExceptionCode&) override final;
+    virtual RefPtr<WebCore::IDBObjectStore> objectStore(const String& name, ExceptionCode&) override final;
     virtual void abort(ExceptionCode&) override final;
 
     virtual EventTargetInterface eventTargetInterface() const override final { return IDBTransactionEventTargetInterfaceType; }
@@ -68,17 +75,28 @@
     const IDBTransactionInfo info() const { return m_info; }
     IDBDatabase& database() { return m_database.get(); }
     const IDBDatabase& database() const { return m_database.get(); }
+    IDBDatabaseInfo* originalDatabaseInfo() const { return m_originalDatabaseInfo.get(); }
 
     void didAbort(const IDBError&);
     void didCommit(const IDBError&);
 
+    bool isVersionChange() const { return m_info.mode() == IndexedDB::TransactionMode::VersionChange; }
+    bool isActive() const;
+
+    Ref<IDBObjectStore> createObjectStore(const IDBObjectStoreInfo&);
+
+    IDBConnectionToServer& serverConnection();
+
 private:
     IDBTransaction(IDBDatabase&, const IDBTransactionInfo&);
 
-    bool isActive() const;
     bool isFinishedOrFinishing() const;
+
     void commit();
 
+    void finishAbortOrCommit();
+
+    void scheduleOperation(RefPtr<TransactionOperation>&&);
     void scheduleOperationTimer();
     void operationTimerFired();
     void activationTimerFired();
@@ -87,6 +105,9 @@
     void fireOnAbort();
     void enqueueEvent(Ref<Event>);
 
+    void createObjectStoreOnServer(TransactionOperation&, const IDBObjectStoreInfo&);
+    void didCreateObjectStoreOnServer(const IDBResultData&);
+
     Ref<IDBDatabase> m_database;
     IDBTransactionInfo m_info;
     std::unique_ptr<IDBDatabaseInfo> m_originalDatabaseInfo;
@@ -96,6 +117,9 @@
 
     Timer m_operationTimer;
     std::unique_ptr<Timer> m_activationTimer;
+
+    Deque<RefPtr<TransactionOperation>> m_transactionOperationQueue;
+    HashMap<IDBResourceIdentifier, RefPtr<TransactionOperation>> m_transactionOperationMap;
 };
 
 } // namespace IDBClient

Added: trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (0 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (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 TransactionOperation_h
+#define TransactionOperation_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBResourceIdentifier.h"
+#include "IDBTransactionImpl.h"
+
+namespace WebCore {
+
+class IDBResultData;
+
+namespace IDBClient {
+
+class TransactionOperation : public RefCounted<TransactionOperation> {
+public:
+    void perform()
+    {
+        m_performFunction();
+    }
+
+    void completed(const IDBResultData& data)
+    {
+        m_completeFunction(data);
+    }
+
+    const IDBResourceIdentifier& identifier() const { return m_identifier; }
+    IDBResourceIdentifier transactionIdentifier() const { return m_transaction->info().identifier(); }
+
+protected:
+    TransactionOperation(IDBTransaction& transaction)
+        : m_transaction(transaction)
+        , m_identifier(transaction.serverConnection())
+    {
+    }
+
+    Ref<IDBTransaction> m_transaction;
+    IDBResourceIdentifier m_identifier;
+    std::function<void ()> m_performFunction;
+    std::function<void (const IDBResultData&)> m_completeFunction;
+};
+
+template <typename... Arguments>
+class TransactionOperationImpl final : public TransactionOperation {
+public:
+    TransactionOperationImpl(IDBTransaction& transaction, void (IDBTransaction::*completeMethod)(const IDBResultData&), void (IDBTransaction::*performMethod)(TransactionOperation&, Arguments...), Arguments&&... arguments)
+        : TransactionOperation(transaction)
+    {
+        relaxAdoptionRequirement();
+        RefPtr<TransactionOperation> self(this);
+        m_performFunction = [self, this, performMethod, arguments...] {
+            (&m_transaction.get()->*performMethod)(*this, arguments...);
+        };
+
+        m_completeFunction = [self, this, completeMethod](const IDBResultData& resultData) {
+            (&m_transaction.get()->*completeMethod)(resultData);
+        };
+    }
+};
+
+template<typename MP1, typename P1>
+RefPtr<TransactionOperation> createTransactionOperation(
+    IDBTransaction& transaction,
+    void (IDBTransaction::*complete)(const IDBResultData&),
+    void (IDBTransaction::*perform)(TransactionOperation&, MP1),
+    const P1& parameter1)
+{
+    auto operation = new TransactionOperationImpl<MP1>(transaction, complete, perform, parameter1);
+    return adoptRef(operation);
+}
+
+} // namespace IDBClient
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // TransactionOperation_h

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -63,6 +63,11 @@
     m_delegate->didAbortTransaction(transactionIdentifier, error);
 }
 
+void IDBConnectionToClient::didCreateObjectStore(const IDBResultData& result)
+{
+    m_delegate->didCreateObjectStore(result);
+}
+
 void IDBConnectionToClient::didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError& error)
 {
     m_delegate->didCommitTransaction(transactionIdentifier, error);

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -52,6 +52,7 @@
     void didOpenDatabase(const IDBResultData&);
     void didAbortTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
     void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
+    void didCreateObjectStore(const IDBResultData&);
 
     void fireVersionChangeEvent(UniqueIDBDatabaseConnection&, uint64_t requestedVersion);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -48,6 +48,7 @@
     virtual void didOpenDatabase(const IDBResultData&) = 0;
     virtual void didAbortTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) = 0;
     virtual void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) = 0;
+    virtual void didCreateObjectStore(const IDBResultData&) = 0;
 
     virtual void fireVersionChangeEvent(UniqueIDBDatabaseConnection&, uint64_t requestedVersion) = 0;
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -156,6 +156,18 @@
     transaction->abort();
 }
 
+void IDBServer::createObjectStore(const IDBRequestData& requestData, const IDBObjectStoreInfo& info)
+{
+    LOG(IndexedDB, "IDBServer::createObjectStore");
+
+    auto transaction = m_transactions.get(requestData.transactionIdentifier());
+    if (!transaction)
+        return;
+
+    ASSERT(transaction->isVersionChange());
+    transaction->createObjectStore(requestData, info);
+}
+
 void IDBServer::commitTransaction(const IDBResourceIdentifier& transactionIdentifier)
 {
     LOG(IndexedDB, "IDBServer::commitTransaction");

Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -59,6 +59,7 @@
     void deleteDatabase(const IDBRequestData&);
     void abortTransaction(const IDBResourceIdentifier&);
     void commitTransaction(const IDBResourceIdentifier&);
+    void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&);
     void databaseConnectionClosed(uint64_t databaseConnectionIdentifier);
 
     void postDatabaseTask(std::unique_ptr<CrossThreadTask>&&);

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -217,6 +217,37 @@
     handleOpenDatabaseOperations();
 }
 
+void UniqueIDBDatabase::createObjectStore(UniqueIDBDatabaseTransaction& transaction, const IDBObjectStoreInfo& info, ErrorCallback callback)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, "(main) UniqueIDBDatabase::createObjectStore");
+
+    uint64_t callbackID = storeCallback(callback);
+    m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performCreateObjectStore, callbackID, transaction.info().identifier(), info));
+}
+
+void UniqueIDBDatabase::performCreateObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier&, const IDBObjectStoreInfo& info)
+{
+    ASSERT(!isMainThread());
+    LOG(IndexedDB, "(db) UniqueIDBDatabase::performCreateObjectStore");
+
+    // FIXME: Create object store in backing store, once that exists.
+
+    IDBError error;
+    m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformCreateObjectStore, callbackIdentifier, error, info));
+}
+
+void UniqueIDBDatabase::didPerformCreateObjectStore(uint64_t callbackIdentifier, const IDBError& error, const IDBObjectStoreInfo& info)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, "(main) UniqueIDBDatabase::didPerformCreateObjectStore");
+
+    if (error.isNull())
+        m_databaseInfo->addExistingObjectStore(info);
+
+    performErrorCallback(callbackIdentifier, error);
+}
+
 void UniqueIDBDatabase::commitTransaction(UniqueIDBDatabaseTransaction& transaction, ErrorCallback callback)
 {
     ASSERT(isMainThread());
@@ -262,14 +293,6 @@
 
     ASSERT(&transaction.databaseConnection().database() == this);
 
-    if (m_versionChangeTransaction == &transaction) {
-        ASSERT(&m_versionChangeTransaction->databaseConnection() == m_versionChangeDatabaseConnection);
-        ASSERT(transaction.originalDatabaseInfo());
-        m_databaseInfo = std::make_unique<IDBDatabaseInfo>(*transaction.originalDatabaseInfo());
-        m_versionChangeTransaction = nullptr;
-        m_versionChangeDatabaseConnection = nullptr;
-    }
-
     uint64_t callbackID = storeCallback(callback);
     m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performAbortTransaction, callbackID, transaction.info().identifier()));
 }
@@ -280,14 +303,23 @@
     LOG(IndexedDB, "(db) UniqueIDBDatabase::performAbortTransaction");
 
     IDBError error = m_backingStore->abortTransaction(transactionIdentifier);
-    m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformAbortTransaction, callbackIdentifier, error));
+    m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformAbortTransaction, callbackIdentifier, error, transactionIdentifier));
 }
 
-void UniqueIDBDatabase::didPerformAbortTransaction(uint64_t callbackIdentifier, const IDBError& error)
+void UniqueIDBDatabase::didPerformAbortTransaction(uint64_t callbackIdentifier, const IDBError& error, const IDBResourceIdentifier& transactionIdentifier)
 {
     ASSERT(isMainThread());
     LOG(IndexedDB, "(main) UniqueIDBDatabase::didPerformAbortTransaction");
 
+    if (m_versionChangeTransaction || m_versionChangeTransaction->info().identifier() == transactionIdentifier) {
+        ASSERT(&m_versionChangeTransaction->databaseConnection() == m_versionChangeDatabaseConnection);
+        ASSERT(m_versionChangeTransaction->originalDatabaseInfo());
+        m_databaseInfo = std::make_unique<IDBDatabaseInfo>(*m_versionChangeTransaction->originalDatabaseInfo());
+
+        m_versionChangeTransaction = nullptr;
+        m_versionChangeDatabaseConnection = nullptr;
+    }
+
     // Previously blocked transactions might now be unblocked.
     invokeTransactionScheduler();
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -65,6 +65,7 @@
     const IDBDatabaseInfo& info() const;
     IDBServer& server() { return m_server; }
 
+    void createObjectStore(UniqueIDBDatabaseTransaction&, const IDBObjectStoreInfo&, ErrorCallback);
     void commitTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
     void abortTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
     void transactionDestroyed(UniqueIDBDatabaseTransaction&);
@@ -87,11 +88,13 @@
     void performCommitTransaction(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier);
     void performAbortTransaction(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier);
     void beginTransactionInBackingStore(const IDBTransactionInfo&);
+    void performCreateObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&);
 
     // Main thread callbacks
     void didOpenBackingStore(const IDBDatabaseInfo&);
+    void didPerformCreateObjectStore(uint64_t callbackIdentifier, const IDBError&, const IDBObjectStoreInfo&);
     void didPerformCommitTransaction(uint64_t callbackIdentifier, const IDBError&);
-    void didPerformAbortTransaction(uint64_t callbackIdentifier, const IDBError&);
+    void didPerformAbortTransaction(uint64_t callbackIdentifier, const IDBError&, const IDBResourceIdentifier& transactionIdentifier);
 
     void performErrorCallback(uint64_t callbackIdentifier, const IDBError&);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -117,6 +117,13 @@
     m_connectionToClient.didCommitTransaction(transactionIdentifier, error);
 }
 
+void UniqueIDBDatabaseConnection::didCreateObjectStore(const IDBResultData& resultData)
+{
+    LOG(IndexedDB, "UniqueIDBDatabaseConnection::didCreateObjectStore");
+
+    m_connectionToClient.didCreateObjectStore(resultData);
+}
+
 } // namespace IDBServer
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -36,6 +36,7 @@
 namespace WebCore {
 
 class IDBError;
+class IDBResultData;
 
 namespace IDBServer {
 
@@ -64,6 +65,7 @@
 
     void didAbortTransaction(UniqueIDBDatabaseTransaction&, const IDBError&);
     void didCommitTransaction(UniqueIDBDatabaseTransaction&, const IDBError&);
+    void didCreateObjectStore(const IDBResultData&);
 
 private:
     UniqueIDBDatabaseConnection(UniqueIDBDatabase&, IDBConnectionToClient&);

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -28,6 +28,8 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "IDBError.h"
+#include "IDBResultData.h"
 #include "IDBServer.h"
 #include "Logging.h"
 #include "UniqueIDBDatabase.h"
@@ -73,6 +75,11 @@
     });
 }
 
+bool UniqueIDBDatabaseTransaction::isVersionChange() const
+{
+    return m_transactionInfo.mode() == IndexedDB::TransactionMode::VersionChange;
+}
+
 void UniqueIDBDatabaseTransaction::commit()
 {
     LOG(IndexedDB, "UniqueIDBDatabaseTransaction::commit");
@@ -84,6 +91,23 @@
     });
 }
 
+void UniqueIDBDatabaseTransaction::createObjectStore(const IDBRequestData& requestData, const IDBObjectStoreInfo& info)
+{
+    LOG(IndexedDB, "UniqueIDBDatabaseTransaction::createObjectStore");
+
+    ASSERT(isVersionChange());
+    ASSERT(m_transactionInfo.identifier() == requestData.transactionIdentifier());
+
+    RefPtr<UniqueIDBDatabaseTransaction> self(this);
+    m_databaseConnection->database().createObjectStore(*this, info, [this, self, requestData](const IDBError& error) {
+        LOG(IndexedDB, "UniqueIDBDatabaseTransaction::createObjectStore (callback)");
+        if (error.isNull())
+            m_databaseConnection->didCreateObjectStore(IDBResultData::createObjectStoreSuccess(requestData.requestIdentifier()));
+        else
+            m_databaseConnection->didCreateObjectStore(IDBResultData::error(requestData.requestIdentifier(), error));
+    });
+}
+
 } // namespace IDBServer
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -36,6 +36,8 @@
 namespace WebCore {
 
 class IDBDatabaseInfo;
+class IDBObjectStoreInfo;
+class IDBRequestData;
 
 namespace IDBServer {
 
@@ -49,12 +51,15 @@
 
     UniqueIDBDatabaseConnection& databaseConnection() { return m_databaseConnection.get(); }
     const IDBTransactionInfo& info() const { return m_transactionInfo; }
+    bool isVersionChange() const;
 
     IDBDatabaseInfo* originalDatabaseInfo() const;
 
     void abort();
     void commit();
 
+    void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&);
+
 private:
     UniqueIDBDatabaseTransaction(UniqueIDBDatabaseConnection&, IDBTransactionInfo&);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -50,6 +50,43 @@
     return WTF::move(info);
 }
 
+bool IDBDatabaseInfo::hasObjectStore(const String& name) const
+{
+    for (auto& objectStore : m_objectStoreMap.values()) {
+        if (objectStore.name() == name)
+            return true;
+    }
+
+    return false;
+}
+
+IDBObjectStoreInfo IDBDatabaseInfo::createNewObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
+{
+    IDBObjectStoreInfo info(++m_maxObjectStoreID, name, keyPath, autoIncrement);
+    m_objectStoreMap.set(info.identifier(), info);
+    return info;
+}
+
+void IDBDatabaseInfo::addExistingObjectStore(const IDBObjectStoreInfo& info)
+{
+    ASSERT(!m_objectStoreMap.contains(info.identifier()));
+
+    if (info.identifier() > m_maxObjectStoreID)
+        m_maxObjectStoreID = info.identifier();
+
+    m_objectStoreMap.set(info.identifier(), info);
+}
+
+Vector<String> IDBDatabaseInfo::objectStoreNames() const
+{
+    Vector<String> names;
+    names.reserveCapacity(m_objectStoreMap.size());
+    for (auto& objectStore : m_objectStoreMap.values())
+        names.uncheckedAppend(objectStore.name());
+
+    return WTF::move(names);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INDEXED_DATABASE)

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -28,10 +28,13 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
-#include <wtf/text/WTFString.h>
+#include "IDBObjectStoreInfo.h"
+#include <wtf/HashMap.h>
 
 namespace WebCore {
 
+class IDBKeyPath;
+
 class IDBDatabaseInfo {
 public:
     IDBDatabaseInfo(const String& name, uint64_t version);
@@ -43,11 +46,21 @@
     void setVersion(uint64_t version) { m_version = version; }
     uint64_t version() const { return m_version; }
 
+    bool hasObjectStore(const String& name) const;
+    IDBObjectStoreInfo createNewObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement);
+    void addExistingObjectStore(const IDBObjectStoreInfo&);
+
+    Vector<String> objectStoreNames() const;
+
 private:
     IDBDatabaseInfo();
 
     String m_name;
     uint64_t m_version { 0 };
+    uint64_t m_maxObjectStoreID { 0 };
+
+    HashMap<uint64_t, IDBObjectStoreInfo> m_objectStoreMap;
+
 };
 
 } // namespace WebCore

Copied: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp (from rev 191464, trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp) (0 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBObjectStoreInfo.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+IDBObjectStoreInfo::IDBObjectStoreInfo()
+{
+}
+
+IDBObjectStoreInfo::IDBObjectStoreInfo(uint64_t identifier, const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
+    : m_identifier(identifier)
+    , m_name(name)
+    , m_keyPath(keyPath)
+    , m_autoIncrement(autoIncrement)
+{
+}
+
+IDBObjectStoreInfo IDBObjectStoreInfo::isolatedCopy() const
+{
+    return { m_identifier, m_name.isolatedCopy(), m_keyPath.isolatedCopy(), m_autoIncrement };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)

Copied: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h (from rev 191464, trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h) (0 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (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 IDBObjectStoreInfo_h
+#define IDBObjectStoreInfo_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBKeyPath.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class IDBKeyPath;
+
+class IDBObjectStoreInfo {
+public:
+    IDBObjectStoreInfo();
+    IDBObjectStoreInfo(uint64_t identifier, const String& name, const IDBKeyPath&, bool autoIncrement);
+
+    uint64_t identifier() const { return m_identifier; }
+    const String& name() const { return m_name; }
+    const IDBKeyPath& keyPath() const { return m_keyPath; }
+    bool autoIncrement() const { return m_autoIncrement; }
+
+    IDBObjectStoreInfo isolatedCopy() const;
+
+private:
+    uint64_t m_identifier { 0 };
+    String m_name;
+    IDBKeyPath m_keyPath;
+    bool m_autoIncrement { false };
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBObjectStoreInfo_h

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -34,12 +34,40 @@
 namespace WebCore {
 
 IDBRequestData::IDBRequestData(const IDBClient::IDBConnectionToServer& connection, const IDBClient::IDBOpenDBRequest& request)
-    : m_requestIdentifier(connection, request)
+    : m_requestIdentifier(std::make_unique<IDBResourceIdentifier>(connection, request))
     , m_databaseIdentifier(request.databaseIdentifier())
     , m_requestedVersion(request.version())
 {
 }
 
+IDBRequestData::IDBRequestData(IDBClient::TransactionOperation& operation)
+    : m_requestIdentifier(std::make_unique<IDBResourceIdentifier>(operation.identifier()))
+    , m_transactionIdentifier(std::make_unique<IDBResourceIdentifier>(operation.transactionIdentifier()))
+{
+}
+
+IDBRequestData::IDBRequestData(const IDBRequestData& other)
+    : m_databaseIdentifier(other.m_databaseIdentifier)
+    , m_requestedVersion(other.m_requestedVersion)
+{
+    if (other.m_requestIdentifier)
+        m_requestIdentifier = std::make_unique<IDBResourceIdentifier>(*other.m_requestIdentifier);
+    if (other.m_transactionIdentifier)
+        m_transactionIdentifier = std::make_unique<IDBResourceIdentifier>(*other.m_transactionIdentifier);
+}
+
+IDBResourceIdentifier IDBRequestData::requestIdentifier() const
+{
+    RELEASE_ASSERT(m_requestIdentifier);
+    return *m_requestIdentifier;
+}
+
+IDBResourceIdentifier IDBRequestData::transactionIdentifier() const
+{
+    RELEASE_ASSERT(m_transactionIdentifier);
+    return *m_transactionIdentifier;
+}
+
 uint64_t IDBRequestData::requestedVersion() const
 {
     return m_requestedVersion;

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -37,21 +37,28 @@
 class IDBConnectionToServer;
 class IDBOpenDBRequest;
 class IDBTransaction;
+class TransactionOperation;
 }
 
 class IDBRequestData {
 public:
     IDBRequestData(const IDBClient::IDBConnectionToServer&, const IDBClient::IDBOpenDBRequest&);
+    explicit IDBRequestData(IDBClient::TransactionOperation&);
+    IDBRequestData(const IDBRequestData&);
 
-    IDBResourceIdentifier requestIdentifier() const { return m_requestIdentifier; }
+    IDBResourceIdentifier requestIdentifier() const;
+    IDBResourceIdentifier transactionIdentifier() const;
+
     const IDBDatabaseIdentifier& databaseIdentifier() const { return m_databaseIdentifier; }
-
     uint64_t requestedVersion() const;
 
+    IDBRequestData isolatedCopy();
+
 private:
-    IDBResourceIdentifier m_requestIdentifier;
+    std::unique_ptr<IDBResourceIdentifier> m_requestIdentifier;
+    std::unique_ptr<IDBResourceIdentifier> m_transactionIdentifier;
+
     IDBDatabaseIdentifier m_databaseIdentifier;
-
     uint64_t m_requestedVersion { 0 };
 };
 

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -39,6 +39,12 @@
 {
 }
 
+IDBResultData::IDBResultData(IDBResultType type, const IDBResourceIdentifier& requestIdentifier)
+    : m_type(type)
+    , m_requestIdentifier(requestIdentifier)
+{
+}
+
 IDBResultData::IDBResultData(const IDBResultData& other)
     : m_type(other.m_type)
     , m_requestIdentifier(other.m_requestIdentifier)
@@ -79,6 +85,11 @@
     return WTF::move(result);
 }
 
+IDBResultData IDBResultData::createObjectStoreSuccess(const IDBResourceIdentifier& requestIdentifier)
+{
+    return { IDBResultType::CreateObjectStoreSuccess, requestIdentifier };
+}
+
 const IDBDatabaseInfo& IDBResultData::databaseInfo() const
 {
     RELEASE_ASSERT(m_databaseInfo);

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -46,6 +46,7 @@
     Error,
     OpenDatabaseSuccess,
     OpenDatabaseUpgradeNeeded,
+    CreateObjectStoreSuccess,
 };
 
 class IDBResultData {
@@ -53,6 +54,8 @@
     static IDBResultData error(const IDBResourceIdentifier&, const IDBError&);
     static IDBResultData openDatabaseSuccess(const IDBResourceIdentifier&, IDBServer::UniqueIDBDatabaseConnection&);
     static IDBResultData openDatabaseUpgradeNeeded(const IDBResourceIdentifier&, IDBServer::UniqueIDBDatabaseTransaction&);
+    static IDBResultData createObjectStoreSuccess(const IDBResourceIdentifier&);
+
     IDBResultData(const IDBResultData&);
 
     IDBResultType type() const { return m_type; }
@@ -66,6 +69,7 @@
 
 private:
     IDBResultData(const IDBResourceIdentifier&);
+    IDBResultData(IDBResultType, const IDBResourceIdentifier&);
 
     IDBResultType m_type;
     IDBResourceIdentifier m_requestIdentifier;

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -118,6 +118,14 @@
     });
 }
 
+void InProcessIDBServer::didCreateObjectStore(const IDBResultData& resultData)
+{
+    RefPtr<InProcessIDBServer> self(this);
+    RunLoop::current().dispatch([this, self, resultData] {
+        m_connectionToServer->didCreateObjectStore(resultData);
+    });
+}
+
 void InProcessIDBServer::abortTransaction(IDBResourceIdentifier& resourceIdentifier)
 {
     RefPtr<InProcessIDBServer> self(this);
@@ -134,6 +142,14 @@
     });
 }
 
+void InProcessIDBServer::createObjectStore(const IDBRequestData& resultData, const IDBObjectStoreInfo& info)
+{
+    RefPtr<InProcessIDBServer> self(this);
+    RunLoop::current().dispatch([this, self, resultData, info] {
+        m_server->createObjectStore(resultData, info);
+    });
+}
+
 void InProcessIDBServer::fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConnection& connection, uint64_t requestedVersion)
 {
     RefPtr<InProcessIDBServer> self(this);

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (191464 => 191465)


--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -58,6 +58,7 @@
     virtual void openDatabase(IDBRequestData&) override final;
     virtual void abortTransaction(IDBResourceIdentifier&) override final;
     virtual void commitTransaction(IDBResourceIdentifier&) override final;
+    virtual void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&) override final;
     virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) override final;
 
     // IDBConnectionToClient
@@ -66,6 +67,7 @@
     virtual void didOpenDatabase(const IDBResultData&) override final;
     virtual void didAbortTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) override final;
     virtual void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) override final;
+    virtual void didCreateObjectStore(const IDBResultData&) override final;
     virtual void fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConnection&, uint64_t requestedVersion) override final;
 
     virtual void ref() override { RefCounted<InProcessIDBServer>::ref(); }

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (191464 => 191465)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-10-22 19:10:15 UTC (rev 191465)
@@ -2010,6 +2010,11 @@
 		514C767F0CE923A1007EF3CD /* ResourceResponseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C766A0CE923A1007EF3CD /* ResourceResponseBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5160300B0CC4251200C8AC25 /* FileSystemPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */; };
 		5160306C0CC4362300C8AC25 /* FileSystemCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */; };
+		5160712E1BD8307800DBC4F2 /* IDBObjectStoreInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5160712C1BD8307200DBC4F2 /* IDBObjectStoreInfo.cpp */; };
+		5160712F1BD8307800DBC4F2 /* IDBObjectStoreInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160712D1BD8307200DBC4F2 /* IDBObjectStoreInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		516071301BD8308600DBC4F2 /* IDBObjectStoreImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 516071291BD8305300DBC4F2 /* IDBObjectStoreImpl.cpp */; };
+		516071311BD8308600DBC4F2 /* IDBObjectStoreImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160712A1BD8305300DBC4F2 /* IDBObjectStoreImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		516071321BD8308B00DBC4F2 /* TransactionOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160712B1BD8305300DBC4F2 /* TransactionOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5160F4980B0AA75F00C1D2AF /* HistoryItemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5160F4970B0AA75F00C1D2AF /* HistoryItemMac.mm */; };
 		5162C7F411F77EFB00612EFE /* SchemeRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5162C7F211F77EFA00612EFE /* SchemeRegistry.cpp */; };
 		5162C7F511F77EFB00612EFE /* SchemeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 5162C7F311F77EFB00612EFE /* SchemeRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9397,6 +9402,11 @@
 		515E5FEF195101470086CA5E /* PlatformGamepad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformGamepad.h; sourceTree = "<group>"; };
 		5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemPOSIX.cpp; sourceTree = "<group>"; };
 		5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemCF.cpp; sourceTree = "<group>"; };
+		516071291BD8305300DBC4F2 /* IDBObjectStoreImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBObjectStoreImpl.cpp; sourceTree = "<group>"; };
+		5160712A1BD8305300DBC4F2 /* IDBObjectStoreImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBObjectStoreImpl.h; sourceTree = "<group>"; };
+		5160712B1BD8305300DBC4F2 /* TransactionOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransactionOperation.h; sourceTree = "<group>"; };
+		5160712C1BD8307200DBC4F2 /* IDBObjectStoreInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBObjectStoreInfo.cpp; sourceTree = "<group>"; };
+		5160712D1BD8307200DBC4F2 /* IDBObjectStoreInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBObjectStoreInfo.h; sourceTree = "<group>"; };
 		5160F4970B0AA75F00C1D2AF /* HistoryItemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HistoryItemMac.mm; sourceTree = "<group>"; };
 		5162C7F211F77EFA00612EFE /* SchemeRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SchemeRegistry.cpp; sourceTree = "<group>"; };
 		5162C7F311F77EFB00612EFE /* SchemeRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SchemeRegistry.h; sourceTree = "<group>"; };
@@ -16784,6 +16794,8 @@
 				5198F7AF1BBDF59200E2CC5F /* IDBDatabaseImpl.h */,
 				5103104A1BA8C6A6003329C0 /* IDBFactoryImpl.cpp */,
 				5103104B1BA8C6A6003329C0 /* IDBFactoryImpl.h */,
+				516071291BD8305300DBC4F2 /* IDBObjectStoreImpl.cpp */,
+				5160712A1BD8305300DBC4F2 /* IDBObjectStoreImpl.h */,
 				510310561BA8DB30003329C0 /* IDBOpenDBRequestImpl.cpp */,
 				510310571BA8DB30003329C0 /* IDBOpenDBRequestImpl.h */,
 				510310581BA8DB30003329C0 /* IDBRequestImpl.cpp */,
@@ -16792,6 +16804,7 @@
 				5198F7B31BBE001D00E2CC5F /* IDBTransactionImpl.h */,
 				5198F7B61BC3141700E2CC5F /* IDBVersionChangeEventImpl.cpp */,
 				5198F7B71BC3141700E2CC5F /* IDBVersionChangeEventImpl.h */,
+				5160712B1BD8305300DBC4F2 /* TransactionOperation.h */,
 			);
 			path = client;
 			sourceTree = "<group>";
@@ -16803,6 +16816,8 @@
 				51BA4AC21BBB5CBF00DF3D6D /* IDBDatabaseInfo.h */,
 				5148453C1BB9D076006A72ED /* IDBError.cpp */,
 				5148453D1BB9D076006A72ED /* IDBError.h */,
+				5160712C1BD8307200DBC4F2 /* IDBObjectStoreInfo.cpp */,
+				5160712D1BD8307200DBC4F2 /* IDBObjectStoreInfo.h */,
 				510A58F51BACC4A500C19282 /* IDBRequestData.cpp */,
 				510A58F61BACC4A500C19282 /* IDBRequestData.h */,
 				5145B1071BC4890B00E86219 /* IDBResourceIdentifier.cpp */,
@@ -26235,6 +26250,7 @@
 				B2FA3D5D0AB75A6F000E5AC4 /* JSSVGColor.h in Headers */,
 				B2FA3D5F0AB75A6F000E5AC4 /* JSSVGComponentTransferFunctionElement.h in Headers */,
 				B2FA3D610AB75A6F000E5AC4 /* JSSVGCursorElement.h in Headers */,
+				516071311BD8308600DBC4F2 /* IDBObjectStoreImpl.h in Headers */,
 				B2FA3D630AB75A6F000E5AC4 /* JSSVGDefsElement.h in Headers */,
 				B2FA3D650AB75A6F000E5AC4 /* JSSVGDescElement.h in Headers */,
 				B2FA3D670AB75A6F000E5AC4 /* JSSVGDocument.h in Headers */,
@@ -27146,6 +27162,7 @@
 				A84D82C111D3474800972990 /* ScriptableDocumentParser.h in Headers */,
 				41F1D21F0EF35C2A00DA8753 /* ScriptCachedFrameData.h in Headers */,
 				93B70D7009EB0C7C009D8468 /* ScriptController.h in Headers */,
+				516071321BD8308B00DBC4F2 /* TransactionOperation.h in Headers */,
 				4998AED213FB224D0090B1AA /* ScriptedAnimationController.h in Headers */,
 				08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */,
 				E11C9D9B0EB3681200E409DB /* ScriptExecutionContext.h in Headers */,
@@ -27330,6 +27347,7 @@
 				8386A96D19F61B2E00E1EC4A /* StyleBuilder.h in Headers */,
 				83B9687B19F8AB83004EF7AF /* StyleBuilderConverter.h in Headers */,
 				835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */,
+				5160712F1BD8307800DBC4F2 /* IDBObjectStoreInfo.h in Headers */,
 				BCEF444D0E674628001C1287 /* StyleCachedImage.h in Headers */,
 				9393E605151A9A1800066F06 /* StyleCachedImageSet.h in Headers */,
 				9DAC7C571AF2CB6400437C44 /* StyleContentAlignmentData.h in Headers */,
@@ -29076,6 +29094,7 @@
 				B275355B0B053814002CE64F /* FloatSizeCG.cpp in Sources */,
 				B275357A0B053814002CE64F /* FloatSizeMac.mm in Sources */,
 				D72F6D79153159A3001EE44E /* FlowThreadController.cpp in Sources */,
+				5160712E1BD8307800DBC4F2 /* IDBObjectStoreInfo.cpp in Sources */,
 				14993BE50B2F2B1C0050497F /* FocusController.cpp in Sources */,
 				B6D9D23614EABD260090D75E /* FocusEvent.cpp in Sources */,
 				B2C3DA640D006CD600EF6F26 /* Font.cpp in Sources */,
@@ -30978,6 +30997,7 @@
 				B2227A260D00BF220071B782 /* SVGGElement.cpp in Sources */,
 				087E0AF613606D0B00FA4BA8 /* SVGGlyph.cpp in Sources */,
 				B2A1F2AD0CEF0ABF00442F6A /* SVGGlyphElement.cpp in Sources */,
+				516071301BD8308600DBC4F2 /* IDBObjectStoreImpl.cpp in Sources */,
 				24D912BD13CA9A9700D21915 /* SVGGlyphRefElement.cpp in Sources */,
 				B2227A290D00BF220071B782 /* SVGGradientElement.cpp in Sources */,
 				B2227AB50D00BF220071B782 /* SVGGraphicsElement.cpp in Sources */,

Modified: trunk/Source/WebCore/platform/CrossThreadCopier.cpp (191464 => 191465)


--- trunk/Source/WebCore/platform/CrossThreadCopier.cpp	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/platform/CrossThreadCopier.cpp	2015-10-22 19:10:15 UTC (rev 191465)
@@ -49,6 +49,7 @@
 #include "IDBGetResult.h"
 #include "IDBKeyData.h"
 #include "IDBKeyRangeData.h"
+#include "IDBObjectStoreInfo.h"
 #include "IDBResourceIdentifier.h"
 #include "IDBTransactionInfo.h"
 #endif
@@ -157,6 +158,11 @@
     return error.isolatedCopy();
 }
 
+CrossThreadCopierBase<false, false, IDBObjectStoreInfo>::Type CrossThreadCopierBase<false, false, IDBObjectStoreInfo>::copy(const IDBObjectStoreInfo& info)
+{
+    return info.isolatedCopy();
+}
+
 #endif // ENABLE(INDEXED_DATABASE)
 
 // Test CrossThreadCopier using COMPILE_ASSERT.

Modified: trunk/Source/WebCore/platform/CrossThreadCopier.h (191464 => 191465)


--- trunk/Source/WebCore/platform/CrossThreadCopier.h	2015-10-22 18:42:15 UTC (rev 191464)
+++ trunk/Source/WebCore/platform/CrossThreadCopier.h	2015-10-22 19:10:15 UTC (rev 191465)
@@ -221,6 +221,12 @@
         static Type copy(const IDBTransactionInfo&);
     };
 
+    class IDBObjectStoreInfo;
+    template<> struct WEBCORE_EXPORT CrossThreadCopierBase<false, false, IDBObjectStoreInfo> {
+        typedef IDBObjectStoreInfo Type;
+        static Type copy(const IDBObjectStoreInfo&);
+    };
+
 #endif
 
     template<typename T>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to