Commit 09bfc131 authored by beidson@apple.com's avatar beidson@apple.com
Browse files

Add more infrastructure for ServerConnection communication between Web and Database processes

https://bugs.webkit.org/show_bug.cgi?id=124693

Reviewed by Anders Carlsson.

Source/WebCore:

* WebCore.exp.in:

Source/WebKit2:

* DatabaseProcess/DatabaseToWebProcessConnection.cpp:
(WebKit::DatabaseToWebProcessConnection::establishIDBConnection):
(WebKit::DatabaseToWebProcessConnection::removeDatabaseProcessIDBConnection): Added for WebProcess to be able
  to invalidate the DatabaseProcess side of a server connection.
* DatabaseProcess/DatabaseToWebProcessConnection.h:
* DatabaseProcess/DatabaseToWebProcessConnection.messages.in:

* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp:
(WebKit::DatabaseProcessIDBConnection::DatabaseProcessIDBConnection):
(WebKit::DatabaseProcessIDBConnection::disconnectedFromWebProcess): Added for future cleanup.
(WebKit::DatabaseProcessIDBConnection::establishConnection):
(WebKit::DatabaseProcessIDBConnection::getOrEstablishIDBDatabaseMetadata): Callback to the WebProcess, even if
  it is just dummy data for now.
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:
(WebKit::DatabaseProcessIDBConnection::create):

* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::create): Register the new object with the WebToDatabaseProcessConnection.
(WebKit::WebIDBServerConnection::~WebIDBServerConnection): Remove from the WebToDatabaseProcessConnection.
(WebKit::WebIDBServerConnection::getOrEstablishIDBDatabaseMetadata):
(WebKit::WebIDBServerConnection::didGetOrEstablishIDBDatabaseMetadata): Callback from the DatabaseProcess,
  a no-op for now.
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in: Copied from Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.messages.in.

* WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
(WebKit::WebToDatabaseProcessConnection::didReceiveMessage):
(WebKit::WebToDatabaseProcessConnection::didClose):
(WebKit::WebToDatabaseProcessConnection::registerWebIDBServerConnection): Hold a collection of all
  server connections for messaging.
(WebKit::WebToDatabaseProcessConnection::removeWebIDBServerConnection): Remove a connection from the collection,
  and also message the DatabaseProcess that it’s gone away.
* WebProcess/Databases/WebToDatabaseProcessConnection.h:

Project files, etc etc:
* DerivedSources.make:
* Scripts/webkit2/messages.py:
(struct_or_class):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159611 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b21553c0
2013-11-20 Brady Eidson <beidson@apple.com>
Add more infrastructure for ServerConnection communication between Web and Database processes
https://bugs.webkit.org/show_bug.cgi?id=124693
Reviewed by Anders Carlsson.
* WebCore.exp.in:
2013-11-20 Ryosuke Niwa <rniwa@webkit.org>
 
Hoist <template> to head when found between </head> and <body> for consistency with <script>
......@@ -2897,6 +2897,8 @@ __ZN7WebCore26MockMediaPlayerMediaSource19registerMediaEngineEPFvPFN3WTF10PassOw
#endif
#if ENABLE(INDEXED_DATABASE)
__ZN7WebCore10IDBKeyPathC1ERKN3WTF6StringE
__ZN7WebCore10IDBKeyPathC1ERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE
__ZN7WebCore18IDBDatabaseBackend14openConnectionEN3WTF10PassRefPtrINS_12IDBCallbacksEEENS2_INS_20IDBDatabaseCallbacksEEExy
__ZN7WebCore18IDBDatabaseBackend6createERKN3WTF6StringES4_PNS_26IDBFactoryBackendInterfaceERNS_19IDBServerConnectionE
__ZN7WebCore18IDBDatabaseBackendD1Ev
......
2013-11-20 Brady Eidson <beidson@apple.com>
Add more infrastructure for ServerConnection communication between Web and Database processes
https://bugs.webkit.org/show_bug.cgi?id=124693
Reviewed by Anders Carlsson.
* DatabaseProcess/DatabaseToWebProcessConnection.cpp:
(WebKit::DatabaseToWebProcessConnection::establishIDBConnection):
(WebKit::DatabaseToWebProcessConnection::removeDatabaseProcessIDBConnection): Added for WebProcess to be able
to invalidate the DatabaseProcess side of a server connection.
* DatabaseProcess/DatabaseToWebProcessConnection.h:
* DatabaseProcess/DatabaseToWebProcessConnection.messages.in:
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp:
(WebKit::DatabaseProcessIDBConnection::DatabaseProcessIDBConnection):
(WebKit::DatabaseProcessIDBConnection::disconnectedFromWebProcess): Added for future cleanup.
(WebKit::DatabaseProcessIDBConnection::establishConnection):
(WebKit::DatabaseProcessIDBConnection::getOrEstablishIDBDatabaseMetadata): Callback to the WebProcess, even if
it is just dummy data for now.
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:
(WebKit::DatabaseProcessIDBConnection::create):
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::create): Register the new object with the WebToDatabaseProcessConnection.
(WebKit::WebIDBServerConnection::~WebIDBServerConnection): Remove from the WebToDatabaseProcessConnection.
(WebKit::WebIDBServerConnection::getOrEstablishIDBDatabaseMetadata):
(WebKit::WebIDBServerConnection::didGetOrEstablishIDBDatabaseMetadata): Callback from the DatabaseProcess,
a no-op for now.
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in: Copied from Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.messages.in.
* WebProcess/Databases/WebToDatabaseProcessConnection.cpp:
(WebKit::WebToDatabaseProcessConnection::didReceiveMessage):
(WebKit::WebToDatabaseProcessConnection::didClose):
(WebKit::WebToDatabaseProcessConnection::registerWebIDBServerConnection): Hold a collection of all
server connections for messaging.
(WebKit::WebToDatabaseProcessConnection::removeWebIDBServerConnection): Remove a connection from the collection,
and also message the DatabaseProcess that it’s gone away.
* WebProcess/Databases/WebToDatabaseProcessConnection.h:
Project files, etc etc:
* DerivedSources.make:
* Scripts/webkit2/messages.py:
(struct_or_class):
* WebKit2.xcodeproj/project.pbxproj:
2013-11-18 Sam Weinig <sam@webkit.org>
WebPageGroup's should keep track of what processes they are being used by
......
......@@ -81,10 +81,19 @@ void DatabaseToWebProcessConnection::didReceiveInvalidMessage(CoreIPC::Connectio
void DatabaseToWebProcessConnection::establishIDBConnection(uint64_t serverConnectionIdentifier)
{
RefPtr<DatabaseProcessIDBConnection> connection = DatabaseProcessIDBConnection::create(serverConnectionIdentifier);
m_idbConnections.set(serverConnectionIdentifier, connection.release());
RefPtr<DatabaseProcessIDBConnection> idbConnection = DatabaseProcessIDBConnection::create(*this, serverConnectionIdentifier);
m_idbConnections.set(serverConnectionIdentifier, idbConnection.release());
}
void DatabaseToWebProcessConnection::removeDatabaseProcessIDBConnection(uint64_t serverConnectionIdentifier)
{
ASSERT(m_idbConnections.contains(serverConnectionIdentifier));
RefPtr<DatabaseProcessIDBConnection> idbConnection = m_idbConnections.take(serverConnectionIdentifier);
idbConnection->disconnectedFromWebProcess();
}
} // namespace WebKit
#endif // ENABLE(DATABASE_PROCESS)
......@@ -60,6 +60,7 @@ private:
#if ENABLE(INDEXED_DATABASE)
// Messages handlers
void establishIDBConnection(uint64_t serverConnectionIdentifier);
void removeDatabaseProcessIDBConnection(uint64_t serverConnectionIdentifier);
typedef HashMap<uint64_t, RefPtr<DatabaseProcessIDBConnection>> IDBConnectionMap;
IDBConnectionMap m_idbConnections;
......
......@@ -26,6 +26,7 @@ messages -> DatabaseToWebProcessConnection LegacyReceiver {
#if ENABLE(INDEXED_DATABASE)
# Creates a connection for communication with a WebProcess
EstablishIDBConnection(uint64_t serverConnectionIdentifier)
RemoveDatabaseProcessIDBConnection(uint64_t serverConnectionIdentifier)
#endif
}
......
......@@ -26,14 +26,20 @@
#include "config.h"
#include "DatabaseProcessIDBConnection.h"
#if ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
#include "DatabaseToWebProcessConnection.h"
#include "WebCoreArgumentCoders.h"
#include "WebIDBServerConnectionMessages.h"
#include <WebCore/IDBDatabaseMetadata.h>
#if ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
using namespace WebCore;
namespace WebKit {
DatabaseProcessIDBConnection::DatabaseProcessIDBConnection(uint64_t serverConnectionIdentifier)
: m_serverConnectionIdentifier(serverConnectionIdentifier)
DatabaseProcessIDBConnection::DatabaseProcessIDBConnection(DatabaseToWebProcessConnection& connection, uint64_t serverConnectionIdentifier)
: m_connection(connection)
, m_serverConnectionIdentifier(serverConnectionIdentifier)
{
}
......@@ -41,16 +47,30 @@ DatabaseProcessIDBConnection::~DatabaseProcessIDBConnection()
{
}
void DatabaseProcessIDBConnection::disconnectedFromWebProcess()
{
// Do any necessary cleanup work here.
}
void DatabaseProcessIDBConnection::establishConnection(const String& databaseName, const SecurityOriginData& openingOrigin, const SecurityOriginData& mainFrameOrigin)
{
// FIXME: This method is successfully called by messaging from the WebProcess.
// Now implement it.
// This method should only be called once, so the stored database name should still be null.
// Also, it is invalid to set the stored database name to the null string.
ASSERT(m_databaseName.isNull());
ASSERT(!databaseName.isNull());
m_databaseName = databaseName;
m_openingOrigin = openingOrigin;
m_mainFrameOrigin = mainFrameOrigin;
}
void DatabaseProcessIDBConnection::getOrEstablishIDBDatabaseMetadata()
{
// FIXME: This method is successfully called by messaging from the WebProcess.
// Now implement it.
// FIXME: This method is successfully called by messaging from the WebProcess, and calls back with dummy data.
// Needs real implementation.
IDBDatabaseMetadata data;
send(Messages::WebIDBServerConnection::DidGetOrEstablishIDBDatabaseMetadata(false, data));
}
CoreIPC::Connection* DatabaseProcessIDBConnection::messageSenderConnection()
......
......@@ -30,17 +30,18 @@
#if ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
#include "SecurityOriginData.h"
#include <wtf/text/WTFString.h>
namespace WebKit {
class DatabaseToWebProcessConnection;
struct SecurityOriginData;
class DatabaseProcessIDBConnection : public RefCounted<DatabaseProcessIDBConnection>, public CoreIPC::MessageSender {
public:
static RefPtr<DatabaseProcessIDBConnection> create(uint64_t serverConnectionIdentifier)
static RefPtr<DatabaseProcessIDBConnection> create(DatabaseToWebProcessConnection& connection, uint64_t serverConnectionIdentifier)
{
return adoptRef(new DatabaseProcessIDBConnection(serverConnectionIdentifier));
return adoptRef(new DatabaseProcessIDBConnection(connection, serverConnectionIdentifier));
}
virtual ~DatabaseProcessIDBConnection();
......@@ -48,8 +49,10 @@ public:
// Message handlers.
void didReceiveDatabaseProcessIDBConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&);
void disconnectedFromWebProcess();
private:
DatabaseProcessIDBConnection(uint64_t serverConnectionIdentifier);
DatabaseProcessIDBConnection(DatabaseToWebProcessConnection&, uint64_t idbConnectionIdentifier);
// CoreIPC::MessageSender
virtual CoreIPC::Connection* messageSenderConnection() OVERRIDE;
......@@ -59,8 +62,12 @@ private:
void establishConnection(const String& databaseName, const SecurityOriginData& openingOrigin, const SecurityOriginData& mainFrameOrigin);
void getOrEstablishIDBDatabaseMetadata();
RefPtr<DatabaseToWebProcessConnection> m_connection;
Ref<DatabaseToWebProcessConnection> m_connection;
uint64_t m_serverConnectionIdentifier;
String m_databaseName;
SecurityOriginData m_openingOrigin;
SecurityOriginData m_mainFrameOrigin;
};
} // namespace WebKit
......
......@@ -35,6 +35,7 @@ VPATH = \
$(WebKit2)/Shared/Network/CustomProtocols \
$(WebKit2)/WebProcess/ApplicationCache \
$(WebKit2)/WebProcess/Cookies \
$(WebKit2)/WebProcess/Databases/IndexedDB \
$(WebKit2)/WebProcess/FullScreen \
$(WebKit2)/WebProcess/Geolocation \
$(WebKit2)/WebProcess/IconDatabase \
......@@ -67,39 +68,40 @@ MESSAGE_RECEIVERS = \
DatabaseProcessIDBConnection \
DatabaseProcessProxy \
DatabaseToWebProcessConnection \
DownloadProxy \
DrawingArea \
DrawingAreaProxy \
DownloadProxy \
EventDispatcher \
NPObjectMessageReceiver \
NetworkConnectionToWebProcess \
NetworkProcess \
NetworkProcessConnection \
NetworkProcessProxy \
NetworkResourceLoader \
NPObjectMessageReceiver \
PluginControllerProxy \
PluginProcess \
PluginProcessConnection \
PluginProcessConnectionManager \
PluginProcessProxy \
PluginProxy \
StorageManager \
WebApplicationCacheManager \
WebApplicationCacheManagerProxy \
WebCookieManager \
WebCookieManagerProxy \
WebConnection \
NetworkConnectionToWebProcess \
RemoteLayerTreeHost \
SecItemShim \
SecItemShimProxy \
StorageAreaMap \
StorageManager \
WebApplicationCacheManager \
WebApplicationCacheManagerProxy \
WebConnection \
WebContext \
WebCookieManager \
WebCookieManagerProxy \
WebDatabaseManager \
WebDatabaseManagerProxy \
WebFullScreenManager \
WebFullScreenManagerProxy \
WebGeolocationManager \
WebGeolocationManagerProxy \
WebIDBServerConnection \
WebIconDatabase \
WebIconDatabaseProxy \
WebInspector \
......
......@@ -176,6 +176,7 @@ def struct_or_class(namespace, type):
'WebCore::FloatPoint3D',
'WebCore::FileChooserSettings',
'WebCore::GrammarDetail',
'WebCore::IDBDatabaseMetadata',
'WebCore::IdentityTransformOperation',
'WebCore::KeypressCommand',
'WebCore::Length',
......
......@@ -591,6 +591,8 @@
51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */; };
51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
51C96118183D294700D2002E /* WebIDBServerConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51C96116183D294700D2002E /* WebIDBServerConnectionMessageReceiver.cpp */; };
51C96119183D294700D2002E /* WebIDBServerConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C96117183D294700D2002E /* WebIDBServerConnectionMessages.h */; };
51CBBA0F165219B6005BE8FD /* NetworkResourceLoadParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CBBA0D165219B6005BE8FD /* NetworkResourceLoadParameters.cpp */; };
51CBBA10165219B6005BE8FD /* NetworkResourceLoadParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CBBA0E165219B6005BE8FD /* NetworkResourceLoadParameters.h */; };
51D02F64132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D02F63132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp */; };
......@@ -2112,6 +2114,9 @@
51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnvironmentUtilities.h; path = unix/EnvironmentUtilities.h; sourceTree = "<group>"; };
51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; };
51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
51C96115183C95FF00D2002E /* WebIDBServerConnection.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebIDBServerConnection.messages.in; sourceTree = "<group>"; };
51C96116183D294700D2002E /* WebIDBServerConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebIDBServerConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
51C96117183D294700D2002E /* WebIDBServerConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIDBServerConnectionMessages.h; sourceTree = "<group>"; };
51CBBA0D165219B6005BE8FD /* NetworkResourceLoadParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkResourceLoadParameters.cpp; path = Network/NetworkResourceLoadParameters.cpp; sourceTree = "<group>"; };
51CBBA0E165219B6005BE8FD /* NetworkResourceLoadParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkResourceLoadParameters.h; path = Network/NetworkResourceLoadParameters.h; sourceTree = "<group>"; };
51D02F63132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebIconDatabaseMessageReceiver.cpp; sourceTree = "<group>"; };
......@@ -3834,6 +3839,7 @@
51290991183ACEAF005522A6 /* WebIDBServerConnection.h */,
51E351F1180F5C7500E53BE9 /* WebIDBFactoryBackend.cpp */,
51E351F2180F5C7500E53BE9 /* WebIDBFactoryBackend.h */,
51C96115183C95FF00D2002E /* WebIDBServerConnection.messages.in */,
);
path = IndexedDB;
sourceTree = "<group>";
......@@ -5230,10 +5236,6 @@
C0CE729D1247E71D00BC0EC4 /* Derived Sources */ = {
isa = PBXGroup;
children = (
75E749E5180DBB9800088BA6 /* WebOriginDataManagerMessageReceiver.cpp */,
75E749E6180DBB9800088BA6 /* WebOriginDataManagerMessages.h */,
75E749E7180DBB9800088BA6 /* WebOriginDataManagerProxyMessageReceiver.cpp */,
75E749E8180DBB9800088BA6 /* WebOriginDataManagerProxyMessages.h */,
512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */,
512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */,
E17AE2C216B9C63A001C42F1 /* com.apple.WebKit.NetworkProcess.sb */,
......@@ -5316,6 +5318,8 @@
BC0E606012D6BA910012A72A /* WebGeolocationManagerMessages.h */,
BC0E618012D6CB1D0012A72A /* WebGeolocationManagerProxyMessageReceiver.cpp */,
BC0E618112D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h */,
51C96116183D294700D2002E /* WebIDBServerConnectionMessageReceiver.cpp */,
51C96117183D294700D2002E /* WebIDBServerConnectionMessages.h */,
51D02F63132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp */,
51D02F67132EC73700BEAA96 /* WebIconDatabaseMessages.h */,
51D02F68132EC73700BEAA96 /* WebIconDatabaseProxyMessageReceiver.cpp */,
......@@ -5330,6 +5334,10 @@
33D3A3C71339617900709BE4 /* WebMediaCacheManagerProxyMessages.h */,
31BA9248148830810062EDB5 /* WebNotificationManagerMessageReceiver.cpp */,
31BA9249148830810062EDB5 /* WebNotificationManagerMessages.h */,
75E749E5180DBB9800088BA6 /* WebOriginDataManagerMessageReceiver.cpp */,
75E749E6180DBB9800088BA6 /* WebOriginDataManagerMessages.h */,
75E749E7180DBB9800088BA6 /* WebOriginDataManagerProxyMessageReceiver.cpp */,
75E749E8180DBB9800088BA6 /* WebOriginDataManagerProxyMessages.h */,
29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */,
29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */,
C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */,
......@@ -5865,6 +5873,7 @@
BCA0EF7F12331E78007D3CFB /* WebUndoStep.h in Headers */,
1AC7537C183A9FDB0072CB15 /* PageLoadState.h in Headers */,
BCDB86C11200FB97007254BE /* WebURL.h in Headers */,
51C96119183D294700D2002E /* WebIDBServerConnectionMessages.h in Headers */,
BCE2315D122C30CA00D5C35A /* WebURLRequest.h in Headers */,
BC90A1D2122DD55E00CC8C50 /* WebURLResponse.h in Headers */,
F6113E25126CE1820057D0A7 /* WebUserContentURLPattern.h in Headers */,
......@@ -7211,6 +7220,7 @@
29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObject.mm in Sources */,
1AC7537F183BE50F0072CB15 /* DataReference.cpp in Sources */,
512E34E4130B4D0500ABD19A /* WKApplicationCacheManager.cpp in Sources */,
51C96118183D294700D2002E /* WebIDBServerConnectionMessageReceiver.cpp in Sources */,
BC4075F3124FF0270068F20A /* WKArray.cpp in Sources */,
512F58F512A88A5400629530 /* WKAuthenticationChallenge.cpp in Sources */,
51E351CA180F2CCC00E53BE9 /* IDBUtilities.cpp in Sources */,
......
......@@ -35,6 +35,7 @@
#include "WebProcess.h"
#include "WebToDatabaseProcessConnection.h"
#include <WebCore/IDBDatabaseMetadata.h>
#include <WebCore/SecurityOrigin.h>
using namespace WebCore;
......@@ -48,6 +49,13 @@ static uint64_t generateServerConnectionIdentifier()
return ++identifier;
}
PassRefPtr<WebIDBServerConnection> WebIDBServerConnection::create(const String& databaseName, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin)
{
RefPtr<WebIDBServerConnection> result = adoptRef(new WebIDBServerConnection(databaseName, openingOrigin, mainFrameOrigin));
WebProcess::shared().webToDatabaseProcessConnection()->registerWebIDBServerConnection(*result);
return result.release();
}
WebIDBServerConnection::WebIDBServerConnection(const String& databaseName, const SecurityOrigin& openingOrigin, const SecurityOrigin& mainFrameOrigin)
: m_serverConnectionIdentifier(generateServerConnectionIdentifier())
, m_databaseName(databaseName)
......@@ -60,6 +68,7 @@ WebIDBServerConnection::WebIDBServerConnection(const String& databaseName, const
WebIDBServerConnection::~WebIDBServerConnection()
{
WebProcess::shared().webToDatabaseProcessConnection()->removeWebIDBServerConnection(*this);
}
bool WebIDBServerConnection::isClosed()
......@@ -73,9 +82,15 @@ void WebIDBServerConnection::deleteDatabase(const String& name, BoolCallbackFunc
void WebIDBServerConnection::getOrEstablishIDBDatabaseMetadata(GetIDBDatabaseMetadataFunction completionCallback)
{
// FIXME: Save the completionCallback to perform this request is complete.
send(Messages::DatabaseProcessIDBConnection::GetOrEstablishIDBDatabaseMetadata());
}
void WebIDBServerConnection::didGetOrEstablishIDBDatabaseMetadata(bool, const IDBDatabaseMetadata&)
{
// FIXME: Lookup the appropriate completionCallback to perform with these results.
}
void WebIDBServerConnection::close()
{
}
......
......@@ -30,16 +30,14 @@
#if ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
#include "MessageSender.h"
#include <WebCore/IDBDatabaseMetadata.h>
#include <WebCore/IDBServerConnection.h>
namespace WebKit {
class WebIDBServerConnection FINAL : public WebCore::IDBServerConnection, public CoreIPC::MessageSender {
public:
static PassRefPtr<WebIDBServerConnection> create(const String& databaseName, const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin)
{
return adoptRef(new WebIDBServerConnection(databaseName, openingOrigin, mainFrameOrigin));
}
static PassRefPtr<WebIDBServerConnection> create(const String& databaseName, const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin);
virtual ~WebIDBServerConnection();
......@@ -81,12 +79,19 @@ public:
virtual void cursorPrefetchIteration(WebCore::IDBCursorBackend&, const WebCore::CursorPrefetchIterationOperation&, std::function<void()> completionCallback) OVERRIDE;
virtual void cursorPrefetchReset(WebCore::IDBCursorBackend&, int usedPrefetches) OVERRIDE;
// Message handlers.
void didReceiveWebIDBServerConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&);
// CoreIPC::MessageSender
virtual uint64_t messageSenderDestinationID() OVERRIDE { return m_serverConnectionIdentifier; }
private:
WebIDBServerConnection(const String& databaseName, const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin);
// CoreIPC::MessageSender
virtual CoreIPC::Connection* messageSenderConnection() OVERRIDE;
virtual uint64_t messageSenderDestinationID() OVERRIDE { return m_serverConnectionIdentifier; }
void didGetOrEstablishIDBDatabaseMetadata(bool success, const WebCore::IDBDatabaseMetadata&);
uint64_t m_serverConnectionIdentifier;
......
# 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(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
messages -> WebIDBServerConnection LegacyReceiver {
DidGetOrEstablishIDBDatabaseMetadata(bool success, WebCore::IDBDatabaseMetadata metadata)
}
#endif // ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
......@@ -28,6 +28,8 @@
#include "WebToDatabaseProcessConnection.h"
#include "DatabaseToWebProcessConnectionMessages.h"
#include "WebIDBServerConnection.h"
#include "WebIDBServerConnectionMessages.h"
#include "WebProcess.h"
#include <wtf/RunLoop.h>
......@@ -47,11 +49,19 @@ WebToDatabaseProcessConnection::~WebToDatabaseProcessConnection()
{
}
void WebToDatabaseProcessConnection::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&)
void WebToDatabaseProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder)
{
if (decoder.messageReceiverName() == Messages::WebIDBServerConnection::messageReceiverName()) {
HashMap<uint64_t, WebIDBServerConnection*>::iterator connectionIterator = m_webIDBServerConnections.find(decoder.destinationID());
if (connectionIterator != m_webIDBServerConnections.end())
connectionIterator->value->didReceiveWebIDBServerConnectionMessage(connection, decoder);
return;
}
ASSERT_NOT_REACHED();
}
void WebToDatabaseProcessConnection::didClose(CoreIPC::Connection*)
void WebToDatabaseProcessConnection::didClose(CoreIPC::Connection* connection)
{
WebProcess::shared().webToDatabaseProcessConnectionClosed(this);
}
......@@ -60,6 +70,22 @@ void WebToDatabaseProcessConnection::didReceiveInvalidMessage(CoreIPC::Connectio
{
}
void WebToDatabaseProcessConnection::registerWebIDBServerConnection(WebIDBServerConnection& connection)
{
ASSERT(!m_webIDBServerConnections.contains(connection.messageSenderDestinationID()));
m_webIDBServerConnections.set(connection.messageSenderDestinationID(), &connection);
}
void WebToDatabaseProcessConnection::removeWebIDBServerConnection(WebIDBServerConnection& connection)
{
ASSERT(m_webIDBServerConnections.contains(connection.messageSenderDestinationID()));
send(Messages::DatabaseToWebProcessConnection::RemoveDatabaseProcessIDBConnection(connection.messageSenderDestinationID()));
m_webIDBServerConnections.remove(connection.messageSenderDestinationID());
}
} // namespace WebKit
#endif // ENABLE(INDEXED_DATABASE)
......@@ -35,6 +35,7 @@
namespace WebKit {
class WebIDBServerConnection;
class WebProcessIDBDatabaseBackend;
class WebToDatabaseProcessConnection : public RefCounted<WebToDatabaseProcessConnection>, public CoreIPC::Connection::Client, public CoreIPC::MessageSender {
......@@ -47,7 +48,8 @@ public:
CoreIPC::Connection* connection() const { return m_connection.get(); }
void didReceiveNetworkProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&);
void registerWebIDBServerConnection(WebIDBServerConnection&);
void removeWebIDBServerConnection(WebIDBServerConnection&);
private:
WebToDatabaseProcessConnection(CoreIPC::Connection::Identifier);
......@@ -62,6 +64,8 @@ private:
virtual uint64_t messageSenderDestinationID() OVERRIDE { return 0; }
RefPtr<CoreIPC::Connection> m_connection;
HashMap<uint64_t, WebIDBServerConnection*> m_webIDBServerConnections;
};
} // namespace WebKit
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment