mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Backed out changeset 9e9727bdc484 (bug 1306314)
This commit is contained in:
parent
891306a89a
commit
d9a1a0a083
@ -98,8 +98,6 @@ public:
|
||||
const nsAString& aName,
|
||||
bool aInPrivateBrowsing) = 0;
|
||||
|
||||
virtual void OnSetDecryptorId(uint32_t aId) {}
|
||||
|
||||
// Main thread only.
|
||||
// Uses the CDM to create a key session.
|
||||
// Calls MediaKeys::OnSessionActivated() when session is created.
|
||||
@ -221,8 +219,6 @@ public:
|
||||
virtual bool IsOnOwnerThread() = 0;
|
||||
#endif
|
||||
|
||||
virtual uint32_t GetDecryptorId() { return 0; }
|
||||
|
||||
protected:
|
||||
virtual ~CDMProxy() {}
|
||||
|
||||
|
@ -15,8 +15,6 @@ public:
|
||||
|
||||
virtual ~DecryptorProxyCallback() {}
|
||||
|
||||
virtual void SetDecryptorId(uint32_t aId) = 0;
|
||||
|
||||
virtual void SetSessionId(uint32_t aCreateSessionId,
|
||||
const nsCString& aSessionId) = 0;
|
||||
|
||||
|
@ -17,9 +17,6 @@ class CDMProxy;
|
||||
// We used annotation calledFrom = "gecko" to ensure running on main thread.
|
||||
class MediaDrmCDMCallbackProxy : public DecryptorProxyCallback {
|
||||
public:
|
||||
|
||||
void SetDecryptorId(uint32_t aId) override {}
|
||||
|
||||
void SetSessionId(uint32_t aCreateSessionToken,
|
||||
const nsCString& aSessionId) override;
|
||||
|
||||
|
@ -21,19 +21,6 @@ GMPCDMCallbackProxy::GMPCDMCallbackProxy(CDMProxy* aProxy)
|
||||
: mProxy(aProxy)
|
||||
{}
|
||||
|
||||
void
|
||||
GMPCDMCallbackProxy::SetDecryptorId(uint32_t aId)
|
||||
{
|
||||
MOZ_ASSERT(mProxy->IsOnOwnerThread());
|
||||
|
||||
RefPtr<CDMProxy> proxy = mProxy;
|
||||
NS_DispatchToMainThread(
|
||||
NS_NewRunnableFunction([proxy, aId] ()
|
||||
{
|
||||
proxy->OnSetDecryptorId(aId);
|
||||
})
|
||||
);}
|
||||
|
||||
void
|
||||
GMPCDMCallbackProxy::SetSessionId(uint32_t aToken,
|
||||
const nsCString& aSessionId)
|
||||
|
@ -17,9 +17,6 @@ namespace mozilla {
|
||||
// object on the main thread.
|
||||
class GMPCDMCallbackProxy : public GMPDecryptorProxyCallback {
|
||||
public:
|
||||
|
||||
void SetDecryptorId(uint32_t aId) override;
|
||||
|
||||
void SetSessionId(uint32_t aCreateSessionToken,
|
||||
const nsCString& aSessionId) override;
|
||||
|
||||
|
@ -38,8 +38,6 @@ GMPCDMProxy::GMPCDMProxy(dom::MediaKeys* aKeys,
|
||||
, mCDM(nullptr)
|
||||
, mDecryptionJobCount(0)
|
||||
, mShutdownCalled(false)
|
||||
, mDecryptorId(0)
|
||||
, mCreatePromiseId(0)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_COUNT_CTOR(GMPCDMProxy);
|
||||
@ -133,19 +131,10 @@ GMPCDMProxy::gmp_InitDone(GMPDecryptorProxy* aCDM, nsAutoPtr<InitData>&& aData)
|
||||
mCDM->Init(mCallback,
|
||||
mDistinctiveIdentifierRequired,
|
||||
mPersistentStateRequired);
|
||||
|
||||
// Await the OnSetDecryptorId callback.
|
||||
mCreatePromiseId = aData->mPromiseId;
|
||||
}
|
||||
|
||||
void GMPCDMProxy::OnSetDecryptorId(uint32_t aId)
|
||||
{
|
||||
MOZ_ASSERT(mCreatePromiseId);
|
||||
mDecryptorId = aId;
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NewRunnableMethod<uint32_t>(this,
|
||||
&GMPCDMProxy::OnCDMCreated,
|
||||
mCreatePromiseId));
|
||||
aData->mPromiseId));
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
|
||||
@ -779,21 +768,9 @@ GMPCDMProxy::Terminated()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_WARNING("CDM terminated");
|
||||
if (mCreatePromiseId) {
|
||||
RejectPromise(mCreatePromiseId,
|
||||
NS_ERROR_DOM_MEDIA_FATAL_ERR,
|
||||
NS_LITERAL_CSTRING("Crashed waiting for CDM to initialize"));
|
||||
mCreatePromiseId = 0;
|
||||
}
|
||||
if (!mKeys.IsNull()) {
|
||||
mKeys->Terminated();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GMPCDMProxy::GetDecryptorId()
|
||||
{
|
||||
return mDecryptorId;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -34,8 +34,6 @@ public:
|
||||
const nsAString& aGMPName,
|
||||
bool aInPrivateBrowsing) override;
|
||||
|
||||
void OnSetDecryptorId(uint32_t aId) override;
|
||||
|
||||
void CreateSession(uint32_t aCreateSessionToken,
|
||||
dom::MediaKeySessionType aSessionType,
|
||||
PromiseId aPromiseId,
|
||||
@ -111,8 +109,6 @@ public:
|
||||
bool IsOnOwnerThread() override;
|
||||
#endif
|
||||
|
||||
uint32_t GetDecryptorId() override;
|
||||
|
||||
private:
|
||||
friend class gmp_InitDoneCallback;
|
||||
friend class gmp_InitGetGMPDecryptorCallback;
|
||||
@ -254,10 +250,6 @@ private:
|
||||
// True if GMPCDMProxy::gmp_Shutdown was called.
|
||||
// GMP thread only.
|
||||
bool mShutdownCalled;
|
||||
|
||||
uint32_t mDecryptorId;
|
||||
|
||||
PromiseId mCreatePromiseId;
|
||||
};
|
||||
|
||||
|
||||
|
@ -53,12 +53,12 @@ namespace mozilla {
|
||||
class GMPCrashHelperHolder
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
void SetCrashHelper(GMPCrashHelper* aHelper)
|
||||
{
|
||||
mCrashHelper = aHelper;
|
||||
}
|
||||
|
||||
|
||||
GMPCrashHelper* GetCrashHelper()
|
||||
{
|
||||
return mCrashHelper;
|
||||
|
@ -73,11 +73,6 @@ GMPDecryptorChild::Init(GMPDecryptor* aSession)
|
||||
{
|
||||
MOZ_ASSERT(aSession);
|
||||
mSession = aSession;
|
||||
// The ID of this decryptor is the IPDL actor ID. Note it's unique inside
|
||||
// the child process, but not necessarily across all gecko processes. However,
|
||||
// since GMPDecryptors are segregated by node ID/origin, we shouldn't end up
|
||||
// with clashes in the content process.
|
||||
SendSetDecryptorId(Id());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -40,17 +40,6 @@ GMPDecryptorParent::~GMPDecryptorParent()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
GMPDecryptorParent::RecvSetDecryptorId(const uint32_t& aId)
|
||||
{
|
||||
if (!mIsOpen) {
|
||||
NS_WARNING("Trying to use a dead GMP decrypter!");
|
||||
return false;
|
||||
}
|
||||
mCallback->SetDecryptorId(aId);
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
GMPDecryptorParent::Init(GMPDecryptorProxyCallback* aCallback,
|
||||
bool aDistinctiveIdentifierRequired,
|
||||
|
@ -72,8 +72,6 @@ private:
|
||||
|
||||
// PGMPDecryptorParent
|
||||
|
||||
bool RecvSetDecryptorId(const uint32_t& aId) override;
|
||||
|
||||
bool RecvSetSessionId(const uint32_t& aCreateSessionToken,
|
||||
const nsCString& aSessionId) override;
|
||||
|
||||
|
@ -53,8 +53,6 @@ child:
|
||||
parent:
|
||||
async __delete__();
|
||||
|
||||
async SetDecryptorId(uint32_t aId);
|
||||
|
||||
async SetSessionId(uint32_t aCreateSessionToken,
|
||||
nsCString aSessionId);
|
||||
|
||||
|
@ -596,8 +596,9 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
class CreateDecryptorDone : public GetGMPDecryptorCallback
|
||||
{
|
||||
public:
|
||||
CreateDecryptorDone(GMPStorageTest* aRunner)
|
||||
: mRunner(aRunner)
|
||||
CreateDecryptorDone(GMPStorageTest* aRunner, nsIRunnable* aContinuation)
|
||||
: mRunner(aRunner),
|
||||
mContinuation(aContinuation)
|
||||
{
|
||||
}
|
||||
|
||||
@ -609,10 +610,13 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
if (mRunner->mDecryptor) {
|
||||
mRunner->mDecryptor->Init(mRunner, false, true);
|
||||
}
|
||||
nsCOMPtr<nsIThread> thread(GetGMPThread());
|
||||
thread->Dispatch(mContinuation, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<GMPStorageTest> mRunner;
|
||||
nsCOMPtr<nsIRunnable> mContinuation;
|
||||
};
|
||||
|
||||
void CreateDecryptor(const nsCString& aNodeId,
|
||||
@ -675,13 +679,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
tags.AppendElement(NS_LITERAL_CSTRING("fake"));
|
||||
|
||||
UniquePtr<GetGMPDecryptorCallback> callback(
|
||||
new CreateDecryptorDone(this));
|
||||
|
||||
// Continue after the OnSetDecryptorId message, so that we don't
|
||||
// get warnings in the async shutdown tests due to receiving the
|
||||
// SetDecryptorId message after we've started shutdown.
|
||||
mSetDecryptorIdContinuation = aContinuation;
|
||||
|
||||
new CreateDecryptorDone(this, aContinuation));
|
||||
nsresult rv =
|
||||
service->GetGMPDecryptor(nullptr, &tags, mNodeId, Move(callback));
|
||||
EXPECT_TRUE(NS_SUCCEEDED(rv));
|
||||
@ -1375,16 +1373,6 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
}
|
||||
}
|
||||
|
||||
void SetDecryptorId(uint32_t aId) override
|
||||
{
|
||||
if (!mSetDecryptorIdContinuation) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIThread> thread(GetGMPThread());
|
||||
thread->Dispatch(mSetDecryptorIdContinuation, NS_DISPATCH_NORMAL);
|
||||
mSetDecryptorIdContinuation = nullptr;
|
||||
}
|
||||
|
||||
void SetSessionId(uint32_t aCreateSessionToken,
|
||||
const nsCString& aSessionId) override { }
|
||||
void ResolveLoadSessionPromise(uint32_t aPromiseId,
|
||||
@ -1428,8 +1416,6 @@ private:
|
||||
|
||||
nsTArray<ExpectedMessage> mExpected;
|
||||
|
||||
RefPtr<nsIRunnable> mSetDecryptorIdContinuation;
|
||||
|
||||
GMPDecryptorProxy* mDecryptor;
|
||||
Monitor mMonitor;
|
||||
Atomic<bool> mFinished;
|
||||
|
Loading…
Reference in New Issue
Block a user