зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1413484 - tighten some assertions. r=gerald
mCallback->GetMediaOwner() now is always called before Close() and won't return null. So is owner->GetMediaElement(). MozReview-Commit-ID: HbxbyuogYAB --HG-- extra : rebase_source : 28e6ccf104fea9dba9885974f77e19535de84f54 extra : intermediate-source : 15cfa511119ce07e3ede692dc8b14ae177dd388a extra : source : 9ce161facd920a0efeaf8260ea75f13f1679b24e
This commit is contained in:
Родитель
53d3eb8a74
Коммит
bba58a54de
|
@ -165,9 +165,10 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest,
|
|||
MOZ_DIAGNOSTIC_ASSERT(!mClosed);
|
||||
|
||||
MediaDecoderOwner* owner = mCallback->GetMediaOwner();
|
||||
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(owner);
|
||||
dom::HTMLMediaElement* element = owner->GetMediaElement();
|
||||
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(element);
|
||||
|
||||
nsresult status;
|
||||
nsresult rv = aRequest->GetStatus(&status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -522,8 +523,9 @@ ChannelMediaResource::OpenChannel(int64_t aOffset)
|
|||
|
||||
// Tell the media element that we are fetching data from a channel.
|
||||
MediaDecoderOwner* owner = mCallback->GetMediaOwner();
|
||||
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(owner);
|
||||
dom::HTMLMediaElement* element = owner->GetMediaElement();
|
||||
MOZ_DIAGNOSTIC_ASSERT(element);
|
||||
element->DownloadResumed();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -532,6 +534,7 @@ ChannelMediaResource::OpenChannel(int64_t aOffset)
|
|||
nsresult
|
||||
ChannelMediaResource::SetupChannelHeaders(int64_t aOffset)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mClosed);
|
||||
|
||||
// Always use a byte range request even if we're reading from the start
|
||||
|
@ -548,11 +551,10 @@ ChannelMediaResource::SetupChannelHeaders(int64_t aOffset)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Send Accept header for video and audio types only (Bug 489071)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
|
||||
MediaDecoderOwner* owner = mCallback->GetMediaOwner();
|
||||
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(owner);
|
||||
dom::HTMLMediaElement* element = owner->GetMediaElement();
|
||||
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
|
||||
MOZ_DIAGNOSTIC_ASSERT(element);
|
||||
element->SetRequestHeaders(hc);
|
||||
} else {
|
||||
NS_ASSERTION(aOffset == 0, "Don't know how to seek on this channel type");
|
||||
|
@ -682,15 +684,9 @@ ChannelMediaResource::Suspend(bool aCloseImmediately)
|
|||
}
|
||||
|
||||
MediaDecoderOwner* owner = mCallback->GetMediaOwner();
|
||||
if (!owner) {
|
||||
// Shutting down; do nothing.
|
||||
return;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(owner);
|
||||
dom::HTMLMediaElement* element = owner->GetMediaElement();
|
||||
if (!element) {
|
||||
// Shutting down; do nothing.
|
||||
return;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(element);
|
||||
|
||||
if (mChannel && aCloseImmediately && mCacheStream.IsTransportSeekable()) {
|
||||
CloseChannel();
|
||||
|
@ -716,15 +712,9 @@ ChannelMediaResource::Resume()
|
|||
}
|
||||
|
||||
MediaDecoderOwner* owner = mCallback->GetMediaOwner();
|
||||
if (!owner) {
|
||||
// Shutting down; do nothing.
|
||||
return;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(owner);
|
||||
dom::HTMLMediaElement* element = owner->GetMediaElement();
|
||||
if (!element) {
|
||||
// Shutting down; do nothing.
|
||||
return;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(element);
|
||||
|
||||
if (mSuspendAgent.Resume()) {
|
||||
if (mChannel) {
|
||||
|
@ -768,15 +758,10 @@ ChannelMediaResource::RecreateChannel()
|
|||
(mLoadInBackground ? nsIRequest::LOAD_BACKGROUND : 0);
|
||||
|
||||
MediaDecoderOwner* owner = mCallback->GetMediaOwner();
|
||||
if (!owner) {
|
||||
// The decoder is being shut down, so don't bother opening a new channel
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(owner);
|
||||
dom::HTMLMediaElement* element = owner->GetMediaElement();
|
||||
if (!element) {
|
||||
// The decoder is being shut down, so don't bother opening a new channel
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(element);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = element->GetDocumentLoadGroup();
|
||||
NS_ENSURE_TRUE(loadGroup, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче