when determining progress for a cache entry, use the content length

for the cache entry as the total max progress. This change gives us more accurate progress for loading
entries from the cache for http.
This commit is contained in:
mscott%netscape.com 2000-04-25 01:52:24 +00:00
Родитель 7204673fc7
Коммит af345b89b5
2 изменённых файлов: 13 добавлений и 3 удалений

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

@ -136,7 +136,11 @@ nsHTTPCacheListener::OnStartRequest(nsIChannel *aChannel,
nsISupports *aContext)
{
PR_LOG (gHTTPLog, PR_LOG_DEBUG, ("nsHTTPCacheListener::OnStartRequest [this=%x]\n", this));
mBodyBytesReceived = 0;
// get and store the content length which will be used in ODA for computing
// progress information.
aChannel->GetContentLength(&mContentLength);
return mResponseDataListener->OnStartRequest(mChannel, aContext);
}
@ -183,13 +187,16 @@ nsHTTPCacheListener::OnDataAvailable(nsIChannel *aChannel,
aCount);
if (NS_FAILED(rv)) return rv;
mBodyBytesReceived += aCount;
// Report progress
if (mChannel->mProgressEventSink) {
rv = mChannel->mProgressEventSink->OnProgress(mChannel,
mChannel->mResponseContext,
aSourceOffset, aCount);
if (NS_FAILED(rv)) return rv;
mBodyBytesReceived, mContentLength);
}
return rv;
}

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

@ -147,6 +147,9 @@ public:
virtual nsresult FireSingleOnData(nsIStreamListener *aListener,
nsISupports *aContext);
virtual nsresult Abort();
protected:
PRInt32 mBodyBytesReceived;
PRInt32 mContentLength;
};
/*