Bug 1111508 - cache GMP thread so we can access it after mPlugin is reset by GMPDecryptorParent. r=cpearce

This commit is contained in:
JW Wang 2014-12-15 19:32:00 +01:00
Родитель ca3367650b
Коммит 5205c31de0
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -16,8 +16,11 @@ GMPDecryptorParent::GMPDecryptorParent(GMPParent* aPlugin)
, mShuttingDown(false)
, mPlugin(aPlugin)
, mCallback(nullptr)
#ifdef DEBUG
, mGMPThread(aPlugin->GMPThread())
#endif
{
MOZ_ASSERT(mPlugin);
MOZ_ASSERT(mPlugin && mGMPThread);
}
GMPDecryptorParent::~GMPDecryptorParent()
@ -312,7 +315,7 @@ GMPDecryptorParent::RecvDecrypted(const uint32_t& aId,
void
GMPDecryptorParent::Close()
{
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
// Consumer is done with us; we can shut down. No more callbacks should
// be made to mCallback. Note: do this before Shutdown()!
mCallback = nullptr;
@ -320,14 +323,14 @@ GMPDecryptorParent::Close()
// In case this is the last reference
nsRefPtr<GMPDecryptorParent> kungfudeathgrip(this);
NS_RELEASE(kungfudeathgrip);
this->Release();
Shutdown();
}
void
GMPDecryptorParent::Shutdown()
{
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
if (mShuttingDown) {
return;

Просмотреть файл

@ -109,6 +109,9 @@ private:
bool mShuttingDown;
nsRefPtr<GMPParent> mPlugin;
GMPDecryptorProxyCallback* mCallback;
#ifdef DEBUG
nsIThread* const mGMPThread;
#endif
};
} // namespace gmp