Bug 1430673 - Remove CDMProxy::GetSessionIdsForKeyId(). r=JamesCheng
authorChris Pearce <cpearce@mozilla.com>
Tue, 16 Jan 2018 11:38:27 +1300
changeset 451172 79ffd285b6daa1c9ab23085fced8fb3d4ff344c7
parent 451171 8a743132915dbdfaf28999e34633c9dbf09ea322
child 451173 ac65c3229adea0862ee6a6742814d9b9a0aca511
push id8543
push userryanvm@gmail.com
push dateTue, 16 Jan 2018 14:33:22 +0000
treeherdermozilla-beta@a6525ed16a32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamesCheng
bugs1430673
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1430673 - Remove CDMProxy::GetSessionIdsForKeyId(). r=JamesCheng MozReview-Commit-ID: EMT8BaHE2Pf
dom/media/MediaData.h
dom/media/eme/CDMCaps.cpp
dom/media/eme/CDMCaps.h
dom/media/eme/CDMProxy.h
dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp
dom/media/eme/mediadrm/MediaDrmCDMProxy.h
dom/media/gmp/ChromiumCDMProxy.cpp
dom/media/gmp/ChromiumCDMProxy.h
dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
--- a/dom/media/MediaData.h
+++ b/dom/media/MediaData.h
@@ -585,17 +585,16 @@ public:
 };
 
 class CryptoSample : public CryptoTrack
 {
 public:
   nsTArray<uint16_t> mPlainSizes;
   nsTArray<uint32_t> mEncryptedSizes;
   nsTArray<uint8_t> mIV;
-  nsTArray<nsCString> mSessionIds;
   nsTArray<nsTArray<uint8_t>> mInitDatas;
   nsString mInitDataType;
 };
 
 // MediaRawData is a MediaData container used to store demuxed, still compressed
 // samples.
 // Use MediaRawData::CreateWriter() to obtain a MediaRawDataWriter object that
 // provides methods to modify and manipulate the data.
--- a/dom/media/eme/CDMCaps.cpp
+++ b/dom/media/eme/CDMCaps.cpp
@@ -108,27 +108,16 @@ CDMCaps::GetKeyStatusesForSession(const 
 {
   for (const KeyStatus& keyStatus : mKeyStatuses) {
     if (keyStatus.mSessionId.Equals(aSessionId)) {
       aOutKeyStatuses.AppendElement(keyStatus);
     }
   }
 }
 
-void
-CDMCaps::GetSessionIdsForKeyId(const CencKeyId& aKeyId,
-                               nsTArray<nsCString>& aOutSessionIds)
-{
-  for (const KeyStatus& keyStatus : mKeyStatuses) {
-    if (keyStatus.mId == aKeyId) {
-      aOutSessionIds.AppendElement(NS_ConvertUTF16toUTF8(keyStatus.mSessionId));
-    }
-  }
-}
-
 bool
 CDMCaps::RemoveKeysForSession(const nsString& aSessionId)
 {
   bool changed = false;
   nsTArray<KeyStatus> statuses;
   GetKeyStatusesForSession(aSessionId, statuses);
   for (const KeyStatus& status : statuses) {
     changed |= SetKeyStatus(status.mId,
--- a/dom/media/eme/CDMCaps.h
+++ b/dom/media/eme/CDMCaps.h
@@ -55,19 +55,16 @@ public:
   // i.e. the key status changed from usable to expired.
   bool SetKeyStatus(const CencKeyId& aKeyId,
                     const nsString& aSessionId,
                     const dom::Optional<dom::MediaKeyStatus>& aStatus);
 
   void GetKeyStatusesForSession(const nsAString& aSessionId,
                                 nsTArray<KeyStatus>& aOutKeyStatuses);
 
-  void GetSessionIdsForKeyId(const CencKeyId& aKeyId,
-                             nsTArray<nsCString>& aOutSessionIds);
-
   // Ensures all keys for a session are marked as 'unknown', i.e. removed.
   // Returns true if a key status was changed.
   bool RemoveKeysForSession(const nsString& aSessionId);
 
   // Notifies the SamplesWaitingForKey when key become usable.
   void NotifyWhenKeyIdUsable(const CencKeyId& aKey,
                              SamplesWaitingForKey* aSamplesWaiting);
 
--- a/dom/media/eme/CDMProxy.h
+++ b/dom/media/eme/CDMProxy.h
@@ -219,19 +219,16 @@ public:
   // Threadsafe.
   virtual const nsString& KeySystem() const = 0;
 
   virtual DataMutex<CDMCaps>& Capabilites() = 0;
 
   // Main thread only.
   virtual void OnKeyStatusesChange(const nsAString& aSessionId) = 0;
 
-  virtual void GetSessionIdsForKeyId(const nsTArray<uint8_t>& aKeyId,
-                                     nsTArray<nsCString>& aSessionIds) = 0;
-
   // Main thread only.
   // Calls MediaKeys->ResolvePromiseWithKeyStatus(aPromiseId, aKeyStatus) after
   // the CDM has processed the request.
   virtual void GetStatusForPolicy(PromiseId aPromiseId,
                                   const nsAString& aMinHdcpVersion) = 0;
 
 #ifdef DEBUG
   virtual bool IsOnOwnerThread() = 0;
--- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp
+++ b/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp
@@ -360,24 +360,16 @@ MediaDrmCDMProxy::OnKeyStatusesChange(co
   }
   RefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
   if (session) {
     session->DispatchKeyStatusesChange();
   }
 }
 
 void
-MediaDrmCDMProxy::GetSessionIdsForKeyId(const nsTArray<uint8_t>& aKeyId,
-                                      nsTArray<nsCString>& aSessionIds)
-{
-  auto caps = Capabilites().Lock();
-  caps->GetSessionIdsForKeyId(aKeyId, aSessionIds);
-}
-
-void
 MediaDrmCDMProxy::GetStatusForPolicy(PromiseId aPromiseId,
                                      const nsAString& aMinHdcpVersion)
 {
   // TODO: Implement GetStatusForPolicy.
   RejectPromise(aPromiseId, NS_ERROR_DOM_NOT_SUPPORTED_ERR,
                 NS_LITERAL_CSTRING("Currently Fennec does not support GetStatusForPolicy"));
 }
 
--- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.h
+++ b/dom/media/eme/mediadrm/MediaDrmCDMProxy.h
@@ -107,19 +107,16 @@ public:
 
   // Threadsafe.
   const nsString& KeySystem() const override;
 
   DataMutex<CDMCaps>& Capabilites() override;
 
   void OnKeyStatusesChange(const nsAString& aSessionId) override;
 
-  void GetSessionIdsForKeyId(const nsTArray<uint8_t>& aKeyId,
-                             nsTArray<nsCString>& aSessionIds) override;
-
   void GetStatusForPolicy(PromiseId aPromiseId,
                           const nsAString& aMinHdcpVersion) override;
 
 #ifdef DEBUG
   bool IsOnOwnerThread() override;
 #endif
 
   const nsString& GetMediaDrmStubId() const;
--- a/dom/media/gmp/ChromiumCDMProxy.cpp
+++ b/dom/media/gmp/ChromiumCDMProxy.cpp
@@ -597,24 +597,16 @@ ChromiumCDMProxy::Decrypt(MediaRawData* 
                                            __func__);
   }
   RefPtr<MediaRawData> sample = aSample;
   return InvokeAsync(
     mGMPThread, __func__, [cdm, sample]() { return cdm->Decrypt(sample); });
 }
 
 void
-ChromiumCDMProxy::GetSessionIdsForKeyId(const nsTArray<uint8_t>& aKeyId,
-                                        nsTArray<nsCString>& aSessionIds)
-{
-  auto caps = Capabilites().Lock();
-  caps->GetSessionIdsForKeyId(aKeyId, aSessionIds);
-}
-
-void
 ChromiumCDMProxy::GetStatusForPolicy(PromiseId aPromiseId,
                                      const nsAString& aMinHdcpVersion)
 {
   MOZ_ASSERT(NS_IsMainThread());
   EME_LOG("ChromiumCDMProxy::GetStatusForPolicy(pid=%u) minHdcpVersion=%s",
           aPromiseId,
           NS_ConvertUTF16toUTF8(aMinHdcpVersion).get());
 
--- a/dom/media/gmp/ChromiumCDMProxy.h
+++ b/dom/media/gmp/ChromiumCDMProxy.h
@@ -97,19 +97,16 @@ public:
   void ResolvePromise(PromiseId aId) override;
 
   const nsString& KeySystem() const override;
 
   DataMutex<CDMCaps>& Capabilites() override;
 
   void OnKeyStatusesChange(const nsAString& aSessionId) override;
 
-  void GetSessionIdsForKeyId(const nsTArray<uint8_t>& aKeyId,
-                             nsTArray<nsCString>& aSessionIds) override;
-
   void GetStatusForPolicy(PromiseId aPromiseId,
                           const nsAString& aMinHdcpVersion) override;
 
 #ifdef DEBUG
   bool IsOnOwnerThread() override;
 #endif
 
   ChromiumCDMProxy* AsChromiumCDMProxy() override { return this; }
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -93,20 +93,16 @@ public:
   {
     MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
     if (mIsShutdown) {
       NS_WARNING("EME encrypted sample arrived after shutdown");
       mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
       return;
     }
 
-    nsAutoPtr<MediaRawDataWriter> writer(aSample->CreateWriter());
-    mProxy->GetSessionIdsForKeyId(aSample->mCrypto.mKeyId,
-                                  writer->mCrypto.mSessionIds);
-
     mDecrypts.Put(aSample, new DecryptPromiseRequestHolder());
     mProxy->Decrypt(aSample)
       ->Then(mTaskQueue, __func__, this,
             &EMEDecryptor::Decrypted,
             &EMEDecryptor::Decrypted)
       ->Track(*mDecrypts.Get(aSample));
   }
 
@@ -271,19 +267,16 @@ EMEMediaDataDecoderProxy::Decode(MediaRa
   RefPtr<DecodePromise> p = mDecodePromise.Ensure(__func__);
 
   RefPtr<EMEMediaDataDecoderProxy> self = this;
   mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)
     ->Then(mTaskQueue, __func__,
            [self, this](RefPtr<MediaRawData> aSample) {
              mKeyRequest.Complete();
 
-             nsAutoPtr<MediaRawDataWriter> writer(aSample->CreateWriter());
-             mProxy->GetSessionIdsForKeyId(aSample->mCrypto.mKeyId,
-                                           writer->mCrypto.mSessionIds);
              MediaDataDecoderProxy::Decode(aSample)
                ->Then(mTaskQueue, __func__,
                       [self, this](const DecodedData& aResults) {
                         mDecodeRequest.Complete();
                         mDecodePromise.Resolve(aResults, __func__);
                       },
                       [self, this](const MediaResult& aError) {
                         mDecodeRequest.Complete();