NetworkProcessConnection.h [plain text]
#ifndef NetworkProcessConnection_h
#define NetworkProcessConnection_h
#include "Connection.h"
#include "ShareableResource.h"
#include "WebIDBConnectionToServer.h"
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
namespace IPC {
class DataReference;
}
namespace PAL {
class SessionID;
}
namespace WebCore {
class ResourceError;
class ResourceRequest;
class ResourceResponse;
}
namespace WebKit {
class WebSWClientConnection;
typedef uint64_t ResourceLoadIdentifier;
class NetworkProcessConnection : public RefCounted<NetworkProcessConnection>, IPC::Connection::Client {
public:
static Ref<NetworkProcessConnection> create(IPC::Connection::Identifier connectionIdentifier)
{
return adoptRef(*new NetworkProcessConnection(connectionIdentifier));
}
~NetworkProcessConnection();
IPC::Connection& connection() { return m_connection.get(); }
void didReceiveNetworkProcessConnectionMessage(IPC::Connection&, IPC::Decoder&);
void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&&);
#if ENABLE(INDEXED_DATABASE)
WebIDBConnectionToServer* existingIDBConnectionToServerForIdentifier(uint64_t identifier) const { return m_webIDBConnectionsByIdentifier.get(identifier); };
WebIDBConnectionToServer& idbConnectionToServerForSession(PAL::SessionID);
#endif
#if ENABLE(SERVICE_WORKER)
WebSWClientConnection* existingServiceWorkerConnectionForSession(PAL::SessionID sessionID) { return m_swConnectionsBySession.get(sessionID); }
WebSWClientConnection& serviceWorkerConnectionForSession(PAL::SessionID);
#endif
private:
NetworkProcessConnection(IPC::Connection::Identifier);
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
void didClose(IPC::Connection&) override;
void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override;
void didFinishPingLoad(uint64_t pingLoadIdentifier, WebCore::ResourceError&&, WebCore::ResourceResponse&&);
void didFinishPreconnection(uint64_t preconnectionIdentifier, WebCore::ResourceError&&);
void setOnLineState(bool isOnLine);
#if ENABLE(SHAREABLE_RESOURCE)
void didCacheResource(const WebCore::ResourceRequest&, const ShareableResource::Handle&, PAL::SessionID);
#endif
Ref<IPC::Connection> m_connection;
#if ENABLE(INDEXED_DATABASE)
HashMap<PAL::SessionID, RefPtr<WebIDBConnectionToServer>> m_webIDBConnectionsBySession;
HashMap<uint64_t, RefPtr<WebIDBConnectionToServer>> m_webIDBConnectionsByIdentifier;
#endif
#if ENABLE(SERVICE_WORKER)
HashMap<PAL::SessionID, RefPtr<WebSWClientConnection>> m_swConnectionsBySession;
HashMap<WebCore::SWServerConnectionIdentifier, WebSWClientConnection*> m_swConnectionsByIdentifier;
#endif
};
}
#endif // NetworkProcessConnection_h