MessagePortChannelRegistry.h [plain text]
#pragma once
#include "MessagePortChannel.h"
#include "MessagePortChannelProvider.h"
#include "MessagePortIdentifier.h"
#include "Process.h"
#include <wtf/HashMap.h>
namespace WebCore {
class MessagePortChannelRegistry {
public:
WEBCORE_EXPORT MessagePortChannelRegistry(MessagePortChannelProvider&);
WEBCORE_EXPORT ~MessagePortChannelRegistry();
WEBCORE_EXPORT void didCreateMessagePortChannel(const MessagePortIdentifier& port1, const MessagePortIdentifier& port2);
WEBCORE_EXPORT void didEntangleLocalToRemote(const MessagePortIdentifier& local, const MessagePortIdentifier& remote, ProcessIdentifier);
WEBCORE_EXPORT void didDisentangleMessagePort(const MessagePortIdentifier& local);
WEBCORE_EXPORT void didCloseMessagePort(const MessagePortIdentifier& local);
WEBCORE_EXPORT bool didPostMessageToRemote(MessageWithMessagePorts&&, const MessagePortIdentifier& remoteTarget);
WEBCORE_EXPORT void takeAllMessagesForPort(const MessagePortIdentifier&, Function<void(Vector<MessageWithMessagePorts>&&, Function<void()>&&)>&&);
WEBCORE_EXPORT void checkRemotePortForActivity(const MessagePortIdentifier& remoteTarget, CompletionHandler<void(MessagePortChannelProvider::HasActivity)>&& callback);
WEBCORE_EXPORT MessagePortChannel* existingChannelContainingPort(const MessagePortIdentifier&);
WEBCORE_EXPORT void messagePortChannelCreated(MessagePortChannel&);
WEBCORE_EXPORT void messagePortChannelDestroyed(MessagePortChannel&);
MessagePortChannelProvider& provider() { return m_provider; }
private:
HashMap<MessagePortIdentifier, MessagePortChannel*> m_openChannels;
MessagePortChannelProvider& m_provider;
};
}