Bug 1221009. Part 3 - add assertions to functions that shouldn't be called after shutdown. r=roc.

This commit is contained in:
JW Wang 2015-11-16 07:51:22 +08:00
parent a99bdedf26
commit 3dbaca5456

View File

@ -476,6 +476,7 @@ void
MediaDecoder::SetInfinite(bool aInfinite)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mShuttingDown);
mInfiniteStream = aInfinite;
DurationChanged();
}
@ -872,6 +873,7 @@ nsresult
MediaDecoder::FinishDecoderSetup(MediaResource* aResource)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mShuttingDown);
HTMLMediaElement* element = mOwner->GetMediaElement();
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
element->FinishDecoderSetup(this, aResource);
@ -882,8 +884,7 @@ void
MediaDecoder::ResetConnectionState()
{
MOZ_ASSERT(NS_IsMainThread());
if (mShuttingDown)
return;
MOZ_ASSERT(!mShuttingDown);
// Notify the media element that connection gets lost.
mOwner->ResetConnectionState();
@ -1027,9 +1028,7 @@ void
MediaDecoder::NotifySuspendedStatusChanged()
{
MOZ_ASSERT(NS_IsMainThread());
if (mShuttingDown) {
return;
}
MOZ_ASSERT(!mShuttingDown);
if (mResource) {
bool suspended = mResource->IsSuspendedByCache();
mOwner->NotifySuspendedByCache(suspended);
@ -1051,10 +1050,7 @@ void
MediaDecoder::NotifyDownloadEnded(nsresult aStatus)
{
MOZ_ASSERT(NS_IsMainThread());
if (mShuttingDown) {
return;
}
MOZ_ASSERT(!mShuttingDown);
DECODER_LOG("NotifyDownloadEnded, status=%x", aStatus);
@ -1080,9 +1076,7 @@ void
MediaDecoder::NotifyPrincipalChanged()
{
MOZ_ASSERT(NS_IsMainThread());
if (mShuttingDown) {
return;
}
MOZ_ASSERT(!mShuttingDown);
mOwner->NotifyDecoderPrincipalChanged();
}
@ -1090,8 +1084,9 @@ void
MediaDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mShuttingDown);
if (mShuttingDown || mIgnoreProgressData) {
if (mIgnoreProgressData) {
return;
}