Bug 1398659. P4 - remove unused code and add some assertions. r=gerald

MozReview-Commit-ID: LRgF9qjdMXz

--HG--
extra : rebase_source : af8b8bb4272c9be0f0ab8b51356362e9676c7076
extra : intermediate-source : 640d38acf9d3cf4aa583c67fc20ea487c849a570
extra : source : 0faec6a6b214ce4d5ca59ac2b098d4a5bfe4470b
This commit is contained in:
JW Wang 2017-09-05 17:39:57 +08:00
Родитель be83fdf7b4
Коммит 6dcbfcbee7
4 изменённых файлов: 13 добавлений и 32 удалений

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

@ -226,16 +226,6 @@ ChannelMediaDecoder::Shutdown()
}
}
nsresult
ChannelMediaDecoder::OpenResource(nsIStreamListener** aStreamListener)
{
MOZ_ASSERT(NS_IsMainThread());
if (aStreamListener) {
*aStreamListener = nullptr;
}
return mResource->Open(aStreamListener);
}
nsresult
ChannelMediaDecoder::Load(nsIChannel* aChannel,
bool aIsPrivateBrowsing,
@ -243,6 +233,7 @@ ChannelMediaDecoder::Load(nsIChannel* aChannel,
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mResource);
MOZ_ASSERT(aStreamListener);
mResource =
BaseMediaResource::Create(mResourceCallback, aChannel, aIsPrivateBrowsing);
@ -255,7 +246,7 @@ ChannelMediaDecoder::Load(nsIChannel* aChannel,
return rv;
}
rv = OpenResource(aStreamListener);
rv = mResource->Open(aStreamListener);
NS_ENSURE_SUCCESS(rv, rv);
// Set mode to METADATA since we are about to read metadata.

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

@ -93,7 +93,6 @@ private:
// Create a new state machine to run this decoder.
MediaDecoderStateMachine* CreateStateMachine();
nsresult OpenResource(nsIStreamListener** aStreamListener);
nsresult Load(BaseMediaResource* aOriginal);
// Called by MediaResource when the download has ended.

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

@ -2536,10 +2536,7 @@ nsresult
MediaCacheStream::Init(int64_t aContentLength)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
if (mMediaCache) {
return NS_OK;
}
MOZ_ASSERT(!mMediaCache, "Has been initialized.");
if (aContentLength > 0) {
uint32_t length = uint32_t(std::min(aContentLength, int64_t(UINT32_MAX)));

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

@ -515,33 +515,27 @@ ChannelMediaResource::OnDataAvailable(nsIRequest* aRequest,
return NS_OK;
}
nsresult ChannelMediaResource::Open(nsIStreamListener **aStreamListener)
nsresult
ChannelMediaResource::Open(nsIStreamListener** aStreamListener)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
MOZ_ASSERT(aStreamListener);
MOZ_ASSERT(mChannel);
int64_t cl = -1;
if (mChannel) {
nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(mChannel);
if (hc && !IsPayloadCompressed(hc)) {
if (NS_FAILED(hc->GetContentLength(&cl))) {
cl = -1;
}
nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(mChannel);
if (hc && !IsPayloadCompressed(hc)) {
if (NS_FAILED(hc->GetContentLength(&cl))) {
cl = -1;
}
}
nsresult rv = mCacheStream.Init(cl);
if (NS_FAILED(rv))
if (NS_FAILED(rv)) {
return rv;
NS_ASSERTION(mOffset == 0, "Who set mOffset already?");
if (!mChannel) {
// When we're a clone, the decoder might ask us to Open even though
// we haven't established an mChannel (because we might not need one)
NS_ASSERTION(!aStreamListener,
"Should have already been given a channel if we're to return a stream listener");
return NS_OK;
}
MOZ_ASSERT(mOffset == 0, "Who set mOffset already?");
return OpenChannel(aStreamListener);
}