summaryrefslogtreecommitdiff
path: root/Source/WebKit2/DatabaseProcess
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/DatabaseProcess')
-rw-r--r--Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp398
-rw-r--r--Source/WebKit2/DatabaseProcess/DatabaseProcess.h122
-rw-r--r--Source/WebKit2/DatabaseProcess/DatabaseProcess.messages.in37
-rw-r--r--Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp127
-rw-r--r--Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.h78
-rw-r--r--Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.messages.in33
-rw-r--r--Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp34
-rw-r--r--Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp280
-rw-r--r--Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h123
-rw-r--r--Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in49
-rw-r--r--Source/WebKit2/DatabaseProcess/unix/DatabaseProcessMainUnix.h43
11 files changed, 1324 insertions, 0 deletions
diff --git a/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp b/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp
new file mode 100644
index 000000000..e267130e8
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp
@@ -0,0 +1,398 @@
+/*
+ * Copyright (C) 2013 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 "DatabaseProcess.h"
+
+#if ENABLE(DATABASE_PROCESS)
+
+#include "DatabaseProcessCreationParameters.h"
+#include "DatabaseProcessMessages.h"
+#include "DatabaseProcessProxyMessages.h"
+#include "DatabaseToWebProcessConnection.h"
+#include "WebCrossThreadCopier.h"
+#include "WebsiteData.h"
+#include <WebCore/CrossThreadTask.h>
+#include <WebCore/FileSystem.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/SessionID.h>
+#include <WebCore/TextEncoding.h>
+#include <wtf/MainThread.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+DatabaseProcess& DatabaseProcess::singleton()
+{
+ static NeverDestroyed<DatabaseProcess> databaseProcess;
+ return databaseProcess;
+}
+
+DatabaseProcess::DatabaseProcess()
+ : m_queue(WorkQueue::create("com.apple.WebKit.DatabaseProcess"))
+{
+ // Make sure the UTF8Encoding encoding and the text encoding maps have been built on the main thread before a background thread needs it.
+ // FIXME: https://bugs.webkit.org/show_bug.cgi?id=135365 - Need a more explicit way of doing this besides accessing the UTF8Encoding.
+ UTF8Encoding();
+}
+
+DatabaseProcess::~DatabaseProcess()
+{
+}
+
+void DatabaseProcess::initializeConnection(IPC::Connection* connection)
+{
+ ChildProcess::initializeConnection(connection);
+}
+
+bool DatabaseProcess::shouldTerminate()
+{
+ return true;
+}
+
+void DatabaseProcess::didClose(IPC::Connection&)
+{
+ RunLoop::current().stop();
+}
+
+void DatabaseProcess::didReceiveMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder)
+{
+ if (messageReceiverMap().dispatchMessage(connection, decoder))
+ return;
+
+ if (decoder.messageReceiverName() == Messages::DatabaseProcess::messageReceiverName()) {
+ didReceiveDatabaseProcessMessage(connection, decoder);
+ return;
+ }
+}
+
+void DatabaseProcess::didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference)
+{
+ RunLoop::current().stop();
+}
+
+#if ENABLE(INDEXED_DATABASE)
+IDBServer::IDBServer& DatabaseProcess::idbServer()
+{
+ if (!m_idbServer)
+ m_idbServer = IDBServer::IDBServer::create(indexedDatabaseDirectory());
+
+ return *m_idbServer;
+}
+#endif
+
+void DatabaseProcess::initializeDatabaseProcess(const DatabaseProcessCreationParameters& parameters)
+{
+#if ENABLE(INDEXED_DATABASE)
+ // *********
+ // IMPORTANT: Do not change the directory structure for indexed databases on disk without first consulting a reviewer from Apple (<rdar://problem/17454712>)
+ // *********
+
+ m_indexedDatabaseDirectory = parameters.indexedDatabaseDirectory;
+ SandboxExtension::consumePermanently(parameters.indexedDatabaseDirectoryExtensionHandle);
+
+ ensureIndexedDatabaseRelativePathExists(StringImpl::empty());
+#endif
+}
+
+#if ENABLE(INDEXED_DATABASE)
+void DatabaseProcess::ensureIndexedDatabaseRelativePathExists(const String& relativePath)
+{
+ postDatabaseTask(createCrossThreadTask(*this, &DatabaseProcess::ensurePathExists, absoluteIndexedDatabasePathFromDatabaseRelativePath(relativePath)));
+}
+#endif
+
+void DatabaseProcess::ensurePathExists(const String& path)
+{
+ ASSERT(!RunLoop::isMain());
+
+ if (!makeAllDirectories(path))
+ LOG_ERROR("Failed to make all directories for path '%s'", path.utf8().data());
+}
+
+#if ENABLE(INDEXED_DATABASE)
+String DatabaseProcess::absoluteIndexedDatabasePathFromDatabaseRelativePath(const String& relativePath)
+{
+ // FIXME: pathByAppendingComponent() was originally designed to append individual atomic components.
+ // We don't have a function designed to append a multi-component subpath, but we should.
+ return pathByAppendingComponent(m_indexedDatabaseDirectory, relativePath);
+}
+#endif
+
+void DatabaseProcess::postDatabaseTask(std::unique_ptr<CrossThreadTask> task)
+{
+ ASSERT(RunLoop::isMain());
+
+ LockHolder locker(m_databaseTaskMutex);
+
+ m_databaseTasks.append(WTFMove(task));
+
+ m_queue->dispatch([this] {
+ performNextDatabaseTask();
+ });
+}
+
+void DatabaseProcess::performNextDatabaseTask()
+{
+ ASSERT(!RunLoop::isMain());
+
+ std::unique_ptr<CrossThreadTask> task;
+ {
+ LockHolder locker(m_databaseTaskMutex);
+ ASSERT(!m_databaseTasks.isEmpty());
+ task = m_databaseTasks.takeFirst();
+ }
+
+ task->performTask();
+}
+
+void DatabaseProcess::createDatabaseToWebProcessConnection()
+{
+#if USE(UNIX_DOMAIN_SOCKETS)
+ IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
+ m_databaseToWebProcessConnections.append(DatabaseToWebProcessConnection::create(socketPair.server));
+ parentProcessConnection()->send(Messages::DatabaseProcessProxy::DidCreateDatabaseToWebProcessConnection(IPC::Attachment(socketPair.client)), 0);
+#elif OS(DARWIN)
+ // Create the listening port.
+ mach_port_t listeningPort;
+ mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort);
+
+ // Create a listening connection.
+ RefPtr<DatabaseToWebProcessConnection> connection = DatabaseToWebProcessConnection::create(IPC::Connection::Identifier(listeningPort));
+ m_databaseToWebProcessConnections.append(connection.release());
+
+ IPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND);
+ parentProcessConnection()->send(Messages::DatabaseProcessProxy::DidCreateDatabaseToWebProcessConnection(clientPort), 0);
+#else
+ notImplemented();
+#endif
+}
+
+void DatabaseProcess::fetchWebsiteData(SessionID, uint64_t websiteDataTypes, uint64_t callbackID)
+{
+ struct CallbackAggregator final : public ThreadSafeRefCounted<CallbackAggregator> {
+ explicit CallbackAggregator(std::function<void (WebsiteData)> completionHandler)
+ : m_completionHandler(WTFMove(completionHandler))
+ {
+ }
+
+ ~CallbackAggregator()
+ {
+ ASSERT(RunLoop::isMain());
+
+ auto completionHandler = WTFMove(m_completionHandler);
+ auto websiteData = WTFMove(m_websiteData);
+
+ RunLoop::main().dispatch([completionHandler, websiteData] {
+ completionHandler(websiteData);
+ });
+ }
+
+ std::function<void (WebsiteData)> m_completionHandler;
+ WebsiteData m_websiteData;
+ };
+
+ RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator([this, callbackID](WebsiteData websiteData) {
+ parentProcessConnection()->send(Messages::DatabaseProcessProxy::DidFetchWebsiteData(callbackID, websiteData), 0);
+ }));
+
+#if ENABLE(INDEXED_DATABASE)
+ if (websiteDataTypes & WebsiteDataTypeIndexedDBDatabases) {
+ // FIXME: Pick the right database store based on the session ID.
+ postDatabaseTask(std::make_unique<CrossThreadTask>([callbackAggregator, websiteDataTypes, this] {
+
+ Vector<RefPtr<SecurityOrigin>> securityOrigins = indexedDatabaseOrigins();
+
+ RunLoop::main().dispatch([callbackAggregator, securityOrigins] {
+ for (const auto& securityOrigin : securityOrigins)
+ callbackAggregator->m_websiteData.entries.append(WebsiteData::Entry { securityOrigin, WebsiteDataTypeIndexedDBDatabases });
+ });
+ }));
+ }
+#endif
+}
+
+void DatabaseProcess::deleteWebsiteData(WebCore::SessionID, uint64_t websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+{
+ struct CallbackAggregator final : public ThreadSafeRefCounted<CallbackAggregator> {
+ explicit CallbackAggregator(std::function<void ()> completionHandler)
+ : m_completionHandler(WTFMove(completionHandler))
+ {
+ }
+
+ ~CallbackAggregator()
+ {
+ ASSERT(RunLoop::isMain());
+
+ RunLoop::main().dispatch(WTFMove(m_completionHandler));
+ }
+
+ std::function<void ()> m_completionHandler;
+ };
+
+ RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator([this, callbackID]() {
+ parentProcessConnection()->send(Messages::DatabaseProcessProxy::DidDeleteWebsiteData(callbackID), 0);
+ }));
+
+#if ENABLE(INDEXED_DATABASE)
+ if (websiteDataTypes & WebsiteDataTypeIndexedDBDatabases) {
+ postDatabaseTask(std::make_unique<CrossThreadTask>([this, callbackAggregator, modifiedSince] {
+
+ deleteIndexedDatabaseEntriesModifiedSince(modifiedSince);
+ RunLoop::main().dispatch([callbackAggregator] { });
+ }));
+ }
+#endif
+}
+
+void DatabaseProcess::deleteWebsiteDataForOrigins(WebCore::SessionID, uint64_t websiteDataTypes, const Vector<SecurityOriginData>& securityOriginDatas, uint64_t callbackID)
+{
+ struct CallbackAggregator final : public ThreadSafeRefCounted<CallbackAggregator> {
+ explicit CallbackAggregator(std::function<void ()> completionHandler)
+ : m_completionHandler(WTFMove(completionHandler))
+ {
+ }
+
+ ~CallbackAggregator()
+ {
+ ASSERT(RunLoop::isMain());
+
+ RunLoop::main().dispatch(WTFMove(m_completionHandler));
+ }
+
+ std::function<void ()> m_completionHandler;
+ };
+
+ RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator([this, callbackID]() {
+ parentProcessConnection()->send(Messages::DatabaseProcessProxy::DidDeleteWebsiteDataForOrigins(callbackID), 0);
+ }));
+
+#if ENABLE(INDEXED_DATABASE)
+ if (websiteDataTypes & WebsiteDataTypeIndexedDBDatabases) {
+ Vector<RefPtr<WebCore::SecurityOrigin>> securityOrigins;
+ for (const auto& securityOriginData : securityOriginDatas)
+ securityOrigins.append(securityOriginData.securityOrigin());
+
+ postDatabaseTask(std::make_unique<CrossThreadTask>([this, securityOrigins, callbackAggregator] {
+ deleteIndexedDatabaseEntriesForOrigins(securityOrigins);
+
+ RunLoop::main().dispatch([callbackAggregator] { });
+ }));
+ }
+#endif
+}
+
+#if ENABLE(INDEXED_DATABASE)
+Vector<RefPtr<WebCore::SecurityOrigin>> DatabaseProcess::indexedDatabaseOrigins()
+{
+ if (m_indexedDatabaseDirectory.isEmpty())
+ return { };
+
+ Vector<RefPtr<WebCore::SecurityOrigin>> securityOrigins;
+ for (auto& originPath : listDirectory(m_indexedDatabaseDirectory, "*")) {
+ String databaseIdentifier = pathGetFileName(originPath);
+
+ if (auto securityOrigin = SecurityOrigin::maybeCreateFromDatabaseIdentifier(databaseIdentifier))
+ securityOrigins.append(WTFMove(securityOrigin));
+ }
+
+ return securityOrigins;
+}
+#endif
+
+#if ENABLE(INDEXED_DATABASE)
+static void removeAllDatabasesForOriginPath(const String& originPath, std::chrono::system_clock::time_point modifiedSince)
+{
+ // FIXME: We should also close/invalidate any live handles to the database files we are about to delete.
+ // Right now:
+ // - For read-only operations, they will continue functioning as normal on the unlinked file.
+ // - For write operations, they will start producing errors as SQLite notices the missing backing store.
+ // This is tracked by https://bugs.webkit.org/show_bug.cgi?id=135347
+
+ Vector<String> databasePaths = listDirectory(originPath, "*");
+
+ for (auto& databasePath : databasePaths) {
+ String databaseFile = pathByAppendingComponent(databasePath, "IndexedDB.sqlite3");
+
+ if (!fileExists(databaseFile))
+ continue;
+
+ if (modifiedSince > std::chrono::system_clock::time_point::min()) {
+ time_t modificationTime;
+ if (!getFileModificationTime(databaseFile, modificationTime))
+ continue;
+
+ if (std::chrono::system_clock::from_time_t(modificationTime) < modifiedSince)
+ continue;
+ }
+
+ deleteFile(databaseFile);
+ deleteEmptyDirectory(databasePath);
+ }
+
+ deleteEmptyDirectory(originPath);
+}
+
+void DatabaseProcess::deleteIndexedDatabaseEntriesForOrigins(const Vector<RefPtr<WebCore::SecurityOrigin>>& securityOrigins)
+{
+ if (m_indexedDatabaseDirectory.isEmpty())
+ return;
+
+ for (const auto& securityOrigin : securityOrigins) {
+ String originPath = pathByAppendingComponent(m_indexedDatabaseDirectory, securityOrigin->databaseIdentifier());
+
+ removeAllDatabasesForOriginPath(originPath, std::chrono::system_clock::time_point::min());
+ }
+}
+
+void DatabaseProcess::deleteIndexedDatabaseEntriesModifiedSince(std::chrono::system_clock::time_point modifiedSince)
+{
+ if (m_indexedDatabaseDirectory.isEmpty())
+ return;
+
+ Vector<String> originPaths = listDirectory(m_indexedDatabaseDirectory, "*");
+ for (auto& originPath : originPaths)
+ removeAllDatabasesForOriginPath(originPath, modifiedSince);
+}
+#endif
+
+#if !PLATFORM(COCOA)
+void DatabaseProcess::initializeProcess(const ChildProcessInitializationParameters&)
+{
+}
+
+void DatabaseProcess::initializeProcessName(const ChildProcessInitializationParameters&)
+{
+}
+
+void DatabaseProcess::initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&)
+{
+}
+#endif
+
+} // namespace WebKit
+
+#endif // ENABLE(DATABASE_PROCESS)
diff --git a/Source/WebKit2/DatabaseProcess/DatabaseProcess.h b/Source/WebKit2/DatabaseProcess/DatabaseProcess.h
new file mode 100644
index 000000000..d87966c92
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/DatabaseProcess.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2013 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 DatabaseProcess_h
+#define DatabaseProcess_h
+
+#if ENABLE(DATABASE_PROCESS)
+
+#include "ChildProcess.h"
+#include <WebCore/IDBServer.h>
+#include <WebCore/UniqueIDBDatabase.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+class CrossThreadTask;
+class SessionID;
+struct SecurityOriginData;
+}
+
+namespace WebKit {
+
+class DatabaseToWebProcessConnection;
+
+struct DatabaseProcessCreationParameters;
+
+class DatabaseProcess : public ChildProcess {
+ WTF_MAKE_NONCOPYABLE(DatabaseProcess);
+ friend class NeverDestroyed<DatabaseProcess>;
+public:
+ static DatabaseProcess& singleton();
+ ~DatabaseProcess();
+
+#if ENABLE(INDEXED_DATABASE)
+ const String& indexedDatabaseDirectory() const { return m_indexedDatabaseDirectory; }
+
+ void ensureIndexedDatabaseRelativePathExists(const String&);
+ String absoluteIndexedDatabasePathFromDatabaseRelativePath(const String&);
+
+ WebCore::IDBServer::IDBServer& idbServer();
+#endif
+
+ WorkQueue& queue() { return m_queue.get(); }
+
+ void postDatabaseTask(std::unique_ptr<WebCore::CrossThreadTask>);
+
+private:
+ DatabaseProcess();
+
+ // ChildProcess
+ virtual void initializeProcess(const ChildProcessInitializationParameters&) override;
+ virtual void initializeProcessName(const ChildProcessInitializationParameters&) override;
+ virtual void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&) override;
+ virtual void initializeConnection(IPC::Connection*) override;
+ virtual bool shouldTerminate() override;
+
+ // IPC::Connection::Client
+ virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
+ virtual void didClose(IPC::Connection&) override;
+ virtual void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override;
+ virtual IPC::ProcessType localProcessType() override { return IPC::ProcessType::Database; }
+ virtual IPC::ProcessType remoteProcessType() override { return IPC::ProcessType::UI; }
+ void didReceiveDatabaseProcessMessage(IPC::Connection&, IPC::MessageDecoder&);
+
+ // Message Handlers
+ void initializeDatabaseProcess(const DatabaseProcessCreationParameters&);
+ void createDatabaseToWebProcessConnection();
+
+ void fetchWebsiteData(WebCore::SessionID, uint64_t websiteDataTypes, uint64_t callbackID);
+ void deleteWebsiteData(WebCore::SessionID, uint64_t websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID);
+ void deleteWebsiteDataForOrigins(WebCore::SessionID, uint64_t websiteDataTypes, const Vector<WebCore::SecurityOriginData>& origins, uint64_t callbackID);
+
+#if ENABLE(INDEXED_DATABASE)
+ Vector<RefPtr<WebCore::SecurityOrigin>> indexedDatabaseOrigins();
+ void deleteIndexedDatabaseEntriesForOrigins(const Vector<RefPtr<WebCore::SecurityOrigin>>&);
+ void deleteIndexedDatabaseEntriesModifiedSince(std::chrono::system_clock::time_point modifiedSince);
+#endif
+
+ // For execution on work queue thread only
+ void performNextDatabaseTask();
+ void ensurePathExists(const String&);
+
+ Vector<RefPtr<DatabaseToWebProcessConnection>> m_databaseToWebProcessConnections;
+
+ Ref<WorkQueue> m_queue;
+
+#if ENABLE(INDEXED_DATABASE)
+ String m_indexedDatabaseDirectory;
+
+ RefPtr<WebCore::IDBServer::IDBServer> m_idbServer;
+#endif
+
+ Deque<std::unique_ptr<WebCore::CrossThreadTask>> m_databaseTasks;
+ Lock m_databaseTaskMutex;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(DATABASE_PROCESS)
+
+#endif // DatabaseProcess_h
diff --git a/Source/WebKit2/DatabaseProcess/DatabaseProcess.messages.in b/Source/WebKit2/DatabaseProcess/DatabaseProcess.messages.in
new file mode 100644
index 000000000..bf4e88fc4
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/DatabaseProcess.messages.in
@@ -0,0 +1,37 @@
+# Copyright (C) 2013 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.
+
+#if ENABLE(DATABASE_PROCESS)
+
+messages -> DatabaseProcess LegacyReceiver {
+ # Initializes the DatabaseProcess with the correct parameters
+ InitializeDatabaseProcess(struct WebKit::DatabaseProcessCreationParameters processCreationParameters)
+
+ # Creates a connection for communication with a WebProcess
+ CreateDatabaseToWebProcessConnection()
+
+ FetchWebsiteData(WebCore::SessionID sessionID, uint64_t websiteDataTypes, uint64_t callbackID)
+ DeleteWebsiteData(WebCore::SessionID sessionID, uint64_t websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
+ DeleteWebsiteDataForOrigins(WebCore::SessionID sessionID, uint64_t websiteDataTypes, Vector<WebCore::SecurityOriginData> origins, uint64_t callbackID)
+}
+
+#endif // ENABLE(DATABASE_PROCESS)
diff --git a/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp b/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp
new file mode 100644
index 000000000..0f6855246
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2013 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 "DatabaseToWebProcessConnection.h"
+
+#include "DatabaseToWebProcessConnectionMessages.h"
+#include "Logging.h"
+#include "WebIDBConnectionToClient.h"
+#include "WebIDBConnectionToClientMessages.h"
+#include <wtf/RunLoop.h>
+
+#if ENABLE(DATABASE_PROCESS)
+
+namespace WebKit {
+
+Ref<DatabaseToWebProcessConnection> DatabaseToWebProcessConnection::create(IPC::Connection::Identifier connectionIdentifier)
+{
+ return adoptRef(*new DatabaseToWebProcessConnection(connectionIdentifier));
+}
+
+DatabaseToWebProcessConnection::DatabaseToWebProcessConnection(IPC::Connection::Identifier connectionIdentifier)
+{
+ m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
+ m_connection->setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(true);
+ m_connection->open();
+}
+
+DatabaseToWebProcessConnection::~DatabaseToWebProcessConnection()
+{
+
+}
+
+void DatabaseToWebProcessConnection::didReceiveMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder)
+{
+ if (decoder.messageReceiverName() == Messages::DatabaseToWebProcessConnection::messageReceiverName()) {
+ didReceiveDatabaseToWebProcessConnectionMessage(connection, decoder);
+ return;
+ }
+
+#if ENABLE(INDEXED_DATABASE)
+ if (decoder.messageReceiverName() == Messages::WebIDBConnectionToClient::messageReceiverName()) {
+ auto iterator = m_webIDBConnections.find(decoder.destinationID());
+ if (iterator != m_webIDBConnections.end())
+ iterator->value->didReceiveMessage(connection, decoder);
+ return;
+ }
+#endif
+
+ ASSERT_NOT_REACHED();
+}
+
+void DatabaseToWebProcessConnection::didReceiveSyncMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder)
+{
+ if (decoder.messageReceiverName() == Messages::DatabaseToWebProcessConnection::messageReceiverName()) {
+ didReceiveSyncDatabaseToWebProcessConnectionMessage(connection, decoder, replyEncoder);
+ return;
+ }
+
+ ASSERT_NOT_REACHED();
+}
+
+void DatabaseToWebProcessConnection::didClose(IPC::Connection&)
+{
+#if ENABLE(INDEXED_DATABASE)
+ // FIXME: (Modern IDB) The WebProcess has disconnected, close all of the connections associated with it
+#endif
+}
+
+void DatabaseToWebProcessConnection::didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName)
+{
+
+}
+
+#if ENABLE(INDEXED_DATABASE)
+
+static uint64_t generateConnectionToServerIdentifier()
+{
+ ASSERT(RunLoop::isMain());
+ static uint64_t identifier = 0;
+ return ++identifier;
+}
+
+void DatabaseToWebProcessConnection::establishIDBConnectionToServer(uint64_t& serverConnectionIdentifier)
+{
+ serverConnectionIdentifier = generateConnectionToServerIdentifier();
+ LOG(IndexedDB, "DatabaseToWebProcessConnection::establishIDBConnectionToServer - %" PRIu64, serverConnectionIdentifier);
+ ASSERT(!m_webIDBConnections.contains(serverConnectionIdentifier));
+
+ m_webIDBConnections.set(serverConnectionIdentifier, WebIDBConnectionToClient::create(*this, serverConnectionIdentifier));
+}
+
+void DatabaseToWebProcessConnection::removeIDBConnectionToServer(uint64_t serverConnectionIdentifier)
+{
+ ASSERT(m_webIDBConnections.contains(serverConnectionIdentifier));
+
+ auto connection = m_webIDBConnections.take(serverConnectionIdentifier);
+ connection->disconnectedFromWebProcess();
+}
+#endif
+
+
+} // namespace WebKit
+
+#endif // ENABLE(DATABASE_PROCESS)
diff --git a/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.h b/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.h
new file mode 100644
index 000000000..a106d4161
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013 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 DatabaseToWebProcessConnection_h
+#define DatabaseToWebProcessConnection_h
+
+#include "Connection.h"
+#include "MessageSender.h"
+
+#include <wtf/HashMap.h>
+
+#if ENABLE(DATABASE_PROCESS)
+
+namespace WebKit {
+
+class WebIDBConnectionToClient;
+
+class DatabaseToWebProcessConnection : public RefCounted<DatabaseToWebProcessConnection>, public IPC::Connection::Client, public IPC::MessageSender {
+public:
+ static Ref<DatabaseToWebProcessConnection> create(IPC::Connection::Identifier);
+ ~DatabaseToWebProcessConnection();
+
+ IPC::Connection* connection() const { return m_connection.get(); }
+
+private:
+ DatabaseToWebProcessConnection(IPC::Connection::Identifier);
+
+ // IPC::Connection::Client
+ virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
+ virtual void didReceiveSyncMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override;
+ virtual void didClose(IPC::Connection&) override;
+ virtual void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override;
+ virtual IPC::ProcessType localProcessType() override { return IPC::ProcessType::Database; }
+ virtual IPC::ProcessType remoteProcessType() override { return IPC::ProcessType::Web; }
+ void didReceiveDatabaseToWebProcessConnectionMessage(IPC::Connection&, IPC::MessageDecoder&);
+ void didReceiveSyncDatabaseToWebProcessConnectionMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
+
+ // IPC::MessageSender
+ virtual IPC::Connection* messageSenderConnection() override { return m_connection.get(); }
+ virtual uint64_t messageSenderDestinationID() override { return 0; }
+
+#if ENABLE(INDEXED_DATABASE)
+ // Messages handlers (Modern IDB)
+ void establishIDBConnectionToServer(uint64_t& serverConnectionIdentifier);
+ void removeIDBConnectionToServer(uint64_t serverConnectionIdentifier);
+
+ HashMap<uint64_t, RefPtr<WebIDBConnectionToClient>> m_webIDBConnections;
+#endif // ENABLE(INDEXED_DATABASE)
+
+ RefPtr<IPC::Connection> m_connection;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(DATABASE_PROCESS)
+#endif // DatabaseToWebProcessConnection_h
diff --git a/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.messages.in b/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.messages.in
new file mode 100644
index 000000000..60bec6e42
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.messages.in
@@ -0,0 +1,33 @@
+# Copyright (C) 2013 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.
+
+#if ENABLE(DATABASE_PROCESS)
+
+messages -> DatabaseToWebProcessConnection LegacyReceiver {
+#if ENABLE(INDEXED_DATABASE)
+ # Creates a connection for communication with a WebProcess
+ EstablishIDBConnectionToServer() -> (uint64_t serverConnectionIdentifier)
+ RemoveIDBConnectionToServer(uint64_t serverConnectionIdentifier)
+#endif
+}
+
+#endif // ENABLE(DATABASE_PROCESS)
diff --git a/Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp b/Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp
new file mode 100644
index 000000000..9d8b81838
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/EntryPoint/unix/DatabaseProcessMain.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 "DatabaseProcessMainUnix.h"
+
+using namespace WebKit;
+
+int main(int argc, char** argv)
+{
+ return DatabaseProcessMainUnix(argc, argv);
+}
diff --git a/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp b/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp
new file mode 100644
index 000000000..cc0735db4
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp
@@ -0,0 +1,280 @@
+/*
+ * Copyright (C) 2016 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 "WebIDBConnectionToClient.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "DataReference.h"
+#include "DatabaseProcess.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebIDBConnectionToServerMessages.h"
+#include <WebCore/IDBError.h>
+#include <WebCore/IDBResultData.h>
+#include <WebCore/ThreadSafeDataBuffer.h>
+#include <WebCore/UniqueIDBDatabaseConnection.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+Ref<WebIDBConnectionToClient> WebIDBConnectionToClient::create(DatabaseToWebProcessConnection& connection, uint64_t serverConnectionIdentifier)
+{
+ return adoptRef(*new WebIDBConnectionToClient(connection, serverConnectionIdentifier));
+}
+
+WebIDBConnectionToClient::WebIDBConnectionToClient(DatabaseToWebProcessConnection& connection, uint64_t serverConnectionIdentifier)
+ : m_connection(connection)
+ , m_identifier(serverConnectionIdentifier)
+{
+ relaxAdoptionRequirement();
+ m_connectionToClient = IDBServer::IDBConnectionToClient::create(*this);
+ DatabaseProcess::singleton().idbServer().registerConnection(*m_connectionToClient);
+}
+
+WebIDBConnectionToClient::~WebIDBConnectionToClient()
+{
+ DatabaseProcess::singleton().idbServer().unregisterConnection(*m_connectionToClient);
+}
+
+void WebIDBConnectionToClient::disconnectedFromWebProcess()
+{
+}
+
+IPC::Connection* WebIDBConnectionToClient::messageSenderConnection()
+{
+ return m_connection->connection();
+}
+
+WebCore::IDBServer::IDBConnectionToClient& WebIDBConnectionToClient::connectionToClient()
+{
+ return *m_connectionToClient;
+}
+
+void WebIDBConnectionToClient::didDeleteDatabase(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidDeleteDatabase(resultData));
+}
+
+void WebIDBConnectionToClient::didOpenDatabase(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidOpenDatabase(resultData));
+}
+
+void WebIDBConnectionToClient::didAbortTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError& error)
+{
+ send(Messages::WebIDBConnectionToServer::DidAbortTransaction(transactionIdentifier, error));
+}
+
+void WebIDBConnectionToClient::didCommitTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError& error)
+{
+ send(Messages::WebIDBConnectionToServer::DidCommitTransaction(transactionIdentifier, error));
+}
+
+void WebIDBConnectionToClient::didCreateObjectStore(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidCreateObjectStore(resultData));
+}
+
+void WebIDBConnectionToClient::didDeleteObjectStore(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidDeleteObjectStore(resultData));
+}
+
+void WebIDBConnectionToClient::didClearObjectStore(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidClearObjectStore(resultData));
+}
+
+void WebIDBConnectionToClient::didCreateIndex(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidCreateIndex(resultData));
+}
+
+void WebIDBConnectionToClient::didDeleteIndex(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidDeleteIndex(resultData));
+}
+
+void WebIDBConnectionToClient::didPutOrAdd(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidPutOrAdd(resultData));
+}
+
+void WebIDBConnectionToClient::didGetRecord(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidGetRecord(resultData));
+}
+
+void WebIDBConnectionToClient::didGetCount(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidGetCount(resultData));
+}
+
+void WebIDBConnectionToClient::didDeleteRecord(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidDeleteRecord(resultData));
+}
+
+void WebIDBConnectionToClient::didOpenCursor(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidOpenCursor(resultData));
+}
+
+void WebIDBConnectionToClient::didIterateCursor(const WebCore::IDBResultData& resultData)
+{
+ send(Messages::WebIDBConnectionToServer::DidIterateCursor(resultData));
+}
+
+void WebIDBConnectionToClient::fireVersionChangeEvent(WebCore::IDBServer::UniqueIDBDatabaseConnection& connection, const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion)
+{
+ send(Messages::WebIDBConnectionToServer::FireVersionChangeEvent(connection.identifier(), requestIdentifier, requestedVersion));
+}
+
+void WebIDBConnectionToClient::didStartTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError& error)
+{
+ send(Messages::WebIDBConnectionToServer::DidStartTransaction(transactionIdentifier, error));
+}
+
+void WebIDBConnectionToClient::notifyOpenDBRequestBlocked(const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion)
+{
+ send(Messages::WebIDBConnectionToServer::NotifyOpenDBRequestBlocked(requestIdentifier, oldVersion, newVersion));
+}
+
+void WebIDBConnectionToClient::deleteDatabase(const IDBRequestData& request)
+{
+ DatabaseProcess::singleton().idbServer().deleteDatabase(request);
+}
+
+void WebIDBConnectionToClient::openDatabase(const IDBRequestData& request)
+{
+ DatabaseProcess::singleton().idbServer().openDatabase(request);
+}
+
+void WebIDBConnectionToClient::abortTransaction(const IDBResourceIdentifier& transactionIdentifier)
+{
+ DatabaseProcess::singleton().idbServer().abortTransaction(transactionIdentifier);
+}
+
+void WebIDBConnectionToClient::commitTransaction(const IDBResourceIdentifier& transactionIdentifier)
+{
+ DatabaseProcess::singleton().idbServer().commitTransaction(transactionIdentifier);
+}
+
+void WebIDBConnectionToClient::didFinishHandlingVersionChangeTransaction(const IDBResourceIdentifier& transactionIdentifier)
+{
+ DatabaseProcess::singleton().idbServer().didFinishHandlingVersionChangeTransaction(transactionIdentifier);
+}
+
+void WebIDBConnectionToClient::createObjectStore(const IDBRequestData& request, const IDBObjectStoreInfo& info)
+{
+ DatabaseProcess::singleton().idbServer().createObjectStore(request, info);
+}
+
+void WebIDBConnectionToClient::deleteObjectStore(const IDBRequestData& request, const String& name)
+{
+ DatabaseProcess::singleton().idbServer().deleteObjectStore(request, name);
+}
+
+void WebIDBConnectionToClient::clearObjectStore(const IDBRequestData& request, uint64_t objectStoreIdentifier)
+{
+ DatabaseProcess::singleton().idbServer().clearObjectStore(request, objectStoreIdentifier);
+}
+
+void WebIDBConnectionToClient::createIndex(const IDBRequestData& request, const IDBIndexInfo& info)
+{
+ DatabaseProcess::singleton().idbServer().createIndex(request, info);
+}
+
+void WebIDBConnectionToClient::deleteIndex(const IDBRequestData& request, uint64_t objectStoreIdentifier, const String& name)
+{
+ DatabaseProcess::singleton().idbServer().deleteIndex(request, objectStoreIdentifier, name);
+}
+
+void WebIDBConnectionToClient::putOrAdd(const IDBRequestData& request, const IDBKeyData& key, const IPC::DataReference& data, unsigned overwriteMode)
+{
+ if (overwriteMode != static_cast<unsigned>(IndexedDB::ObjectStoreOverwriteMode::NoOverwrite)
+ && overwriteMode != static_cast<unsigned>(IndexedDB::ObjectStoreOverwriteMode::Overwrite)
+ && overwriteMode != static_cast<unsigned>(IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor)) {
+ // FIXME: This message from the WebProcess is corrupt.
+ // The DatabaseProcess should return early at this point, but can we also kill the bad WebProcess?
+ return;
+ }
+
+ IndexedDB::ObjectStoreOverwriteMode mode = static_cast<IndexedDB::ObjectStoreOverwriteMode>(overwriteMode);
+ auto buffer = ThreadSafeDataBuffer::copyVector(data.vector());
+
+ DatabaseProcess::singleton().idbServer().putOrAdd(request, key, buffer, mode);
+}
+
+void WebIDBConnectionToClient::getRecord(const IDBRequestData& request, const IDBKeyRangeData& range)
+{
+ DatabaseProcess::singleton().idbServer().getRecord(request, range);
+}
+
+void WebIDBConnectionToClient::getCount(const IDBRequestData& request, const IDBKeyRangeData& range)
+{
+ DatabaseProcess::singleton().idbServer().getCount(request, range);
+}
+
+void WebIDBConnectionToClient::deleteRecord(const IDBRequestData& request, const IDBKeyRangeData& range)
+{
+ DatabaseProcess::singleton().idbServer().deleteRecord(request, range);
+}
+
+void WebIDBConnectionToClient::openCursor(const IDBRequestData& request, const IDBCursorInfo& info)
+{
+ DatabaseProcess::singleton().idbServer().openCursor(request, info);
+}
+
+void WebIDBConnectionToClient::iterateCursor(const IDBRequestData& request, const IDBKeyData& key, unsigned long count)
+{
+ DatabaseProcess::singleton().idbServer().iterateCursor(request, key, count);
+}
+
+void WebIDBConnectionToClient::establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo& info)
+{
+ DatabaseProcess::singleton().idbServer().establishTransaction(databaseConnectionIdentifier, info);
+}
+
+void WebIDBConnectionToClient::databaseConnectionClosed(uint64_t databaseConnectionIdentifier)
+{
+ DatabaseProcess::singleton().idbServer().databaseConnectionClosed(databaseConnectionIdentifier);
+}
+
+void WebIDBConnectionToClient::abortOpenAndUpgradeNeeded(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& transactionIdentifier)
+{
+ DatabaseProcess::singleton().idbServer().abortOpenAndUpgradeNeeded(databaseConnectionIdentifier, transactionIdentifier);
+}
+
+void WebIDBConnectionToClient::didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& transactionIdentifier)
+{
+ DatabaseProcess::singleton().idbServer().didFireVersionChangeEvent(databaseConnectionIdentifier, transactionIdentifier);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(INDEXED_DATABASE)
diff --git a/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h b/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h
new file mode 100644
index 000000000..7ff1899fd
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2016 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 WebIDBConnectionToClient_h
+#define WebIDBConnectionToClient_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "DatabaseToWebProcessConnection.h"
+#include "MessageSender.h"
+#include <WebCore/IDBConnectionToClient.h>
+
+namespace WebCore {
+class IDBCursorInfo;
+class IDBIndexInfo;
+class IDBKeyData;
+class IDBObjectStoreInfo;
+class IDBRequestData;
+class IDBTransactionInfo;
+class SerializedScriptValue;
+struct IDBKeyRangeData;
+}
+
+namespace WebKit {
+
+class WebIDBConnectionToClient final : public WebCore::IDBServer::IDBConnectionToClientDelegate, public IPC::MessageSender, public RefCounted<WebIDBConnectionToClient> {
+public:
+ static Ref<WebIDBConnectionToClient> create(DatabaseToWebProcessConnection&, uint64_t serverConnectionIdentifier);
+
+ virtual ~WebIDBConnectionToClient();
+
+ WebCore::IDBServer::IDBConnectionToClient& connectionToClient();
+ virtual uint64_t identifier() const override final { return m_identifier; }
+ virtual uint64_t messageSenderDestinationID() override final { return m_identifier; }
+
+ // IDBConnectionToClientDelegate
+ virtual void didDeleteDatabase(const WebCore::IDBResultData&) override final;
+ virtual void didOpenDatabase(const WebCore::IDBResultData&) override final;
+ virtual void didAbortTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError&) override final;
+ virtual void didCommitTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError&) override final;
+ virtual void didCreateObjectStore(const WebCore::IDBResultData&) override final;
+ virtual void didDeleteObjectStore(const WebCore::IDBResultData&) override final;
+ virtual void didClearObjectStore(const WebCore::IDBResultData&) override final;
+ virtual void didCreateIndex(const WebCore::IDBResultData&) override final;
+ virtual void didDeleteIndex(const WebCore::IDBResultData&) override final;
+ virtual void didPutOrAdd(const WebCore::IDBResultData&) override final;
+ virtual void didGetRecord(const WebCore::IDBResultData&) override final;
+ virtual void didGetCount(const WebCore::IDBResultData&) override final;
+ virtual void didDeleteRecord(const WebCore::IDBResultData&) override final;
+ virtual void didOpenCursor(const WebCore::IDBResultData&) override final;
+ virtual void didIterateCursor(const WebCore::IDBResultData&) override final;
+
+ virtual void fireVersionChangeEvent(WebCore::IDBServer::UniqueIDBDatabaseConnection&, const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion) override final;
+ virtual void didStartTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError&) override final;
+ virtual void notifyOpenDBRequestBlocked(const WebCore::IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion) override final;
+
+ virtual void ref() override { RefCounted<WebIDBConnectionToClient>::ref(); }
+ virtual void deref() override { RefCounted<WebIDBConnectionToClient>::deref(); }
+
+ // Messages received from WebProcess
+ void deleteDatabase(const WebCore::IDBRequestData&);
+ void openDatabase(const WebCore::IDBRequestData&);
+ void abortTransaction(const WebCore::IDBResourceIdentifier&);
+ void commitTransaction(const WebCore::IDBResourceIdentifier&);
+ void didFinishHandlingVersionChangeTransaction(const WebCore::IDBResourceIdentifier&);
+ void createObjectStore(const WebCore::IDBRequestData&, const WebCore::IDBObjectStoreInfo&);
+ void deleteObjectStore(const WebCore::IDBRequestData&, const String& objectStoreName);
+ void clearObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier);
+ void createIndex(const WebCore::IDBRequestData&, const WebCore::IDBIndexInfo&);
+ void deleteIndex(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName);
+ void putOrAdd(const WebCore::IDBRequestData&, const WebCore::IDBKeyData&, const IPC::DataReference& value, unsigned overwriteMode);
+ void getRecord(const WebCore::IDBRequestData&, const WebCore::IDBKeyRangeData&);
+ void getCount(const WebCore::IDBRequestData&, const WebCore::IDBKeyRangeData&);
+ void deleteRecord(const WebCore::IDBRequestData&, const WebCore::IDBKeyRangeData&);
+ void openCursor(const WebCore::IDBRequestData&, const WebCore::IDBCursorInfo&);
+ void iterateCursor(const WebCore::IDBRequestData&, const WebCore::IDBKeyData&, unsigned long count);
+
+ void establishTransaction(uint64_t databaseConnectionIdentifier, const WebCore::IDBTransactionInfo&);
+ void databaseConnectionClosed(uint64_t databaseConnectionIdentifier);
+ void abortOpenAndUpgradeNeeded(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& transactionIdentifier);
+ void didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier& requestIdentifier);
+
+ void disconnectedFromWebProcess();
+
+ void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&);
+
+private:
+ WebIDBConnectionToClient(DatabaseToWebProcessConnection&, uint64_t serverConnectionIdentifier);
+
+ virtual IPC::Connection* messageSenderConnection() override final;
+
+ Ref<DatabaseToWebProcessConnection> m_connection;
+
+ uint64_t m_identifier;
+ RefPtr<WebCore::IDBServer::IDBConnectionToClient> m_connectionToClient;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(INDEXED_DATABASE)
+#endif // WebIDBConnectionToClient_h
diff --git a/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in b/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in
new file mode 100644
index 000000000..94f8f2f39
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in
@@ -0,0 +1,49 @@
+# Copyright (C) 2016 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.
+
+#if ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
+
+messages -> WebIDBConnectionToClient {
+ DeleteDatabase(WebCore::IDBRequestData requestData)
+ OpenDatabase(WebCore::IDBRequestData requestData);
+ AbortTransaction(WebCore::IDBResourceIdentifier transactionIdentifier);
+ CommitTransaction(WebCore::IDBResourceIdentifier transactionIdentifier);
+ DidFinishHandlingVersionChangeTransaction(WebCore::IDBResourceIdentifier transactionIdentifier);
+ CreateObjectStore(WebCore::IDBRequestData requestData, WebCore::IDBObjectStoreInfo info);
+ DeleteObjectStore(WebCore::IDBRequestData requestData, String objectStoreName);
+ ClearObjectStore(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier);
+ CreateIndex(WebCore::IDBRequestData requestData, WebCore::IDBIndexInfo info);
+ DeleteIndex(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier, String indexName);
+ PutOrAdd(WebCore::IDBRequestData requestData, WebCore::IDBKeyData key, IPC::DataReference value, unsigned overwriteMode);
+ GetRecord(WebCore::IDBRequestData requestData, struct WebCore::IDBKeyRangeData range);
+ GetCount(WebCore::IDBRequestData requestData, struct WebCore::IDBKeyRangeData range);
+ DeleteRecord(WebCore::IDBRequestData requestData, struct WebCore::IDBKeyRangeData range);
+ OpenCursor(WebCore::IDBRequestData requestData, WebCore::IDBCursorInfo info);
+ IterateCursor(WebCore::IDBRequestData requestData, WebCore::IDBKeyData key, uint32_t count);
+
+ EstablishTransaction(uint64_t databaseConnectionIdentifier, WebCore::IDBTransactionInfo info);
+ DatabaseConnectionClosed(uint64_t databaseConnectionIdentifier);
+ AbortOpenAndUpgradeNeeded(uint64_t databaseConnectionIdentifier, WebCore::IDBResourceIdentifier transactionIdentifier);
+ DidFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, WebCore::IDBResourceIdentifier requestIdentifier);
+}
+
+#endif // ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
diff --git a/Source/WebKit2/DatabaseProcess/unix/DatabaseProcessMainUnix.h b/Source/WebKit2/DatabaseProcess/unix/DatabaseProcessMainUnix.h
new file mode 100644
index 000000000..3675e8d6c
--- /dev/null
+++ b/Source/WebKit2/DatabaseProcess/unix/DatabaseProcessMainUnix.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * 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 DatabaseProcessMainUnix_h
+#define DatabaseProcessMainUnix_h
+
+#if ENABLE(DATABASE_PROCESS)
+
+#include <WebKit/WKBase.h>
+
+namespace WebKit {
+
+extern "C" {
+WK_EXPORT int DatabaseProcessMainUnix(int argc, char** argv);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(DATABASE_PROCESS)
+
+#endif // DatabaseProcessMainUnix_h