Bug 1303922-[Part2] Remove KeyStatusChanged/ForgetKeyStatus IPDL messages.
MozReview-Commit-ID: Flx2SQI7lM0
--- a/dom/media/eme/DecryptorProxyCallback.h
+++ b/dom/media/eme/DecryptorProxyCallback.h
@@ -36,23 +36,16 @@ public:
virtual void SessionClosed(const nsCString& aSessionId) = 0;
virtual void SessionError(const nsCString& aSessionId,
nsresult aException,
uint32_t aSystemCode,
const nsCString& aMessage) = 0;
- virtual void KeyStatusChanged(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId,
- mozilla::dom::MediaKeyStatus aStatus) = 0;
-
- virtual void ForgetKeyStatus(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId) = 0;
-
virtual void Decrypted(uint32_t aId,
mozilla::DecryptStatus aResult,
const nsTArray<uint8_t>& aDecryptedData) = 0;
virtual void BatchedKeyStatusChanged(const nsCString& aSessionId,
const nsTArray<mozilla::CDMKeyInfo>& aKeyInfos) = 0;
};
--- a/dom/media/gmp/GMPCDMCallbackProxy.cpp
+++ b/dom/media/gmp/GMPCDMCallbackProxy.cpp
@@ -275,68 +275,24 @@ GMPCDMCallbackProxy::SessionError(const
aSessionId,
aException,
aSystemCode,
aMessage);
NS_DispatchToMainThread(task);
}
void
-GMPCDMCallbackProxy::KeyStatusChanged(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId,
- dom::MediaKeyStatus aStatus)
-{
- MOZ_ASSERT(mProxy->IsOnOwnerThread());
-
- KeyStatusChangedInternal(aSessionId,
- aKeyId,
- dom::Optional<dom::MediaKeyStatus>(aStatus));
-}
-
-void
GMPCDMCallbackProxy::BatchedKeyStatusChanged(const nsCString& aSessionId,
const nsTArray<CDMKeyInfo>& aKeyInfos)
{
MOZ_ASSERT(mProxy->IsOnOwnerThread());
BatchedKeyStatusChangedInternal(aSessionId, aKeyInfos);
}
void
-GMPCDMCallbackProxy::ForgetKeyStatus(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId)
-{
- MOZ_ASSERT(mProxy->IsOnOwnerThread());
-
- KeyStatusChangedInternal(aSessionId,
- aKeyId,
- dom::Optional<dom::MediaKeyStatus>());
-}
-
-void
-GMPCDMCallbackProxy::KeyStatusChangedInternal(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId,
- const dom::Optional<dom::MediaKeyStatus>& aStatus)
-{
- bool keyStatusesChange = false;
- {
- CDMCaps::AutoLock caps(mProxy->Capabilites());
- keyStatusesChange = caps.SetKeyStatus(aKeyId,
- NS_ConvertUTF8toUTF16(aSessionId),
- aStatus);
- }
- if (keyStatusesChange) {
- nsCOMPtr<nsIRunnable> task;
- task = NewRunnableMethod<nsString>(mProxy,
- &CDMProxy::OnKeyStatusesChange,
- NS_ConvertUTF8toUTF16(aSessionId));
- NS_DispatchToMainThread(task);
- }
-}
-
-void
GMPCDMCallbackProxy::BatchedKeyStatusChangedInternal(const nsCString& aSessionId,
const nsTArray<CDMKeyInfo>& aKeyInfos)
{
bool keyStatusesChange = false;
{
CDMCaps::AutoLock caps(mProxy->Capabilites());
for (size_t i = 0; i < aKeyInfos.Length(); i++) {
keyStatusesChange |=
--- a/dom/media/gmp/GMPCDMCallbackProxy.h
+++ b/dom/media/gmp/GMPCDMCallbackProxy.h
@@ -38,40 +38,30 @@ public:
void SessionClosed(const nsCString& aSessionId) override;
void SessionError(const nsCString& aSessionId,
nsresult aException,
uint32_t aSystemCode,
const nsCString& aMessage) override;
- void KeyStatusChanged(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId,
- dom::MediaKeyStatus aStatus) override;
-
- void ForgetKeyStatus(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId) override;
-
void Decrypted(uint32_t aId,
DecryptStatus aResult,
const nsTArray<uint8_t>& aDecryptedData) override;
void BatchedKeyStatusChanged(const nsCString& aSessionId,
const nsTArray<CDMKeyInfo>& aKeyInfos) override;
void Terminated() override;
~GMPCDMCallbackProxy() {}
private:
friend class GMPCDMProxy;
explicit GMPCDMCallbackProxy(CDMProxy* aProxy);
- void KeyStatusChangedInternal(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId,
- const dom::Optional<dom::MediaKeyStatus>& aStatus);
void BatchedKeyStatusChangedInternal(const nsCString& aSessionId,
const nsTArray<CDMKeyInfo>& aKeyInfos);
// Warning: Weak ref.
CDMProxy* mProxy;
};
} // namespace mozilla
--- a/dom/media/gmp/GMPDecryptorChild.cpp
+++ b/dom/media/gmp/GMPDecryptorChild.cpp
@@ -156,26 +156,22 @@ void
GMPDecryptorChild::KeyStatusChanged(const char* aSessionId,
uint32_t aSessionIdLength,
const uint8_t* aKeyId,
uint32_t aKeyIdLength,
GMPMediaKeyStatus aStatus)
{
AutoTArray<uint8_t, 16> kid;
kid.AppendElements(aKeyId, aKeyIdLength);
- if (aStatus == kGMPUnknown) {
- CALL_ON_GMP_THREAD(SendForgetKeyStatus,
- nsCString(aSessionId, aSessionIdLength),
- kid);
- } else {
- CALL_ON_GMP_THREAD(SendKeyStatusChanged,
- nsCString(aSessionId, aSessionIdLength),
- kid,
- aStatus);
- }
+
+ nsTArray<GMPKeyInformation> keyInfos;
+ keyInfos.AppendElement(GMPKeyInformation(kid, aStatus));
+ CALL_ON_GMP_THREAD(SendBatchedKeyStatusChanged,
+ nsCString(aSessionId, aSessionIdLength),
+ keyInfos);
}
void
GMPDecryptorChild::BatchedKeyStatusChanged(const char* aSessionId,
uint32_t aSessionIdLength,
const GMPMediaKeyInfo* aKeyInfos,
uint32_t aKeyInfosLength)
{
--- a/dom/media/gmp/GMPDecryptorParent.cpp
+++ b/dom/media/gmp/GMPDecryptorParent.cpp
@@ -353,52 +353,27 @@ ToMediaKeyStatus(GMPMediaKeyStatus aStat
case kGMPInternalError: return dom::MediaKeyStatus::Internal_error;
case kGMPReleased: return dom::MediaKeyStatus::Released;
case kGMPStatusPending: return dom::MediaKeyStatus::Status_pending;
default: return dom::MediaKeyStatus::Internal_error;
}
}
bool
-GMPDecryptorParent::RecvKeyStatusChanged(const nsCString& aSessionId,
- InfallibleTArray<uint8_t>&& aKeyId,
- const GMPMediaKeyStatus& aStatus)
-{
- LOGD(("GMPDecryptorParent[%p]::RecvKeyStatusChanged(sessionId='%s', keyId=%s, status=%d)",
- this, aSessionId.get(), ToBase64(aKeyId).get(), aStatus));
-
- if (mIsOpen) {
- mCallback->KeyStatusChanged(aSessionId, aKeyId, ToMediaKeyStatus(aStatus));
- }
- return true;
-}
-
-bool
-GMPDecryptorParent::RecvForgetKeyStatus(const nsCString& aSessionId,
- InfallibleTArray<uint8_t>&& aKeyId)
-{
- LOGD(("GMPDecryptorParent[%p]::RecvForgetKeyStatus(sessionId='%s', keyId=%s)",
- this, aSessionId.get(), ToBase64(aKeyId).get()));
-
- if (mIsOpen) {
- mCallback->ForgetKeyStatus(aSessionId, aKeyId);
- }
- return true;
-}
-
-bool
GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
InfallibleTArray<GMPKeyInformation>&& aKeyInfos)
{
LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(sessionId='%s', KeyInfos len='%d')",
this, aSessionId.get(), aKeyInfos.Length()));
if (mIsOpen) {
nsTArray<CDMKeyInfo> cdmKeyInfos(aKeyInfos.Length());
for (uint32_t i = 0; i < aKeyInfos.Length(); i++) {
+ LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(keyId=%s, gmp-status=%d)",
+ this, ToBase64(aKeyInfos[i].keyId()).get(), aKeyInfos[i].status()));
// If the status is kGMPUnknown, we're going to forget(remove) that key info.
if (aKeyInfos[i].status() != kGMPUnknown) {
auto status = ToMediaKeyStatus(aKeyInfos[i].status());
cdmKeyInfos.AppendElement(CDMKeyInfo(aKeyInfos[i].keyId(),
dom::Optional<dom::MediaKeyStatus>(status)));
} else {
cdmKeyInfos.AppendElement(CDMKeyInfo(aKeyInfos[i].keyId()));
}
--- a/dom/media/gmp/GMPDecryptorParent.h
+++ b/dom/media/gmp/GMPDecryptorParent.h
@@ -93,23 +93,16 @@ private:
bool RecvSessionClosed(const nsCString& aSessionId) override;
bool RecvSessionError(const nsCString& aSessionId,
const GMPDOMException& aException,
const uint32_t& aSystemCode,
const nsCString& aMessage) override;
- bool RecvKeyStatusChanged(const nsCString& aSessionId,
- InfallibleTArray<uint8_t>&& aKeyId,
- const GMPMediaKeyStatus& aStatus) override;
-
- bool RecvForgetKeyStatus(const nsCString& aSessionId,
- InfallibleTArray<uint8_t>&& aKeyId) override;
-
bool RecvDecrypted(const uint32_t& aId,
const GMPErr& aErr,
InfallibleTArray<uint8_t>&& aBuffer) override;
bool RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
InfallibleTArray<GMPKeyInformation>&& aKeyInfos) override;
bool RecvShutdown() override;
--- a/dom/media/gmp/PGMPDecryptor.ipdl
+++ b/dom/media/gmp/PGMPDecryptor.ipdl
@@ -73,21 +73,16 @@ parent:
async SessionClosed(nsCString aSessionId);
async SessionError(nsCString aSessionId,
GMPDOMException aDOMExceptionCode,
uint32_t aSystemCode,
nsCString aMessage);
- async KeyStatusChanged(nsCString aSessionId, uint8_t[] aKey,
- GMPMediaKeyStatus aStatus);
-
- async ForgetKeyStatus(nsCString aSessionId, uint8_t[] aKey);
-
async Decrypted(uint32_t aId, GMPErr aResult, uint8_t[] aBuffer);
async Shutdown();
async BatchedKeyStatusChanged(nsCString aSessionId,
GMPKeyInformation[] aKeyInfos);
};
--- a/dom/media/gtest/TestGMPCrossOrigin.cpp
+++ b/dom/media/gtest/TestGMPCrossOrigin.cpp
@@ -1383,23 +1383,16 @@ class GMPStorageTest : public GMPDecrypt
const nsCString& aSessionId) override { }
void ExpirationChange(const nsCString& aSessionId,
UnixTime aExpiryTime) override {}
void SessionClosed(const nsCString& aSessionId) override {}
void SessionError(const nsCString& aSessionId,
nsresult aException,
uint32_t aSystemCode,
const nsCString& aMessage) override {}
- void KeyStatusChanged(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId,
- mozilla::dom::MediaKeyStatus aStatus) override { }
-
- void ForgetKeyStatus(const nsCString& aSessionId,
- const nsTArray<uint8_t>& aKeyId) override { }
-
void Decrypted(uint32_t aId,
mozilla::DecryptStatus aResult,
const nsTArray<uint8_t>& aDecryptedData) override { }
void BatchedKeyStatusChanged(const nsCString& aSessionId,
const nsTArray<CDMKeyInfo>& aKeyInfos) override { }
void Terminated() override {