Add UniqueIDBDatabase object, IDBBackingStore objects, and a database operation thread.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2015 01:04:19 +0000 (01:04 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2015 01:04:19 +0000 (01:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149678

Reviewed by Alex Christensen.

Source/WebCore:

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

- UniqueIDBDatabase represents a specific IDB database instance that can have multiple
  connections to it.
- IDBBackingStore is an abstract representation of a unique database's backing store,
  and has a concrete in-memory implementation for now.
- The database thread exists on IDBServer and is for offloading actual database I/O from
  the main thread.

* CMakeLists.txt:

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

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::openDatabase):
(WebCore::IDBClient::IDBConnectionToServer::didOpenDatabase):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

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

* Modules/indexeddb/server/IDBBackingStore.h: Copied from Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h.
(WebCore::IDBServer::IDBBackingStore::~IDBBackingStore):

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

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::IDBServer):
(WebCore::IDBServer::IDBServer::getOrCreateUniqueIDBDatabase):
(WebCore::IDBServer::IDBServer::createBackingStore):
(WebCore::IDBServer::IDBServer::openDatabase):
(WebCore::IDBServer::IDBServer::deleteDatabase):
(WebCore::IDBServer::IDBServer::postDatabaseTask):
(WebCore::IDBServer::IDBServer::postDatabaseTaskReply):
(WebCore::IDBServer::IDBServer::databaseThreadEntry):
(WebCore::IDBServer::IDBServer::databaseRunLoop):
(WebCore::IDBServer::IDBServer::handleTaskRepliesOnMainThread):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/IDBServerOperation.cpp: Copied from Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h.
(WebCore::IDBServer::IDBServerOperation::create):
(WebCore::IDBServer::IDBServerOperation::IDBServerOperation):
* Modules/indexeddb/server/IDBServerOperation.h: Copied from Source/WebCore/Modules/indexeddb/server/IDBServer.h.
(WebCore::IDBServer::IDBServerOperation::connection):
(WebCore::IDBServer::IDBServerOperation::requestData):

* Modules/indexeddb/server/MemoryIDBBackingStore.cpp: Copied from Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp.
(WebCore::IDBServer::MemoryIDBBackingStore::create):
(WebCore::IDBServer::MemoryIDBBackingStore::MemoryIDBBackingStore):
(WebCore::IDBServer::MemoryIDBBackingStore::~MemoryIDBBackingStore):
(WebCore::IDBServer::MemoryIDBBackingStore::getOrEstablishDatabaseInfo):
* Modules/indexeddb/server/MemoryIDBBackingStore.h: Copied from Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp: Added.
(WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
(WebCore::IDBServer::UniqueIDBDatabase::openDatabaseConnection):
(WebCore::IDBServer::UniqueIDBDatabase::handleOpenDatabaseOperations):
(WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::didOpenBackingStore):
* Modules/indexeddb/server/UniqueIDBDatabase.h: Copied from Source/WebCore/Modules/indexeddb/server/IDBServer.h.
(WebCore::IDBServer::UniqueIDBDatabase::create):

* Modules/indexeddb/shared/IDBDatabaseInfo.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h.
(WebCore::IDBDatabaseInfo::IDBDatabaseInfo):
(WebCore::IDBDatabaseInfo::isolatedCopy):
* Modules/indexeddb/shared/IDBDatabaseInfo.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h.
(WebCore::IDBDatabaseInfo::IDBDatabaseInfo):

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::didDeleteDatabase):
(WebCore::InProcessIDBServer::openDatabase):
(WebCore::InProcessIDBServer::didOpenDatabase):
* Modules/indexeddb/shared/InProcessIDBServer.h:

* WebCore.xcodeproj/project.pbxproj:

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

LayoutTests:

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

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

30 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/modern/opendatabase-request-event-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/opendatabase-request-event.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseIdentifier.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h
Source/WebCore/Modules/indexeddb/client/IDBFactoryImpl.cpp
Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
Source/WebCore/Modules/indexeddb/server/IDBServer.h
Source/WebCore/Modules/indexeddb/server/IDBServerOperation.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/IDBServerOperation.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/CrossThreadCopier.cpp
Source/WebCore/platform/CrossThreadCopier.h

index 42a60e9..43aced0 100644 (file)
@@ -1,3 +1,13 @@
+2015-09-30  Brady Eidson  <beidson@apple.com>
+
+        Add UniqueIDBDatabase object, IDBBackingStore objects, and a database operation thread.
+        https://bugs.webkit.org/show_bug.cgi?id=149678
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/opendatabase-request-event-expected.txt: Added.
+        * storage/indexeddb/modern/opendatabase-request-event.html: Added.
+
 2015-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Crash when using an SVG font with > 390 glyphs
diff --git a/LayoutTests/storage/indexeddb/modern/opendatabase-request-event-expected.txt b/LayoutTests/storage/indexeddb/modern/opendatabase-request-event-expected.txt
new file mode 100644 (file)
index 0000000..b342fd6
--- /dev/null
@@ -0,0 +1,4 @@
+ALERT: [object IDBOpenDBRequest]
+ALERT: error [object Event]
+ALERT: Done
+This test calls open on window.indexedDB in various ways, verifying that IDBOpenDBRequest objects are returned when expected and exceptions are thrown when expected.
diff --git a/LayoutTests/storage/indexeddb/modern/opendatabase-request-event.html b/LayoutTests/storage/indexeddb/modern/opendatabase-request-event.html
new file mode 100644 (file)
index 0000000..12f8d14
--- /dev/null
@@ -0,0 +1,29 @@
+This test calls open on window.indexedDB in various ways, verifying that IDBOpenDBRequest objects are returned when expected and exceptions are thrown when expected.
+<script>
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function done()
+{
+    alert("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var request = window.indexedDB.open("TestDatabase");
+alert(request);
+
+request.onsuccess = function()
+{
+       alert("success");
+       done();
+}
+request.onerror = function(e)
+{
+       alert("error " + e);
+       done();
+}
+</script>
index 11f2f00..0ff0b0a 100644 (file)
@@ -898,7 +898,11 @@ set(WebCore_SOURCES
 
     Modules/indexeddb/server/IDBConnectionToClient.cpp
     Modules/indexeddb/server/IDBServer.cpp
+    Modules/indexeddb/server/IDBServerOperation.cpp
+    Modules/indexeddb/server/MemoryIDBBackingStore.cpp
+    Modules/indexeddb/server/UniqueIDBDatabase.cpp
 
+    Modules/indexeddb/shared/IDBDatabaseInfo.cpp
     Modules/indexeddb/shared/IDBError.cpp
     Modules/indexeddb/shared/IDBRequestData.cpp
     Modules/indexeddb/shared/IDBRequestIdentifier.cpp
index e993b13..b5ac92b 100644 (file)
@@ -1,3 +1,97 @@
+2015-09-30  Brady Eidson  <beidson@apple.com>
+
+        Add UniqueIDBDatabase object, IDBBackingStore objects, and a database operation thread.
+        https://bugs.webkit.org/show_bug.cgi?id=149678
+
+        Reviewed by Alex Christensen.
+
+        Test: storage/indexeddb/modern/opendatabase-request-event.html
+
+        - UniqueIDBDatabase represents a specific IDB database instance that can have multiple 
+          connections to it.
+        - IDBBackingStore is an abstract representation of a unique database's backing store, 
+          and has a concrete in-memory implementation for now.
+        - The database thread exists on IDBServer and is for offloading actual database I/O from 
+          the main thread.
+
+        * CMakeLists.txt:
+
+        * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
+        (WebCore::IDBDatabaseIdentifier::isolatedCopy):
+        * Modules/indexeddb/IDBDatabaseIdentifier.h:
+
+        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+        (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
+        (WebCore::IDBClient::IDBConnectionToServer::didOpenDatabase):
+        * Modules/indexeddb/client/IDBConnectionToServer.h:
+        * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+
+        * Modules/indexeddb/client/IDBFactoryImpl.cpp:
+        (WebCore::IDBClient::IDBFactory::openInternal):
+
+        * Modules/indexeddb/server/IDBBackingStore.h: Copied from Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h.
+        (WebCore::IDBServer::IDBBackingStore::~IDBBackingStore):
+
+        * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+        (WebCore::IDBServer::IDBConnectionToClient::didOpenDatabase):
+        * Modules/indexeddb/server/IDBConnectionToClient.h:
+        * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
+
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::IDBServer):
+        (WebCore::IDBServer::IDBServer::getOrCreateUniqueIDBDatabase):
+        (WebCore::IDBServer::IDBServer::createBackingStore):
+        (WebCore::IDBServer::IDBServer::openDatabase):
+        (WebCore::IDBServer::IDBServer::deleteDatabase):
+        (WebCore::IDBServer::IDBServer::postDatabaseTask):
+        (WebCore::IDBServer::IDBServer::postDatabaseTaskReply):
+        (WebCore::IDBServer::IDBServer::databaseThreadEntry):
+        (WebCore::IDBServer::IDBServer::databaseRunLoop):
+        (WebCore::IDBServer::IDBServer::handleTaskRepliesOnMainThread):
+        * Modules/indexeddb/server/IDBServer.h:
+
+        * Modules/indexeddb/server/IDBServerOperation.cpp: Copied from Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h.
+        (WebCore::IDBServer::IDBServerOperation::create):
+        (WebCore::IDBServer::IDBServerOperation::IDBServerOperation):
+        * Modules/indexeddb/server/IDBServerOperation.h: Copied from Source/WebCore/Modules/indexeddb/server/IDBServer.h.
+        (WebCore::IDBServer::IDBServerOperation::connection):
+        (WebCore::IDBServer::IDBServerOperation::requestData):
+
+        * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: Copied from Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp.
+        (WebCore::IDBServer::MemoryIDBBackingStore::create):
+        (WebCore::IDBServer::MemoryIDBBackingStore::MemoryIDBBackingStore):
+        (WebCore::IDBServer::MemoryIDBBackingStore::~MemoryIDBBackingStore):
+        (WebCore::IDBServer::MemoryIDBBackingStore::getOrEstablishDatabaseInfo):
+        * Modules/indexeddb/server/MemoryIDBBackingStore.h: Copied from Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h.
+
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp: Added.
+        (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
+        (WebCore::IDBServer::UniqueIDBDatabase::openDatabaseConnection):
+        (WebCore::IDBServer::UniqueIDBDatabase::handleOpenDatabaseOperations):
+        (WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
+        (WebCore::IDBServer::UniqueIDBDatabase::didOpenBackingStore):
+        * Modules/indexeddb/server/UniqueIDBDatabase.h: Copied from Source/WebCore/Modules/indexeddb/server/IDBServer.h.
+        (WebCore::IDBServer::UniqueIDBDatabase::create):
+
+        * Modules/indexeddb/shared/IDBDatabaseInfo.cpp: Copied from Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h.
+        (WebCore::IDBDatabaseInfo::IDBDatabaseInfo):
+        (WebCore::IDBDatabaseInfo::isolatedCopy):
+        * Modules/indexeddb/shared/IDBDatabaseInfo.h: Copied from Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h.
+        (WebCore::IDBDatabaseInfo::IDBDatabaseInfo):
+
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::didDeleteDatabase):
+        (WebCore::InProcessIDBServer::openDatabase):
+        (WebCore::InProcessIDBServer::didOpenDatabase):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * platform/CrossThreadCopier.cpp:
+        (WebCore::IDBDatabaseInfo>::copy):
+        (WebCore::IDBDatabaseIdentifier>::copy):
+        * platform/CrossThreadCopier.h:
+
 2015-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Crash when using an SVG font with > 390 glyphs
index 03ca6de..94b7caf 100644 (file)
@@ -44,6 +44,16 @@ IDBDatabaseIdentifier::IDBDatabaseIdentifier(const String& databaseName, const S
     ASSERT(!databaseName.isNull());
 }
 
+IDBDatabaseIdentifier IDBDatabaseIdentifier::isolatedCopy() const
+{
+    IDBDatabaseIdentifier identifier;
+
+    identifier.m_databaseName = m_databaseName.isolatedCopy();
+    identifier.m_openingOrigin = m_openingOrigin.isolatedCopy();
+    identifier.m_mainFrameOrigin = m_mainFrameOrigin.isolatedCopy();
+
+    return WTF::move(identifier);
+}
 
 #ifndef NDEBUG
 String IDBDatabaseIdentifier::debugString() const
index e71f92c..b3776ba 100644 (file)
@@ -50,6 +50,8 @@ public:
         m_mainFrameOrigin.port = -1;
     }
 
+    IDBDatabaseIdentifier isolatedCopy() const;
+
     bool isHashTableDeletedValue() const
     {
         return m_openingOrigin.port == -1 && m_mainFrameOrigin.port == -1;
index 99e5c12..acf8b39 100644 (file)
@@ -72,6 +72,27 @@ void IDBConnectionToServer::didDeleteDatabase(const IDBResultData& resultData)
     request->requestCompleted(resultData);
 }
 
+void IDBConnectionToServer::openDatabase(IDBOpenDBRequest& request)
+{
+    LOG(IndexedDB, "IDBConnectionToServer::openDatabase - %s", request.databaseIdentifier().debugString().utf8().data());
+
+    ASSERT(!m_openDBRequestMap.contains(request.requestIdentifier()));
+    m_openDBRequestMap.set(request.requestIdentifier(), &request);
+    
+    IDBRequestData requestData(*this, request);
+    m_delegate->openDatabase(requestData);
+}
+
+void IDBConnectionToServer::didOpenDatabase(const IDBResultData& resultData)
+{
+    LOG(IndexedDB, "IDBConnectionToServer::didOpenDatabase");
+
+    auto request = m_openDBRequestMap.take(resultData.requestIdentifier());
+    ASSERT(request);
+
+    request->requestCompleted(resultData);
+}
+
 } // namespace IDBClient
 } // namespace WebCore
 
index e2ca3d0..03fdb3d 100644 (file)
@@ -50,7 +50,10 @@ public:
 
     void deleteDatabase(IDBOpenDBRequest&);
     void didDeleteDatabase(const IDBResultData&);
-    
+
+    void openDatabase(IDBOpenDBRequest&);
+    void didOpenDatabase(const IDBResultData&);
+
 private:
     IDBConnectionToServer(IDBConnectionToServerDelegate&);
     
index 7bfeb8b..8e1efc4 100644 (file)
@@ -40,7 +40,8 @@ public:
 
     virtual uint64_t identifier() const = 0;
     virtual void deleteDatabase(IDBRequestData&) = 0;
-    
+    virtual void openDatabase(IDBRequestData&) = 0;
+
     virtual void ref() = 0;
     virtual void deref() = 0;
 };
index ac0cff9..2d10fe0 100644 (file)
@@ -115,6 +115,8 @@ RefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ScriptExecutionContext* contex
     }
 
     auto request = IDBOpenDBRequest::createOpenRequest(m_connectionToServer.get(), context, databaseIdentifier, version);
+    m_connectionToServer->openDatabase(request.get());
+
     return adoptRef(&request.leakRef());
 }
 
diff --git a/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h b/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
new file mode 100644 (file)
index 0000000..a5a48c1
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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 IDBBackingStore_h
+#define IDBBackingStore_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBDatabaseInfo.h"
+
+namespace WebCore {
+namespace IDBServer {
+
+class IDBBackingStore {
+public:
+    virtual ~IDBBackingStore() { }
+
+    virtual const IDBDatabaseInfo& getOrEstablishDatabaseInfo() = 0;
+};
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBBackingStore_h
index cff51f8..5d02a12 100644 (file)
@@ -51,6 +51,11 @@ void IDBConnectionToClient::didDeleteDatabase(const IDBResultData& result)
     m_delegate->didDeleteDatabase(result);
 }
 
+void IDBConnectionToClient::didOpenDatabase(const IDBResultData& result)
+{
+    m_delegate->didOpenDatabase(result);
+}
+
 } // namespace IDBServer
 } // namespace WebCore
 
index 521a967..7555074 100644 (file)
@@ -45,6 +45,7 @@ public:
     uint64_t identifier() const;
 
     void didDeleteDatabase(const IDBResultData&);
+    void didOpenDatabase(const IDBResultData&);
     
 private:
     IDBConnectionToClient(IDBConnectionToClientDelegate&);
index cf50039..b2b4b5c 100644 (file)
@@ -41,6 +41,7 @@ public:
     virtual uint64_t identifier() const = 0;
 
     virtual void didDeleteDatabase(const IDBResultData&) = 0;
+    virtual void didOpenDatabase(const IDBResultData&) = 0;
 
     virtual void ref() = 0;
     virtual void deref() = 0;
index 6871897..61f487f 100644 (file)
@@ -31,6 +31,9 @@
 #include "IDBRequestData.h"
 #include "IDBResultData.h"
 #include "Logging.h"
+#include "MemoryIDBBackingStore.h"
+#include <wtf/Locker.h>
+#include <wtf/MainThread.h>
 
 namespace WebCore {
 namespace IDBServer {
@@ -42,6 +45,8 @@ Ref<IDBServer> IDBServer::create()
 
 IDBServer::IDBServer()
 {
+    Locker<Lock> locker(m_databaseThreadCreationLock);
+    m_threadID = createThread(IDBServer::databaseThreadEntry, this, "IndexedDatabase Server");
 }
 
 void IDBServer::registerConnection(IDBConnectionToClient& connection)
@@ -58,24 +63,110 @@ void IDBServer::unregisterConnection(IDBConnectionToClient& connection)
     m_connectionMap.remove(connection.identifier());
 }
 
-void IDBServer::deleteDatabase(const IDBRequestData& data)
+UniqueIDBDatabase& IDBServer::getOrCreateUniqueIDBDatabase(const IDBDatabaseIdentifier& identifier)
 {
-    LOG(IndexedDB, "IDBServer::deleteDatabase - %s", data.databaseIdentifier().debugString().utf8().data());
+    auto uniqueIDBDatabase = m_uniqueIDBDatabaseMap.add(identifier, nullptr);
+    if (uniqueIDBDatabase.isNewEntry)
+        uniqueIDBDatabase.iterator->value = UniqueIDBDatabase::create(*this, identifier);
+
+    return *uniqueIDBDatabase.iterator->value;
+}
+
+std::unique_ptr<IDBBackingStore> IDBServer::createBackingStore(const IDBDatabaseIdentifier& identifier)
+{
+    ASSERT(!isMainThread());
+
+    // FIXME: For now we only have the in-memory backing store, which we'll continue to use for private browsing.
+    // Once it's time for persistent backing stores this is where we'll calculate the correct path on disk
+    // and create it.
+
+    return MemoryIDBBackingStore::create(identifier);
+}
+
+void IDBServer::openDatabase(const IDBRequestData& requestData)
+{
+    LOG(IndexedDB, "IDBServer::openDatabase");
+
+    auto& uniqueIDBDatabase = getOrCreateUniqueIDBDatabase(requestData.databaseIdentifier());
+
+    auto connection = m_connectionMap.get(requestData.requestIdentifier().connectionIdentifier());
+    if (!connection) {
+        // If the connection back to the client is gone, there's no way to open the database as
+        // well as no way to message back failure.
+        return;
+    }
+
+    uniqueIDBDatabase.openDatabaseConnection(*connection, requestData);
+}
+
+void IDBServer::deleteDatabase(const IDBRequestData& requestData)
+{
+    LOG(IndexedDB, "IDBServer::deleteDatabase - %s", requestData.databaseIdentifier().debugString().utf8().data());
     
-    auto connection = m_connectionMap.get(data.requestIdentifier().connectionIdentifier());
+    auto connection = m_connectionMap.get(requestData.requestIdentifier().connectionIdentifier());
     if (!connection) {
-        // If we don't have record of this connection (e.g. it has dropped due to a process crashing)
-        // then we can't report back status of the operation.
-        // Therefore we shouldn't bother performing it.
+        // If the connection back to the client is gone, there's no way to delete the database as
+        // well as no way to message back failure.
         return;
     }
     
     // FIXME: During bringup of modern IDB, the database deletion is a no-op, and is
     // immediately reported back to the WebProcess as failure.
-    IDBResultData result(data.requestIdentifier(), IDBError(IDBExceptionCode::Unknown));
+    IDBResultData result(requestData.requestIdentifier(), IDBError(IDBExceptionCode::Unknown));
     connection->didDeleteDatabase(result);
 }
 
+void IDBServer::postDatabaseTask(std::unique_ptr<CrossThreadTask>&& task)
+{
+    ASSERT(isMainThread());
+    m_databaseQueue.append(WTF::move(task));
+}
+
+void IDBServer::postDatabaseTaskReply(std::unique_ptr<CrossThreadTask>&& task)
+{
+    ASSERT(!isMainThread());
+    m_databaseReplyQueue.append(WTF::move(task));
+
+
+    Locker<Lock> locker(m_mainThreadReplyLock);
+    if (m_mainThreadReplyScheduled)
+        return;
+
+    m_mainThreadReplyScheduled = true;
+    callOnMainThread([this] {
+        handleTaskRepliesOnMainThread();
+    });
+}
+
+void IDBServer::databaseThreadEntry(void* threadData)
+{
+    ASSERT(threadData);
+    IDBServer* server = reinterpret_cast<IDBServer*>(threadData);
+    server->databaseRunLoop();
+}
+
+void IDBServer::databaseRunLoop()
+{
+    ASSERT(!isMainThread());
+    {
+        Locker<Lock> locker(m_databaseThreadCreationLock);
+    }
+
+    while (auto task = m_databaseQueue.waitForMessage())
+        task->performTask();
+}
+
+void IDBServer::handleTaskRepliesOnMainThread()
+{
+    {
+        Locker<Lock> locker(m_mainThreadReplyLock);
+        m_mainThreadReplyScheduled = false;
+    }
+
+    while (auto task = m_databaseReplyQueue.tryGetMessage())
+        task->performTask();
+}
+
 } // namespace IDBServer
 } // namespace WebCore
 
index f1efe14..3e1e6d1 100644 (file)
 
 #if ENABLE(INDEXED_DATABASE)
 
+#include "CrossThreadTask.h"
 #include "IDBConnectionToClient.h"
+#include "IDBDatabaseIdentifier.h"
+#include "UniqueIDBDatabase.h"
 #include <wtf/HashMap.h>
+#include <wtf/Lock.h>
+#include <wtf/MessageQueue.h>
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
 
+class CrossThreadTask;
 class IDBRequestData;
 
 namespace IDBServer {
@@ -48,12 +54,33 @@ public:
     void unregisterConnection(IDBConnectionToClient&);
 
     // Operations requested by the client.
+    void openDatabase(const IDBRequestData&);
     void deleteDatabase(const IDBRequestData&);
 
+    void postDatabaseTask(std::unique_ptr<CrossThreadTask>&&);
+    void postDatabaseTaskReply(std::unique_ptr<CrossThreadTask>&&);
+
+    std::unique_ptr<IDBBackingStore> createBackingStore(const IDBDatabaseIdentifier&);
+
 private:
     IDBServer();
 
+    UniqueIDBDatabase& getOrCreateUniqueIDBDatabase(const IDBDatabaseIdentifier&);
+
+    static void databaseThreadEntry(void*);
+    void databaseRunLoop();
+    void handleTaskRepliesOnMainThread();
+
     HashMap<uint64_t, RefPtr<IDBConnectionToClient>> m_connectionMap;
+    HashMap<IDBDatabaseIdentifier, RefPtr<UniqueIDBDatabase>> m_uniqueIDBDatabaseMap;
+
+    ThreadIdentifier m_threadID { 0 };
+    Lock m_databaseThreadCreationLock;
+    Lock m_mainThreadReplyLock;
+    bool m_mainThreadReplyScheduled { false };
+
+    MessageQueue<CrossThreadTask> m_databaseQueue;
+    MessageQueue<CrossThreadTask> m_databaseReplyQueue;
 };
 
 } // namespace IDBServer
diff --git a/Source/WebCore/Modules/indexeddb/server/IDBServerOperation.cpp b/Source/WebCore/Modules/indexeddb/server/IDBServerOperation.cpp
new file mode 100644 (file)
index 0000000..681744a
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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 "IDBServerOperation.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+namespace IDBServer {
+
+Ref<IDBServerOperation> IDBServerOperation::create(IDBConnectionToClient& connection, const IDBRequestData& requestData)
+{
+    return adoptRef(*new IDBServerOperation(connection, requestData));
+}
+
+IDBServerOperation::IDBServerOperation(IDBConnectionToClient& connection, const IDBRequestData& requestData)
+    : m_connection(connection)
+    , m_requestData(requestData)
+{
+}
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebCore/Modules/indexeddb/server/IDBServerOperation.h b/Source/WebCore/Modules/indexeddb/server/IDBServerOperation.h
new file mode 100644 (file)
index 0000000..cfec06c
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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 IDBServerOperation_h
+#define IDBServerOperation_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBConnectionToClient.h"
+#include "IDBRequestData.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+namespace IDBServer {
+
+class IDBServerOperation : public RefCounted<IDBServerOperation> {
+public:
+    static Ref<IDBServerOperation> create(IDBConnectionToClient&, const IDBRequestData&);
+
+    IDBConnectionToClient& connection() { return m_connection; }
+    const IDBRequestData& requestData() const { return m_requestData; }
+
+private:
+    IDBServerOperation(IDBConnectionToClient&, const IDBRequestData&);
+
+    IDBConnectionToClient& m_connection;
+    IDBRequestData m_requestData;
+};
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBServerOperation_h
diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp b/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
new file mode 100644 (file)
index 0000000..b074207
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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 "MemoryIDBBackingStore.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+namespace IDBServer {
+
+std::unique_ptr<MemoryIDBBackingStore> MemoryIDBBackingStore::create(const IDBDatabaseIdentifier& identifier)
+{
+    return std::make_unique<MemoryIDBBackingStore>(identifier);
+}
+
+MemoryIDBBackingStore::MemoryIDBBackingStore(const IDBDatabaseIdentifier& identifier)
+    : m_identifier(identifier)
+{
+}
+
+MemoryIDBBackingStore::~MemoryIDBBackingStore()
+{
+}
+
+const IDBDatabaseInfo& MemoryIDBBackingStore::getOrEstablishDatabaseInfo()
+{
+    if (!m_databaseInfo)
+        m_databaseInfo = std::make_unique<IDBDatabaseInfo>(m_identifier.databaseName(), 0);
+
+    return *m_databaseInfo;
+}
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h b/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
new file mode 100644 (file)
index 0000000..ab31adf
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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 MemoryIDBBackingStore_h
+#define MemoryIDBBackingStore_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBBackingStore.h"
+#include "IDBDatabaseIdentifier.h"
+
+namespace WebCore {
+namespace IDBServer {
+
+class MemoryIDBBackingStore : public IDBBackingStore {
+    friend std::unique_ptr<MemoryIDBBackingStore> std::make_unique<MemoryIDBBackingStore>(const IDBDatabaseIdentifier&);
+public:
+    static std::unique_ptr<MemoryIDBBackingStore> create(const IDBDatabaseIdentifier&);
+    
+    virtual ~MemoryIDBBackingStore() override final;
+
+    virtual const IDBDatabaseInfo& getOrEstablishDatabaseInfo() override final;
+    
+private:
+    MemoryIDBBackingStore(const IDBDatabaseIdentifier&);
+
+    IDBDatabaseIdentifier m_identifier;
+    std::unique_ptr<IDBDatabaseInfo> m_databaseInfo;
+};
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // MemoryIDBBackingStore_h
diff --git a/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
new file mode 100644 (file)
index 0000000..21257e7
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * 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 "UniqueIDBDatabase.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBResultData.h"
+#include "IDBServer.h"
+#include "Logging.h"
+#include <wtf/MainThread.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+namespace IDBServer {
+    
+UniqueIDBDatabase::UniqueIDBDatabase(IDBServer& server, const IDBDatabaseIdentifier& identifier)
+    : m_server(server)
+    , m_identifier(identifier)
+{
+}
+
+void UniqueIDBDatabase::openDatabaseConnection(IDBConnectionToClient& connection, const IDBRequestData& requestData)
+{
+    auto operation = IDBServerOperation::create(connection, requestData);
+    m_pendingOpenDatabaseOperations.append(WTF::move(operation));
+
+    if (m_databaseInfo) {
+        handleOpenDatabaseOperations();
+        return;
+    }
+    
+    m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::openBackingStore, m_identifier));
+}
+
+void UniqueIDBDatabase::handleOpenDatabaseOperations()
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, "(main) UniqueIDBDatabase::handleOpenDatabaseOperations");
+
+    auto operation = m_pendingOpenDatabaseOperations.takeFirst();
+
+    // FIXME: Reporting open operations as failures for now.
+    // Creating database connections for success will be the next step.
+
+    IDBResultData result(operation->requestData().requestIdentifier(), IDBError(IDBExceptionCode::Unknown));
+    operation->connection().didOpenDatabase(result);
+}
+
+void UniqueIDBDatabase::openBackingStore(const IDBDatabaseIdentifier& identifier)
+{
+    ASSERT(!isMainThread());
+    LOG(IndexedDB, "(db) UniqueIDBDatabase::openBackingStore");
+
+    ASSERT(!m_backingStore);
+    m_backingStore = m_server.createBackingStore(identifier);
+    auto databaseInfo = m_backingStore->getOrEstablishDatabaseInfo();
+
+    m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didOpenBackingStore, databaseInfo));
+}
+
+void UniqueIDBDatabase::didOpenBackingStore(const IDBDatabaseInfo& info)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, "(main) UniqueIDBDatabase::didOpenBackingStore");
+    
+    m_databaseInfo = std::make_unique<IDBDatabaseInfo>(info);
+
+    handleOpenDatabaseOperations();
+}
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h b/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
new file mode 100644 (file)
index 0000000..6bb632d
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * 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 UniqueIDBDatabase_h
+#define UniqueIDBDatabase_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBBackingStore.h"
+#include "IDBDatabaseIdentifier.h"
+#include "IDBDatabaseInfo.h"
+#include "IDBServerOperation.h"
+#include <wtf/Deque.h>
+#include <wtf/Ref.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+
+class IDBRequestData;
+
+namespace IDBServer {
+
+class IDBConnectionToClient;
+class IDBServer;
+
+class UniqueIDBDatabase : public ThreadSafeRefCounted<UniqueIDBDatabase> {
+public:
+    static Ref<UniqueIDBDatabase> create(IDBServer& server, const IDBDatabaseIdentifier& identifier)
+    {
+        return adoptRef(*new UniqueIDBDatabase(server, identifier));
+    }
+
+    void openDatabaseConnection(IDBConnectionToClient&, const IDBRequestData&);
+
+private:
+    UniqueIDBDatabase(IDBServer&, const IDBDatabaseIdentifier&);
+    
+    void handleOpenDatabaseOperations();
+    
+    // Database thread operations
+    void openBackingStore(const IDBDatabaseIdentifier&);
+
+    // Main thread callbacks
+    void didOpenBackingStore(const IDBDatabaseInfo&);
+
+    IDBServer& m_server;
+    IDBDatabaseIdentifier m_identifier;
+    
+    Deque<Ref<IDBServerOperation>> m_pendingOpenDatabaseOperations;
+    
+    std::unique_ptr<IDBBackingStore> m_backingStore;
+    std::unique_ptr<IDBDatabaseInfo> m_databaseInfo;
+};
+
+} // namespace IDBServer
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // UniqueIDBDatabase_h
diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp
new file mode 100644 (file)
index 0000000..aa72b57
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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 "IDBDatabaseInfo.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+IDBDatabaseInfo::IDBDatabaseInfo(const String& name, uint64_t version)
+    : m_name(name)
+    , m_version(version)
+{
+}
+
+IDBDatabaseInfo IDBDatabaseInfo::isolatedCopy() const
+{
+    IDBDatabaseInfo info;
+
+    info.m_name = m_name.isolatedCopy();
+    info.m_version = m_version;
+
+    return WTF::move(info);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h b/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h
new file mode 100644 (file)
index 0000000..687f59f
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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 IDBDatabaseInfo_h
+#define IDBDatabaseInfo_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class IDBDatabaseInfo {
+public:
+    IDBDatabaseInfo(const String& name, uint64_t version);
+
+    IDBDatabaseInfo isolatedCopy() const;
+
+private:
+    IDBDatabaseInfo()
+    {
+    }
+
+    String m_name;
+    uint64_t m_version { 0 };
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // IDBDatabaseInfo_h
index f959efa..7b2f86d 100644 (file)
@@ -83,7 +83,24 @@ void InProcessIDBServer::didDeleteDatabase(const IDBResultData& resultData)
     RefPtr<InProcessIDBServer> self(this);
     RunLoop::current().dispatch([this, self, resultData] {
         m_connectionToServer->didDeleteDatabase(resultData);
-    });}
+    });
+}
+
+void InProcessIDBServer::openDatabase(IDBRequestData& requestData)
+{
+    RefPtr<InProcessIDBServer> self(this);
+    RunLoop::current().dispatch([this, self, requestData] {
+        m_server->openDatabase(requestData);
+    });
+}
+
+void InProcessIDBServer::didOpenDatabase(const IDBResultData& resultData)
+{
+    RefPtr<InProcessIDBServer> self(this);
+    RunLoop::current().dispatch([this, self, resultData] {
+        m_connectionToServer->didOpenDatabase(resultData);
+    });
+}
 
 } // namespace WebCore
 
index bb4ad59..5e1b9d0 100644 (file)
@@ -55,10 +55,12 @@ public:
 
     // IDBConnectionToServer
     virtual void deleteDatabase(IDBRequestData&) override final;
-    
+    virtual void openDatabase(IDBRequestData&) override final;
+
     // IDBConnectionToClient
     virtual uint64_t identifier() const override;
     virtual void didDeleteDatabase(const IDBResultData&) override final;
+    virtual void didOpenDatabase(const IDBResultData&) override final;
 
     virtual void ref() override { RefCounted<InProcessIDBServer>::ref(); }
     virtual void deref() override { RefCounted<InProcessIDBServer>::deref(); }
index 1750bad..05b6dac 100644 (file)
                510A58E41BAA40B100C19282 /* InProcessIDBServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510A58E21BAA40AE00C19282 /* InProcessIDBServer.cpp */; };
                510A58E51BAA40B100C19282 /* InProcessIDBServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A58E31BAA40AE00C19282 /* InProcessIDBServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
                510A58F91BACC7F200C19282 /* IDBRequestData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510A58F51BACC4A500C19282 /* IDBRequestData.cpp */; };
-               510A58FA1BACC7F200C19282 /* IDBRequestData.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A58F61BACC4A500C19282 /* IDBRequestData.h */; };
+               510A58FA1BACC7F200C19282 /* IDBRequestData.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A58F61BACC4A500C19282 /* IDBRequestData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                510A58FB1BACC7F200C19282 /* IDBRequestIdentifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510A58E61BAA41C900C19282 /* IDBRequestIdentifier.cpp */; };
                510A58FC1BACC7F200C19282 /* IDBRequestIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A58E71BAA41C900C19282 /* IDBRequestIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
                510D4A33103165EE0049EA54 /* SocketStreamErrorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510D4A2D103165EE0049EA54 /* SocketStreamErrorBase.cpp */; };
                5185FCB91BB4CBF80012898F /* IDBConnectionToClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A58FE1BB07AA500C19282 /* IDBConnectionToClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5185FCBA1BB4CBF80012898F /* IDBServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510A58EF1BAB720F00C19282 /* IDBServer.cpp */; };
                5185FCBB1BB4CBF80012898F /* IDBServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 510A58F01BAB720F00C19282 /* IDBServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               518864E01BBAF57100E540C9 /* UniqueIDBDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518864DE1BBAF30F00E540C9 /* UniqueIDBDatabase.cpp */; };
+               518864E11BBAF57400E540C9 /* UniqueIDBDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 518864DF1BBAF30F00E540C9 /* UniqueIDBDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               518864E61BBB4B8300E540C9 /* IDBServerOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518864E41BBB4B7E00E540C9 /* IDBServerOperation.cpp */; };
+               518864E71BBB4B8300E540C9 /* IDBServerOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 518864E51BBB4B7E00E540C9 /* IDBServerOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5189F01D10B37BD900F3C739 /* JSPopStateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5189F01B10B37BD900F3C739 /* JSPopStateEvent.cpp */; };
                5189F01E10B37BD900F3C739 /* JSPopStateEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 5189F01C10B37BD900F3C739 /* JSPopStateEvent.h */; };
                5189F0DE10B46B0E00F3C739 /* PopStateEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5189F0DD10B46B0E00F3C739 /* PopStateEvent.cpp */; };
                51B45D201AB8D1E200117CD2 /* ContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B45D1E1AB8D1E200117CD2 /* ContentExtension.cpp */; };
                51B45D211AB8D1E200117CD2 /* ContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B45D1F1AB8D1E200117CD2 /* ContentExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51B58FD4195A964D002990B0 /* PlatformGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 515E5FEF195101470086CA5E /* PlatformGamepad.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               51BA4AC31BBB5CD800DF3D6D /* IDBDatabaseInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51BA4AC11BBB5CBF00DF3D6D /* IDBDatabaseInfo.cpp */; };
+               51BA4AC41BBB5CD800DF3D6D /* IDBDatabaseInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BA4AC21BBB5CBF00DF3D6D /* IDBDatabaseInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               51BA4ACA1BBC5BD900DF3D6D /* MemoryIDBBackingStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51BA4AC81BBC5B9E00DF3D6D /* MemoryIDBBackingStore.cpp */; };
+               51BA4ACB1BBC5BD900DF3D6D /* MemoryIDBBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BA4AC91BBC5B9E00DF3D6D /* MemoryIDBBackingStore.h */; };
+               51BA4ACC1BBC5BDD00DF3D6D /* IDBBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BA4AC71BBC5AD600DF3D6D /* IDBBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BE37DE0DAEE00E001085FC /* StorageArea.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51C0AA390F2AA10A001648C2 /* CachedFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C0AA380F2AA10A001648C2 /* CachedFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51C0AA410F2AA15E001648C2 /* CachedFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51C0AA400F2AA15E001648C2 /* CachedFrame.cpp */; };
                5185FCB61BB4C7610012898F /* DOMRequestState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMRequestState.h; sourceTree = "<group>"; };
                5185FCBC1BB5CB770012898F /* IDBConnectionToServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBConnectionToServer.cpp; sourceTree = "<group>"; };
                5185FCBD1BB5CB770012898F /* IDBConnectionToServerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBConnectionToServerDelegate.h; sourceTree = "<group>"; };
+               518864DE1BBAF30F00E540C9 /* UniqueIDBDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniqueIDBDatabase.cpp; sourceTree = "<group>"; };
+               518864DF1BBAF30F00E540C9 /* UniqueIDBDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UniqueIDBDatabase.h; sourceTree = "<group>"; };
+               518864E41BBB4B7E00E540C9 /* IDBServerOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBServerOperation.cpp; sourceTree = "<group>"; };
+               518864E51BBB4B7E00E540C9 /* IDBServerOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBServerOperation.h; sourceTree = "<group>"; };
                5189F01B10B37BD900F3C739 /* JSPopStateEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPopStateEvent.cpp; sourceTree = "<group>"; };
                5189F01C10B37BD900F3C739 /* JSPopStateEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPopStateEvent.h; sourceTree = "<group>"; };
                5189F0DD10B46B0E00F3C739 /* PopStateEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PopStateEvent.cpp; sourceTree = "<group>"; };
                51B454E91B4DAE7D0085EAA6 /* PingHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PingHandle.h; sourceTree = "<group>"; };
                51B45D1E1AB8D1E200117CD2 /* ContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtension.cpp; sourceTree = "<group>"; };
                51B45D1F1AB8D1E200117CD2 /* ContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtension.h; sourceTree = "<group>"; };
+               51BA4AC11BBB5CBF00DF3D6D /* IDBDatabaseInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBDatabaseInfo.cpp; sourceTree = "<group>"; };
+               51BA4AC21BBB5CBF00DF3D6D /* IDBDatabaseInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBDatabaseInfo.h; sourceTree = "<group>"; };
+               51BA4AC71BBC5AD600DF3D6D /* IDBBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBBackingStore.h; sourceTree = "<group>"; };
+               51BA4AC81BBC5B9E00DF3D6D /* MemoryIDBBackingStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryIDBBackingStore.cpp; sourceTree = "<group>"; };
+               51BA4AC91BBC5B9E00DF3D6D /* MemoryIDBBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryIDBBackingStore.h; sourceTree = "<group>"; };
                51BE37DE0DAEE00E001085FC /* StorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageArea.h; sourceTree = "<group>"; };
                51C0AA380F2AA10A001648C2 /* CachedFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFrame.h; sourceTree = "<group>"; };
                51C0AA400F2AA15E001648C2 /* CachedFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = CachedFrame.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
                510A58E11BAA409800C19282 /* shared */ = {
                        isa = PBXGroup;
                        children = (
+                               51BA4AC11BBB5CBF00DF3D6D /* IDBDatabaseInfo.cpp */,
+                               51BA4AC21BBB5CBF00DF3D6D /* IDBDatabaseInfo.h */,
                                5148453C1BB9D076006A72ED /* IDBError.cpp */,
                                5148453D1BB9D076006A72ED /* IDBError.h */,
                                510A58F51BACC4A500C19282 /* IDBRequestData.cpp */,
                510A58EE1BAB71E000C19282 /* server */ = {
                        isa = PBXGroup;
                        children = (
+                               51BA4AC71BBC5AD600DF3D6D /* IDBBackingStore.h */,
                                516D7D6D1BB5F06500AF7C77 /* IDBConnectionToClient.cpp */,
                                510A58FE1BB07AA500C19282 /* IDBConnectionToClient.h */,
                                516D7D6E1BB5F06500AF7C77 /* IDBConnectionToClientDelegate.h */,
                                510A58EF1BAB720F00C19282 /* IDBServer.cpp */,
                                510A58F01BAB720F00C19282 /* IDBServer.h */,
+                               518864E41BBB4B7E00E540C9 /* IDBServerOperation.cpp */,
+                               518864E51BBB4B7E00E540C9 /* IDBServerOperation.h */,
+                               51BA4AC81BBC5B9E00DF3D6D /* MemoryIDBBackingStore.cpp */,
+                               51BA4AC91BBC5B9E00DF3D6D /* MemoryIDBBackingStore.h */,
+                               518864DE1BBAF30F00E540C9 /* UniqueIDBDatabase.cpp */,
+                               518864DF1BBAF30F00E540C9 /* UniqueIDBDatabase.h */,
                        );
                        path = server;
                        sourceTree = "<group>";
                                BC64641C11D7F416006455B0 /* DatasetDOMStringMap.h in Headers */,
                                85031B3E0A44EFC700F992E0 /* DataTransfer.h in Headers */,
                                4B8AF4AA0B1CE02B00687690 /* DataTransferAccessPolicy.h in Headers */,
+                               51BA4ACC1BBC5BDD00DF3D6D /* IDBBackingStore.h in Headers */,
                                81AC5999131636E60009A7E0 /* DataTransferItem.h in Headers */,
                                81AC599A131636E60009A7E0 /* DataTransferItemList.h in Headers */,
                                E4A007831B820EC8002C5A6E /* DataURLDecoder.h in Headers */,
                                A84EBD830CB8C97700079609 /* JSStyleSheetList.h in Headers */,
                                E1FF8F65180745D800132674 /* JSSubtleCrypto.h in Headers */,
                                B20111080AB7740500DB0E68 /* JSSVGAElement.h in Headers */,
+                               518864E71BBB4B8300E540C9 /* IDBServerOperation.h in Headers */,
                                24D9129213CA951E00D21915 /* JSSVGAltGlyphDefElement.h in Headers */,
                                6515EC920D9723FF0063D49A /* JSSVGAltGlyphElement.h in Headers */,
                                24D9129613CA956100D21915 /* JSSVGAltGlyphItemElement.h in Headers */,
                                BC5C762B1497FE1400BC4775 /* PlatformEvent.h in Headers */,
                                26601EBF14B3B9AD0012C0FE /* PlatformEventFactoryIOS.h in Headers */,
                                BCAA487014A052530088FAC4 /* PlatformEventFactoryMac.h in Headers */,
+                               51BA4AC41BBB5CD800DF3D6D /* IDBDatabaseInfo.h in Headers */,
                                A723F77B1484CA4C008C6DBE /* PlatformExportMacros.h in Headers */,
                                51B58FD4195A964D002990B0 /* PlatformGamepad.h in Headers */,
                                935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */,
                                B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */,
                                A8EA7EBC0A1945D000A8EF5F /* ProcessingInstruction.h in Headers */,
                                E44613EC0CD681B500FADA75 /* ProgressEvent.h in Headers */,
+                               518864E11BBAF57400E540C9 /* UniqueIDBDatabase.h in Headers */,
                                A715E653134BBBEC00D8E713 /* ProgressShadowElement.h in Headers */,
                                1A2A68240B5BEDE70002A480 /* ProgressTracker.h in Headers */,
                                1ACADD791880D91C00D8B71D /* ProgressTrackerClient.h in Headers */,
                                514C767F0CE923A1007EF3CD /* ResourceResponseBase.h in Headers */,
                                FD3160A512B026F700C1A359 /* Reverb.h in Headers */,
                                FD3160A712B026F700C1A359 /* ReverbAccumulationBuffer.h in Headers */,
+                               51BA4ACB1BBC5BD900DF3D6D /* MemoryIDBBackingStore.h in Headers */,
                                FD3160A912B026F700C1A359 /* ReverbConvolver.h in Headers */,
                                FD3160AB12B026F700C1A359 /* ReverbConvolverStage.h in Headers */,
                                FD3160AD12B026F700C1A359 /* ReverbInputBuffer.h in Headers */,
                                45830D4D1679B4F800ACF8C3 /* AutoscrollController.cpp in Sources */,
                                A8CFF0500A154F09000A4234 /* AutoTableLayout.cpp in Sources */,
                                070363E1181A1CDC00C074A5 /* AVAudioCaptureSource.mm in Sources */,
+                               518864E61BBB4B8300E540C9 /* IDBServerOperation.cpp in Sources */,
                                070363E3181A1CDC00C074A5 /* AVCaptureDeviceManager.mm in Sources */,
                                070363E5181A1CDC00C074A5 /* AVMediaCaptureSource.mm in Sources */,
                                CD336F6117F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm in Sources */,
                                8540756C0AD6CBF900620C57 /* DOMHTMLOptionElement.mm in Sources */,
                                85DF2F9C0AA3CAE500AD64C5 /* DOMHTMLOptionsCollection.mm in Sources */,
                                85183B470AA6926100F19FA3 /* DOMHTMLParagraphElement.mm in Sources */,
+                               518864E01BBAF57100E540C9 /* UniqueIDBDatabase.cpp in Sources */,
                                85ECBEF80AA7626900544F0B /* DOMHTMLParamElement.mm in Sources */,
                                85183B490AA6926100F19FA3 /* DOMHTMLPreElement.mm in Sources */,
                                A4226E961163D73A008B8397 /* DOMHTMLProgressElement.mm in Sources */,
                                443F04270E75C8FB007E5407 /* NetworkStateNotifierIOS.mm in Sources */,
                                1A7FA6490DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp in Sources */,
                                E13EF34916850C470034C83F /* NetworkStorageSessionCFNet.cpp in Sources */,
+                               51BA4ACA1BBC5BD900DF3D6D /* MemoryIDBBackingStore.cpp in Sources */,
                                269397261A4A5FBD00E8349D /* NFA.cpp in Sources */,
                                267726001A5B3AD9003C24DD /* NFAToDFA.cpp in Sources */,
                                BCEF43E00E674110001C1287 /* NinePieceImage.cpp in Sources */,
                                A1DE71321861322200734192 /* TouchConstructors.cpp in Sources */,
                                A1DE712D18612AC100734192 /* TouchEvents.cpp in Sources */,
                                070334D9145A006F008D8D45 /* TrackBase.cpp in Sources */,
+                               51BA4AC31BBB5CD800DF3D6D /* IDBDatabaseInfo.cpp in Sources */,
                                070334D31459FFAD008D8D45 /* TrackEvent.cpp in Sources */,
                                BE88E0C11715CE2600658D98 /* TrackListBase.cpp in Sources */,
                                FFAC30FF184FB145008C4F1E /* TrailingObjects.cpp in Sources */,
index a8de776..889c84d 100644 (file)
@@ -42,6 +42,8 @@
 #include <wtf/text/WTFString.h>
 
 #if ENABLE(INDEXED_DATABASE)
+#include "IDBDatabaseIdentifier.h"
+#include "IDBDatabaseInfo.h"
 #include "IDBDatabaseMetadata.h"
 #include "IDBGetResult.h"
 #include "IDBKeyData.h"
@@ -127,6 +129,15 @@ CrossThreadCopierBase<false, false, IDBObjectStoreMetadata>::Type CrossThreadCop
     return metadata.isolatedCopy();
 }
 
+CrossThreadCopierBase<false, false, IDBDatabaseInfo>::Type CrossThreadCopierBase<false, false, IDBDatabaseInfo>::copy(const IDBDatabaseInfo& info)
+{
+    return info.isolatedCopy();
+}
+
+CrossThreadCopierBase<false, false, IDBDatabaseIdentifier>::Type CrossThreadCopierBase<false, false, IDBDatabaseIdentifier>::copy(const IDBDatabaseIdentifier& identifier)
+{
+    return identifier.isolatedCopy();
+}
 #endif
 
 // Test CrossThreadCopier using COMPILE_ASSERT.
index d75059c..156e8db 100644 (file)
@@ -190,6 +190,19 @@ namespace WebCore {
         typedef IDBObjectStoreMetadata Type;
         static Type copy(const IDBObjectStoreMetadata&);
     };
+
+    class IDBDatabaseInfo;
+    template<> struct WEBCORE_EXPORT CrossThreadCopierBase<false, false, IDBDatabaseInfo> {
+        typedef IDBDatabaseInfo Type;
+        static Type copy(const IDBDatabaseInfo&);
+    };
+
+    class IDBDatabaseIdentifier;
+    template<> struct WEBCORE_EXPORT CrossThreadCopierBase<false, false, IDBDatabaseIdentifier> {
+        typedef IDBDatabaseIdentifier Type;
+        static Type copy(const IDBDatabaseIdentifier&);
+    };
+
 #endif
 
     template<typename T>