Bug1320614 - Remove MediaKeys::mNodeId as it's only ever written and never read. r?gerald
draft
Bug1320614 - Remove MediaKeys::mNodeId as it's only ever written and never read. r?gerald
MozReview-Commit-ID: BWfrjzdfph
--- a/dom/media/eme/MediaKeys.cpp
+++ b/dom/media/eme/MediaKeys.cpp
@@ -434,23 +434,22 @@ MediaKeys::Init(ErrorResult& aRv)
NS_ConvertUTF8toUTF16(topLevelOrigin),
KeySystemToGMPName(mKeySystem),
inPrivateBrowsing);
return promise.forget();
}
void
-MediaKeys::OnCDMCreated(PromiseId aId, const nsACString& aNodeId, const uint32_t aPluginId)
+MediaKeys::OnCDMCreated(PromiseId aId, const uint32_t aPluginId)
{
RefPtr<DetailedPromise> promise(RetrievePromise(aId));
if (!promise) {
return;
}
- mNodeId = aNodeId;
RefPtr<MediaKeys> keys(this);
EME_LOG("MediaKeys[%p]::OnCDMCreated() resolve promise id=%d", this, aId);
promise->MaybeResolve(keys);
if (mCreatePromiseId == aId) {
Release();
}
MediaKeySystemAccess::NotifyObservers(mParent,
@@ -550,23 +549,16 @@ already_AddRefed<MediaKeySession>
MediaKeys::GetPendingSession(uint32_t aToken)
{
RefPtr<MediaKeySession> session;
mPendingSessions.Get(aToken, getter_AddRefs(session));
mPendingSessions.Remove(aToken);
return session.forget();
}
-const nsCString&
-MediaKeys::GetNodeId() const
-{
- MOZ_ASSERT(NS_IsMainThread());
- return mNodeId;
-}
-
bool
MediaKeys::IsBoundToMediaElement() const
{
MOZ_ASSERT(NS_IsMainThread());
return mElement != nullptr;
}
nsresult
--- a/dom/media/eme/MediaKeys.h
+++ b/dom/media/eme/MediaKeys.h
@@ -78,18 +78,17 @@ public:
already_AddRefed<MediaKeySession> GetSession(const nsAString& aSessionId);
// Removes and returns MediaKeySession from the set of sessions awaiting
// their sessionId to be assigned.
already_AddRefed<MediaKeySession> GetPendingSession(uint32_t aToken);
// Called once a Init() operation succeeds.
- void OnCDMCreated(PromiseId aId,
- const nsACString& aNodeId, const uint32_t aPluginId);
+ void OnCDMCreated(PromiseId aId, const uint32_t aPluginId);
// Called once the CDM generates a sessionId while servicing a
// MediaKeySession.generateRequest() or MediaKeySession.load() call,
// once the sessionId of a MediaKeySession is known.
void OnSessionIdReady(MediaKeySession* aSession);
// Called once a LoadSession succeeds.
void OnSessionLoaded(PromiseId aId, bool aSuccess);
@@ -115,18 +114,16 @@ public:
void ConnectPendingPromiseIdWithToken(PromiseId aId, uint32_t aToken);
// Reject promise with DOMException corresponding to aExceptionCode.
void RejectPromise(PromiseId aId, nsresult aExceptionCode,
const nsCString& aReason);
// Resolves promise with "undefined".
void ResolvePromise(PromiseId aId);
- const nsCString& GetNodeId() const;
-
void Shutdown();
// Called by CDMProxy when CDM crashes or shuts down. It is different from
// Shutdown which is called from the script/dom side.
void Terminated();
// Returns true if this MediaKeys has been bound to a media element.
bool IsBoundToMediaElement() const;
@@ -143,17 +140,16 @@ private:
// Owning ref to proxy. The proxy has a weak reference back to the MediaKeys,
// and the MediaKeys destructor clears the proxy's reference to the MediaKeys.
RefPtr<CDMProxy> mProxy;
RefPtr<HTMLMediaElement> mElement;
nsCOMPtr<nsPIDOMWindowInner> mParent;
const nsString mKeySystem;
- nsCString mNodeId;
KeySessionHashMap mKeySessions;
PromiseHashMap mPromises;
PendingKeySessionsHashMap mPendingSessions;
PromiseId mCreatePromiseId;
RefPtr<nsIPrincipal> mPrincipal;
RefPtr<nsIPrincipal> mTopLevelPrincipal;
--- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp
+++ b/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp
@@ -383,17 +383,17 @@ void
MediaDrmCDMProxy::OnCDMCreated(uint32_t aPromiseId)
{
MOZ_ASSERT(NS_IsMainThread());
if (mKeys.IsNull()) {
return;
}
if (mCDM) {
- mKeys->OnCDMCreated(aPromiseId, GetNodeId(), 0);
+ mKeys->OnCDMCreated(aPromiseId, 0);
return;
}
// No CDM? Just reject the promise.
mKeys->RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
NS_LITERAL_CSTRING("Null CDM in OnCDMCreated()"));
}
--- a/dom/media/gmp/GMPCDMProxy.cpp
+++ b/dom/media/gmp/GMPCDMProxy.cpp
@@ -269,17 +269,17 @@ void
GMPCDMProxy::OnCDMCreated(uint32_t aPromiseId)
{
MOZ_ASSERT(NS_IsMainThread());
if (mKeys.IsNull()) {
return;
}
MOZ_ASSERT(!GetNodeId().IsEmpty());
if (mCDM) {
- mKeys->OnCDMCreated(aPromiseId, GetNodeId(), mCDM->GetPluginId());
+ mKeys->OnCDMCreated(aPromiseId, mCDM->GetPluginId());
} else {
// No CDM? Just reject the promise.
mKeys->RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
NS_LITERAL_CSTRING("Null CDM in OnCDMCreated()"));
}
}
void