WebToDatabaseProcessConnection.h [plain text]
#ifndef WebToDatabaseProcessConnection_h
#define WebToDatabaseProcessConnection_h
#include "Connection.h"
#include "MessageSender.h"
#include "WebIDBConnectionToServer.h"
#include <WebCore/SessionID.h>
#include <wtf/RefCounted.h>
#if ENABLE(DATABASE_PROCESS)
namespace WebCore {
class SessionID;
}
namespace WebKit {
class WebToDatabaseProcessConnection : public RefCounted<WebToDatabaseProcessConnection>, public IPC::Connection::Client, public IPC::MessageSender {
public:
static Ref<WebToDatabaseProcessConnection> create(IPC::Connection::Identifier connectionIdentifier)
{
return adoptRef(*new WebToDatabaseProcessConnection(connectionIdentifier));
}
~WebToDatabaseProcessConnection();
IPC::Connection& connection() { return m_connection.get(); }
#if ENABLE(INDEXED_DATABASE)
WebIDBConnectionToServer& idbConnectionToServerForSession(const WebCore::SessionID&);
#endif
private:
WebToDatabaseProcessConnection(IPC::Connection::Identifier);
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
void didClose(IPC::Connection&) override;
void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override;
IPC::Connection* messageSenderConnection() override { return m_connection.ptr(); }
uint64_t messageSenderDestinationID() override { return 0; }
Ref<IPC::Connection> m_connection;
#if ENABLE(INDEXED_DATABASE)
HashMap<WebCore::SessionID, RefPtr<WebIDBConnectionToServer>> m_webIDBConnectionsBySession;
HashMap<uint64_t, RefPtr<WebIDBConnectionToServer>> m_webIDBConnectionsByIdentifier;
#endif
};
}
#endif // ENABLE(DATABASE_PROCESS)
#endif // WebToDatabaseProcessConnection_h