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
This commit is contained in:
Kilik Kuo 2016-10-04 17:19:53 +08:00
parent 4d162fcd4a
commit 55bf555b74
8 changed files with 8 additions and 117 deletions

View File

@ -41,13 +41,6 @@ public:
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;

View File

@ -279,18 +279,6 @@ GMPCDMCallbackProxy::SessionError(const nsCString& aSessionId,
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)
@ -299,38 +287,6 @@ GMPCDMCallbackProxy::BatchedKeyStatusChanged(const nsCString& aSessionId,
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)

View File

@ -43,13 +43,6 @@ public:
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;
@ -64,9 +57,6 @@ public:
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);

View File

@ -161,16 +161,12 @@ GMPDecryptorChild::KeyStatusChanged(const char* aSessionId,
{
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

View File

@ -357,33 +357,6 @@ ToMediaKeyStatus(GMPMediaKeyStatus aStatus) {
}
}
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)
@ -394,6 +367,8 @@ GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
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());

View File

@ -98,13 +98,6 @@ private:
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;

View File

@ -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();

View File

@ -1388,13 +1388,6 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
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 { }