From 55bf555b747ff80b61f4acb25bbc268ffe4dd30d Mon Sep 17 00:00:00 2001 From: Kilik Kuo Date: Tue, 4 Oct 2016 17:19:53 +0800 Subject: [PATCH] Bug 1303922 - Part 2: Remove KeyStatusChanged/ForgetKeyStatus IPDL messages. r=cpearce MozReview-Commit-ID: Flx2SQI7lM0 --HG-- extra : transplant_source : %40p%5C%C3%06%D0m%0C/%7B%0C%5B%A2%93o%F6%A1%1B%00%7D --- dom/media/eme/DecryptorProxyCallback.h | 7 ---- dom/media/gmp/GMPCDMCallbackProxy.cpp | 44 -------------------------- dom/media/gmp/GMPCDMCallbackProxy.h | 10 ------ dom/media/gmp/GMPDecryptorChild.cpp | 16 ++++------ dom/media/gmp/GMPDecryptorParent.cpp | 29 ++--------------- dom/media/gmp/GMPDecryptorParent.h | 7 ---- dom/media/gmp/PGMPDecryptor.ipdl | 5 --- dom/media/gtest/TestGMPCrossOrigin.cpp | 7 ---- 8 files changed, 8 insertions(+), 117 deletions(-) diff --git a/dom/media/eme/DecryptorProxyCallback.h b/dom/media/eme/DecryptorProxyCallback.h index e88c6c4134ff..46b3f391cfb0 100644 --- a/dom/media/eme/DecryptorProxyCallback.h +++ b/dom/media/eme/DecryptorProxyCallback.h @@ -41,13 +41,6 @@ public: uint32_t aSystemCode, const nsCString& aMessage) = 0; - virtual void KeyStatusChanged(const nsCString& aSessionId, - const nsTArray& aKeyId, - mozilla::dom::MediaKeyStatus aStatus) = 0; - - virtual void ForgetKeyStatus(const nsCString& aSessionId, - const nsTArray& aKeyId) = 0; - virtual void Decrypted(uint32_t aId, mozilla::DecryptStatus aResult, const nsTArray& aDecryptedData) = 0; diff --git a/dom/media/gmp/GMPCDMCallbackProxy.cpp b/dom/media/gmp/GMPCDMCallbackProxy.cpp index 4945b0ec3501..6b3baac0ff0d 100644 --- a/dom/media/gmp/GMPCDMCallbackProxy.cpp +++ b/dom/media/gmp/GMPCDMCallbackProxy.cpp @@ -279,18 +279,6 @@ GMPCDMCallbackProxy::SessionError(const nsCString& aSessionId, NS_DispatchToMainThread(task); } -void -GMPCDMCallbackProxy::KeyStatusChanged(const nsCString& aSessionId, - const nsTArray& aKeyId, - dom::MediaKeyStatus aStatus) -{ - MOZ_ASSERT(mProxy->IsOnOwnerThread()); - - KeyStatusChangedInternal(aSessionId, - aKeyId, - dom::Optional(aStatus)); -} - void GMPCDMCallbackProxy::BatchedKeyStatusChanged(const nsCString& aSessionId, const nsTArray& aKeyInfos) @@ -299,38 +287,6 @@ GMPCDMCallbackProxy::BatchedKeyStatusChanged(const nsCString& aSessionId, BatchedKeyStatusChangedInternal(aSessionId, aKeyInfos); } -void -GMPCDMCallbackProxy::ForgetKeyStatus(const nsCString& aSessionId, - const nsTArray& aKeyId) -{ - MOZ_ASSERT(mProxy->IsOnOwnerThread()); - - KeyStatusChangedInternal(aSessionId, - aKeyId, - dom::Optional()); -} - -void -GMPCDMCallbackProxy::KeyStatusChangedInternal(const nsCString& aSessionId, - const nsTArray& aKeyId, - const dom::Optional& aStatus) -{ - bool keyStatusesChange = false; - { - CDMCaps::AutoLock caps(mProxy->Capabilites()); - keyStatusesChange = caps.SetKeyStatus(aKeyId, - NS_ConvertUTF8toUTF16(aSessionId), - aStatus); - } - if (keyStatusesChange) { - nsCOMPtr task; - task = NewRunnableMethod(mProxy, - &CDMProxy::OnKeyStatusesChange, - NS_ConvertUTF8toUTF16(aSessionId)); - NS_DispatchToMainThread(task); - } -} - void GMPCDMCallbackProxy::BatchedKeyStatusChangedInternal(const nsCString& aSessionId, const nsTArray& aKeyInfos) diff --git a/dom/media/gmp/GMPCDMCallbackProxy.h b/dom/media/gmp/GMPCDMCallbackProxy.h index 1589f264e4c2..c8ca1aece7c6 100644 --- a/dom/media/gmp/GMPCDMCallbackProxy.h +++ b/dom/media/gmp/GMPCDMCallbackProxy.h @@ -43,13 +43,6 @@ public: uint32_t aSystemCode, const nsCString& aMessage) override; - void KeyStatusChanged(const nsCString& aSessionId, - const nsTArray& aKeyId, - dom::MediaKeyStatus aStatus) override; - - void ForgetKeyStatus(const nsCString& aSessionId, - const nsTArray& aKeyId) override; - void Decrypted(uint32_t aId, DecryptStatus aResult, const nsTArray& aDecryptedData) override; @@ -64,9 +57,6 @@ public: private: friend class GMPCDMProxy; explicit GMPCDMCallbackProxy(CDMProxy* aProxy); - void KeyStatusChangedInternal(const nsCString& aSessionId, - const nsTArray& aKeyId, - const dom::Optional& aStatus); void BatchedKeyStatusChangedInternal(const nsCString& aSessionId, const nsTArray& aKeyInfos); diff --git a/dom/media/gmp/GMPDecryptorChild.cpp b/dom/media/gmp/GMPDecryptorChild.cpp index 18c80d5048c3..a1b561ab594b 100644 --- a/dom/media/gmp/GMPDecryptorChild.cpp +++ b/dom/media/gmp/GMPDecryptorChild.cpp @@ -161,16 +161,12 @@ GMPDecryptorChild::KeyStatusChanged(const char* aSessionId, { AutoTArray 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 keyInfos; + keyInfos.AppendElement(GMPKeyInformation(kid, aStatus)); + CALL_ON_GMP_THREAD(SendBatchedKeyStatusChanged, + nsCString(aSessionId, aSessionIdLength), + keyInfos); } void diff --git a/dom/media/gmp/GMPDecryptorParent.cpp b/dom/media/gmp/GMPDecryptorParent.cpp index 45c977d835ca..d9e25d952f05 100644 --- a/dom/media/gmp/GMPDecryptorParent.cpp +++ b/dom/media/gmp/GMPDecryptorParent.cpp @@ -357,33 +357,6 @@ ToMediaKeyStatus(GMPMediaKeyStatus aStatus) { } } -bool -GMPDecryptorParent::RecvKeyStatusChanged(const nsCString& aSessionId, - InfallibleTArray&& 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&& 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&& aKeyInfos) @@ -394,6 +367,8 @@ GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId, if (mIsOpen) { nsTArray 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()); diff --git a/dom/media/gmp/GMPDecryptorParent.h b/dom/media/gmp/GMPDecryptorParent.h index d0e10015b50b..3acf7dbd96b4 100644 --- a/dom/media/gmp/GMPDecryptorParent.h +++ b/dom/media/gmp/GMPDecryptorParent.h @@ -98,13 +98,6 @@ private: const uint32_t& aSystemCode, const nsCString& aMessage) override; - bool RecvKeyStatusChanged(const nsCString& aSessionId, - InfallibleTArray&& aKeyId, - const GMPMediaKeyStatus& aStatus) override; - - bool RecvForgetKeyStatus(const nsCString& aSessionId, - InfallibleTArray&& aKeyId) override; - bool RecvDecrypted(const uint32_t& aId, const GMPErr& aErr, InfallibleTArray&& aBuffer) override; diff --git a/dom/media/gmp/PGMPDecryptor.ipdl b/dom/media/gmp/PGMPDecryptor.ipdl index 98e01b1c3cb0..207933e8a638 100644 --- a/dom/media/gmp/PGMPDecryptor.ipdl +++ b/dom/media/gmp/PGMPDecryptor.ipdl @@ -78,11 +78,6 @@ parent: 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(); diff --git a/dom/media/gtest/TestGMPCrossOrigin.cpp b/dom/media/gtest/TestGMPCrossOrigin.cpp index c13302a15ac8..a2b477af308f 100644 --- a/dom/media/gtest/TestGMPCrossOrigin.cpp +++ b/dom/media/gtest/TestGMPCrossOrigin.cpp @@ -1388,13 +1388,6 @@ class GMPStorageTest : public GMPDecryptorProxyCallback nsresult aException, uint32_t aSystemCode, const nsCString& aMessage) override {} - void KeyStatusChanged(const nsCString& aSessionId, - const nsTArray& aKeyId, - mozilla::dom::MediaKeyStatus aStatus) override { } - - void ForgetKeyStatus(const nsCString& aSessionId, - const nsTArray& aKeyId) override { } - void Decrypted(uint32_t aId, mozilla::DecryptStatus aResult, const nsTArray& aDecryptedData) override { }