зеркало из https://github.com/mozilla/gecko-dev.git
Bug 746018 - Part 3 - Do more logging in nsInputStreamWrapper, r=jduell
This commit is contained in:
Родитель
9ed64256d8
Коммит
0499d869d8
|
@ -540,6 +540,11 @@ nsInputStreamWrapper::LazyInit()
|
|||
rv = nsCacheService::OpenInputStreamForEntry(cacheEntry, mode,
|
||||
mStartOffset,
|
||||
getter_AddRefs(mInput));
|
||||
|
||||
CACHE_LOG_DEBUG(("nsInputStreamWrapper::LazyInit "
|
||||
"[entry=%p, wrapper=%p, mInput=%p, rv=%d",
|
||||
mDescriptor, this, mInput.get(), PRIntn(rv)));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mInitialized = true;
|
||||
|
|
|
@ -108,11 +108,25 @@ nsDiskCacheInputStream::Read(char * buffer, PRUint32 count, PRUint32 * bytesRead
|
|||
{
|
||||
*bytesRead = 0;
|
||||
|
||||
if (mClosed)
|
||||
if (mClosed) {
|
||||
CACHE_LOG_DEBUG(("CACHE: nsDiskCacheInputStream::Read "
|
||||
"[stream=%p] stream was closed",
|
||||
this, buffer, count));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mPos == mStreamEnd) return NS_OK;
|
||||
if (mPos > mStreamEnd) return NS_ERROR_UNEXPECTED;
|
||||
if (mPos == mStreamEnd) {
|
||||
CACHE_LOG_DEBUG(("CACHE: nsDiskCacheInputStream::Read "
|
||||
"[stream=%p] stream at end of file",
|
||||
this, buffer, count));
|
||||
return NS_OK;
|
||||
}
|
||||
if (mPos > mStreamEnd) {
|
||||
CACHE_LOG_DEBUG(("CACHE: nsDiskCacheInputStream::Read "
|
||||
"[stream=%p] stream past end of file (!)",
|
||||
this, buffer, count));
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (count > mStreamEnd - mPos)
|
||||
count = mStreamEnd - mPos;
|
||||
|
@ -120,7 +134,14 @@ nsDiskCacheInputStream::Read(char * buffer, PRUint32 count, PRUint32 * bytesRead
|
|||
if (mFD) {
|
||||
// just read from file
|
||||
PRInt32 result = PR_Read(mFD, buffer, count);
|
||||
if (result < 0) return NS_ErrorAccordingToNSPR();
|
||||
if (result < 0) {
|
||||
PRErrorCode error = PR_GetError();
|
||||
nsresult rv = NS_ErrorAccordingToNSPR();
|
||||
CACHE_LOG_DEBUG(("CACHE: nsDiskCacheInputStream::Read PR_Read failed"
|
||||
"[stream=%p, rv=%d, NSPR error %s",
|
||||
this, PRIntn(rv), PR_ErrorToName(error)));
|
||||
return rv;
|
||||
}
|
||||
|
||||
mPos += (PRUint32)result;
|
||||
*bytesRead = (PRUint32)result;
|
||||
|
@ -134,6 +155,9 @@ nsDiskCacheInputStream::Read(char * buffer, PRUint32 count, PRUint32 * bytesRead
|
|||
// no data source for input stream
|
||||
}
|
||||
|
||||
CACHE_LOG_DEBUG(("CACHE: nsDiskCacheInputStream::Read "
|
||||
"[stream=%p, count=%ud, byteRead=%ud] ",
|
||||
this, PRUintn(count), PRUintn(*bytesRead)));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче