From ea73ebebc85c3516d4afab71d456c88655f64da0 Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Fri, 21 Oct 2016 10:52:26 +1300 Subject: [PATCH] Bug 1311848 - Don't call ConnectPendingPromiseIdWithToken in MediaKeySession::Load. r=kikuo We don't need to call MediaKeys::ConnectPendingPromiseIdWithToken() on the MediaKeySession::Load() path, we already know the session Id, and we've already removed the session from the list of pending sessions in Load(). MozReview-Commit-ID: KBiEsY95Csi --HG-- extra : rebase_source : aadc3204409df35e4bbcb9532c530f860681afd1 --- dom/media/eme/MediaKeySession.cpp | 1 - dom/media/eme/MediaKeys.cpp | 3 +-- dom/media/eme/MediaKeys.h | 8 +++++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dom/media/eme/MediaKeySession.cpp b/dom/media/eme/MediaKeySession.cpp index c81f416ed6d7..e9e4b6620c7b 100644 --- a/dom/media/eme/MediaKeySession.cpp +++ b/dom/media/eme/MediaKeySession.cpp @@ -405,7 +405,6 @@ MediaKeySession::Load(const nsAString& aSessionId, ErrorResult& aRv) SetSessionId(aSessionId); PromiseId pid = mKeys->StorePromise(promise); - mKeys->ConnectPendingPromiseIdWithToken(pid, Token()); mKeys->GetCDMProxy()->LoadSession(pid, aSessionId); EME_LOG("MediaKeySession[%p,'%s'] Load() sent to CDM, promiseId=%d", diff --git a/dom/media/eme/MediaKeys.cpp b/dom/media/eme/MediaKeys.cpp index 4a5d997f5ded..11dd67aba8e5 100644 --- a/dom/media/eme/MediaKeys.cpp +++ b/dom/media/eme/MediaKeys.cpp @@ -199,8 +199,7 @@ MediaKeys::StorePromise(DetailedPromise* aPromise) void MediaKeys::ConnectPendingPromiseIdWithToken(PromiseId aId, uint32_t aToken) { - // Should only be called from MediaKeySession::GenerateRequest and - // MediaKeySession::Load. + // Should only be called from MediaKeySession::GenerateRequest. mPromiseIdToken.Put(aId, aToken); EME_LOG("MediaKeys[%p]::ConnectPendingPromiseIdWithToken() id=%u => token(%u)", this, aId, aToken); diff --git a/dom/media/eme/MediaKeys.h b/dom/media/eme/MediaKeys.h index 07f3abd35f2b..93fc11df086c 100644 --- a/dom/media/eme/MediaKeys.h +++ b/dom/media/eme/MediaKeys.h @@ -108,9 +108,11 @@ public: // promises to be resolved. PromiseId StorePromise(DetailedPromise* aPromise); - // Stores a map for promise id and session token, and it will be used to - // remove the pending sessions by promise id while creating/loading various - // sessions in the same time. + // Stores a map from promise id to pending session token. Using this + // mapping, when a promise is rejected via its ID, we can check if the + // promise corresponds to a pending session and retrieve that session + // via the mapped-to token, and remove the pending session from the + // list of sessions awaiting a session id. void ConnectPendingPromiseIdWithToken(PromiseId aId, uint32_t aToken); // Reject promise with DOMException corresponding to aExceptionCode.