RemoteLegacyCDMSessionProxy.h [plain text]
#pragma once
#include "MessageReceiver.h"
#include "RemoteLegacyCDMFactoryProxy.h"
#include "RemoteLegacyCDMSessionIdentifier.h"
#include <WebCore/LegacyCDMSession.h>
#include <wtf/Forward.h>
#include <wtf/UniqueRef.h>
#if ENABLE(GPU_PROCESS) && ENABLE(LEGACY_ENCRYPTED_MEDIA)
namespace WebCore {
class LegacyCDM;
class LegacyCDMSession;
class SharedBuffer;
}
namespace IPC {
class SharedBufferCopy;
}
namespace WebKit {
class RemoteLegacyCDMProxy;
class RemoteMediaPlayerProxy;
class RemoteLegacyCDMSessionProxy
: private IPC::MessageReceiver
, public WebCore::LegacyCDMSessionClient
, public CanMakeWeakPtr<RemoteLegacyCDMSessionProxy> {
public:
static std::unique_ptr<RemoteLegacyCDMSessionProxy> create(WeakPtr<RemoteLegacyCDMFactoryProxy>&&, RemoteLegacyCDMSessionIdentifier, WebCore::LegacyCDM&);
~RemoteLegacyCDMSessionProxy();
RemoteLegacyCDMFactoryProxy* factory() const { return m_factory.get(); }
WebCore::LegacyCDMSession* session() const { return m_session.get(); }
void setPlayer(WeakPtr<RemoteMediaPlayerProxy> player) { m_player = WTFMove(player); }
RefPtr<ArrayBuffer> getCachedKeyForKeyId(const String&);
private:
friend class RemoteLegacyCDMFactoryProxy;
RemoteLegacyCDMSessionProxy(WeakPtr<RemoteLegacyCDMFactoryProxy>&&, RemoteLegacyCDMSessionIdentifier, WebCore::LegacyCDM&);
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) final;
void sendMessage(Uint8Array*, String destinationURL) final;
void sendError(MediaKeyErrorCode, uint32_t systemCode) final;
String mediaKeysStorageDirectory() const final;
using GenerateKeyCallback = CompletionHandler<void(Optional<IPC::SharedBufferCopy>&&, const String&, unsigned short, uint32_t)>;
void generateKeyRequest(const String& mimeType, IPC::SharedBufferCopy&& initData, GenerateKeyCallback&&);
void releaseKeys();
using UpdateCallback = CompletionHandler<void(bool, Optional<IPC::SharedBufferCopy>&&, unsigned short, uint32_t)>;
void update(IPC::SharedBufferCopy&& update, UpdateCallback&&);
using CachedKeyForKeyIDCallback = CompletionHandler<void(Optional<IPC::SharedBufferCopy>&&)>;
void cachedKeyForKeyID(String keyId, CachedKeyForKeyIDCallback&&);
WeakPtr<RemoteLegacyCDMFactoryProxy> m_factory;
RemoteLegacyCDMSessionIdentifier m_identifier;
std::unique_ptr<WebCore::LegacyCDMSession> m_session;
WeakPtr<RemoteMediaPlayerProxy> m_player;
};
}
#endif