void GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult) { if (!ON_GMP_THREAD()) { // We should run this whole method on the GMP thread since the buffer needs // to be deleted after the SendDecrypted call. mPlugin->GMPMessageLoop()->PostTask( NewRunnableMethod<GMPBuffer*, GMPErr>("gmp::GMPDecryptorChild::Decrypted", this, &GMPDecryptorChild::Decrypted, aBuffer, aResult)); return; } if (!aBuffer) { NS_WARNING("GMPDecryptorCallback passed bull GMPBuffer"); return; } auto buffer = static_cast<GMPBufferImpl*>(aBuffer); if (mSession) { SendDecrypted(buffer->mId, aResult, buffer->mData); } delete buffer; }
GMPStorageChild::GMPStorageChild(GMPChild* aPlugin) : mMonitor("GMPStorageChild") , mPlugin(aPlugin) , mShutdown(false) { MOZ_ASSERT(ON_GMP_THREAD()); }
void GMPDecryptorChild::CallMethod(MethodType aMethod, ParamType&&... aParams) { MOZ_ASSERT(ON_GMP_THREAD()); // Don't send IPC messages after tear-down. if (mSession) { (this->*aMethod)(Forward<ParamType>(aParams)...); } }
void GMPDecryptorChild::CallOnGMPThread(MethodType aMethod, ParamType&&... aParams) { if (ON_GMP_THREAD()) { // Use forwarding reference when we can. CallMethod(aMethod, Forward<ParamType>(aParams)...); } else { // Use const reference when we have to. auto m = &GMPDecryptorChild::CallMethod< decltype(aMethod), typename AddConstReference<ParamType>::Type...>; auto t = NewRunnableMethod(this, m, aMethod, aParams...); mPlugin->GMPMessageLoop()->PostTask(FROM_HERE, t); } }
void GMPDecryptorChild::CallOnGMPThread(MethodType aMethod, ParamType&&... aParams) { if (ON_GMP_THREAD()) { // Use forwarding reference when we can. CallMethod(aMethod, Forward<ParamType>(aParams)...); } else { // Use const reference when we have to. auto m = &GMPDecryptorChild::CallMethod< decltype(aMethod), typename AddConstReference<ParamType>::Type...>; RefPtr<mozilla::Runnable> t = dont_add_new_uses_of_this::NewRunnableMethod(this, m, aMethod, Forward<ParamType>(aParams)...); mPlugin->GMPMessageLoop()->PostTask(t.forget()); } }
void GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult) { if (!ON_GMP_THREAD()) { // We should run this whole method on the GMP thread since the buffer needs // to be deleted after the SendDecrypted call. CALL_ON_GMP_THREAD(Decrypted, aBuffer, aResult); return; } if (!aBuffer) { NS_WARNING("GMPDecryptorCallback passed bull GMPBuffer"); return; } auto buffer = static_cast<GMPBufferImpl*>(aBuffer); SendDecrypted(buffer->mId, aResult, buffer->mData); delete buffer; }