Add an IDB Server that can roundtrip a request back to the client.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Sep 2015 22:44:42 +0000 (22:44 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Sep 2015 22:44:42 +0000 (22:44 +0000)
commit14e44e0667d8b48820c06dbb46985c556a797990
tree238155629c7cfa862beca8eff5f598672fe34ef7
parentb377753060535b83336e74599feab7a3345d2a68
Add an IDB Server that can roundtrip a request back to the client.
https://bugs.webkit.org/show_bug.cgi?id=149603

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/deletedatabase-request-event.html

This is a critical piece of IDB infrastructure that:
- Puts a database client/server divide in place.
- Client synchronously sends requests to the server, and asynchronously receives a response back from it.
- Introduces a class structure that makes it easy for WebKit2 to add a thin layer to replace the
  in-process server with an out-of-process server.

To allow for the most basic of tests, the "delete database" request is hard coded as always failing
with an indeterminate error.

* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
(WebCore::DOMWindowIndexedDatabase::indexedDB):

* Modules/indexeddb/IDBDatabaseIdentifier.cpp:
(WebCore::IDBDatabaseIdentifier::debugString):
* Modules/indexeddb/IDBDatabaseIdentifier.h:

* Modules/indexeddb/client/IDBConnectionToServer.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp.
(WebCore::IDBClient::IDBConnectionToServer::create):
(WebCore::IDBClient::IDBConnectionToServer::IDBConnectionToServer):
(WebCore::IDBClient::IDBConnectionToServer::identifier):
(WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
(WebCore::IDBClient::IDBConnectionToServer::didDeleteDatabase):

* Modules/indexeddb/client/IDBConnectionToServer.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h.
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h.
(WebCore::IDBClient::IDBConnectionToServerDelegate::~IDBConnectionToServerDelegate):

* Modules/indexeddb/client/IDBFactoryImpl.cpp:
(WebCore::IDBClient::IDBFactory::create):
(WebCore::IDBClient::IDBFactory::IDBFactory):
(WebCore::IDBClient::IDBFactory::openInternal):
(WebCore::IDBClient::IDBFactory::deleteDatabase):
* Modules/indexeddb/client/IDBFactoryImpl.h:

* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::createDeleteRequest):
(WebCore::IDBClient::IDBOpenDBRequest::createOpenRequest):
(WebCore::IDBClient::IDBOpenDBRequest::IDBOpenDBRequest):
(WebCore::IDBClient::IDBOpenDBRequest::~IDBOpenDBRequest):
(WebCore::IDBClient::IDBOpenDBRequest::requestCompleted):
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
(WebCore::IDBClient::IDBOpenDBRequest::databaseIdentifier):
(WebCore::IDBClient::IDBOpenDBRequest::version):
(WebCore::IDBClient::IDBOpenDBRequest::create): Deleted.

* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::IDBRequest):
(WebCore::IDBClient::IDBRequest::enqueueEvent):
* Modules/indexeddb/client/IDBRequestImpl.h:
(WebCore::IDBClient::IDBRequest::requestIdentifier):

* Modules/indexeddb/server/IDBConnectionToClient.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp.
(WebCore::IDBServer::IDBConnectionToClient::create):
(WebCore::IDBServer::IDBConnectionToClient::IDBConnectionToClient):
(WebCore::IDBServer::IDBConnectionToClient::identifier):
(WebCore::IDBServer::IDBConnectionToClient::didDeleteDatabase):
* Modules/indexeddb/server/IDBConnectionToClient.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h.
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h.
(WebCore::IDBServer::IDBConnectionToClientDelegate::~IDBConnectionToClientDelegate):

* Modules/indexeddb/server/IDBServer.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp.
(WebCore::IDBServer::IDBServer::create):
(WebCore::IDBServer::IDBServer::IDBServer):
(WebCore::IDBServer::IDBServer::registerConnection):
(WebCore::IDBServer::IDBServer::unregisterConnection):
(WebCore::IDBServer::IDBServer::deleteDatabase):
* Modules/indexeddb/server/IDBServer.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h.

* Modules/indexeddb/shared/IDBError.cpp: Copied from Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp.
(WebCore::idbExceptionEntry):
(WebCore::IDBError::IDBError):
(WebCore::IDBError::operator=):
(WebCore::IDBError::name):
(WebCore::IDBError::message):
* Modules/indexeddb/shared/IDBError.h: Copied from Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp.
(WebCore::IDBError::IDBError):
(WebCore::IDBError::isNull):

* Modules/indexeddb/shared/IDBRequestData.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp.
(WebCore::IDBRequestData::IDBRequestData):
* Modules/indexeddb/shared/IDBRequestData.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h.
(WebCore::IDBRequestData::requestIdentifier):
(WebCore::IDBRequestData::databaseIdentifier):

* Modules/indexeddb/shared/IDBRequestIdentifier.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp.
(WebCore::nextRequestNumber):
(WebCore::IDBRequestIdentifier::IDBRequestIdentifier):
(WebCore::IDBRequestIdentifier::emptyValue):
(WebCore::IDBRequestIdentifier::deletedValue):
(WebCore::IDBRequestIdentifier::isHashTableDeletedValue):
* Modules/indexeddb/shared/IDBRequestIdentifier.h: Added.
(WebCore::IDBRequestIdentifier::isEmpty):
(WebCore::IDBRequestIdentifier::hash):
(WebCore::IDBRequestIdentifier::operator==):
(WebCore::IDBRequestIdentifier::connectionIdentifier):
(WebCore::IDBRequestIdentifierHash::hash):
(WebCore::IDBRequestIdentifierHash::equal):
(WebCore::IDBRequestIdentifierHashTraits::emptyValue):
(WebCore::IDBRequestIdentifierHashTraits::isEmptyValue):
(WebCore::IDBRequestIdentifierHashTraits::constructDeletedValue):
(WebCore::IDBRequestIdentifierHashTraits::isDeletedValue):

* Modules/indexeddb/shared/IDBResultData.cpp: Copied from Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp.
(WebCore::IDBResultData::IDBResultData):
* Modules/indexeddb/shared/IDBResultData.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h.
(WebCore::IDBResultData::requestIdentifier):
(WebCore::IDBResultData::error):

* Modules/indexeddb/shared/InProcessIDBServer.cpp: Added.
(WebCore::InProcessIDBServer::create):
(WebCore::InProcessIDBServer::InProcessIDBServer):
(WebCore::InProcessIDBServer::identifier):
(WebCore::InProcessIDBServer::connectionToServer):
(WebCore::InProcessIDBServer::connectionToClient):
(WebCore::InProcessIDBServer::deleteDatabase):
(WebCore::InProcessIDBServer::didDeleteDatabase):
* Modules/indexeddb/shared/InProcessIDBServer.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h.

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

* loader/EmptyClients.cpp:

* page/DatabaseProvider.h:

* page/Page.cpp:
(WebCore::Page::idbConnection):
* page/Page.h:

* page/SecurityOriginData.cpp:
(WebCore::SecurityOriginData::debugString):
* page/SecurityOriginData.h:

Source/WebKit:

* Storage/WebDatabaseProvider.cpp:
(WebDatabaseProvider::idbConnectionToServerForSession):
* Storage/WebDatabaseProvider.h:

Source/WebKit2:

* WebProcess/Databases/WebDatabaseProvider.h:

LayoutTests:

* storage/indexeddb/modern/deletedatabase-request-event-expected.txt: Added.
* storage/indexeddb/modern/deletedatabase-request-event.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
44 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/modern/deletedatabase-request-event-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/deletedatabase-request-event.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.h
Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h
Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp
Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/IDBServer.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBError.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBError.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBRequestData.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBRequestData.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBRequestIdentifier.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBRequestIdentifier.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBResultData.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/EmptyClients.cpp
Source/WebCore/page/DatabaseProvider.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/SecurityOriginData.cpp
Source/WebCore/page/SecurityOriginData.h
Source/WebKit/ChangeLog
Source/WebKit/Storage/WebDatabaseProvider.cpp
Source/WebKit/Storage/WebDatabaseProvider.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Databases/WebDatabaseProvider.h