Bug 1035411 - Suspect lock handling in cache2, r=honzab

This commit is contained in:
Michal Novotny 2014-07-16 10:57:52 +02:00
parent 21095d87cb
commit a3789ae4db
2 changed files with 0 additions and 27 deletions

View File

@ -49,7 +49,6 @@ CacheFileInputStream::CacheFileInputStream(CacheFile *aFile)
, mStatus(NS_OK)
, mWaitingForUpdate(false)
, mListeningForChunk(-1)
, mInReadSegments(false)
, mCallbackFlags(0)
{
LOG(("CacheFileInputStream::CacheFileInputStream() [this=%p]", this));
@ -74,7 +73,6 @@ NS_IMETHODIMP
CacheFileInputStream::Available(uint64_t *_retval)
{
CacheFileAutoLock lock(mFile);
MOZ_ASSERT(!mInReadSegments);
if (mClosed) {
LOG(("CacheFileInputStream::Available() - Stream is closed. [this=%p, "
@ -116,7 +114,6 @@ CacheFileInputStream::ReadSegments(nsWriteSegmentFun aWriter, void *aClosure,
uint32_t aCount, uint32_t *_retval)
{
CacheFileAutoLock lock(mFile);
MOZ_ASSERT(!mInReadSegments);
LOG(("CacheFileInputStream::ReadSegments() [this=%p, count=%d]",
this, aCount));
@ -164,24 +161,8 @@ CacheFileInputStream::ReadSegments(nsWriteSegmentFun aWriter, void *aClosure,
} else if (canRead > 0) {
uint32_t toRead = std::min(static_cast<uint32_t>(canRead), aCount);
// We need to release the lock to avoid lock re-entering unless the
// caller is Read() method.
#ifdef DEBUG
int64_t oldPos = mPos;
#endif
mInReadSegments = true;
if (aWriter != (nsWriteSegmentFun)NS_CopySegmentToBuffer) {
lock.Unlock();
}
uint32_t read;
rv = aWriter(this, aClosure, buf, *_retval, toRead, &read);
if (aWriter != (nsWriteSegmentFun)NS_CopySegmentToBuffer) {
lock.Lock();
}
mInReadSegments = false;
#ifdef DEBUG
MOZ_ASSERT(oldPos == mPos);
#endif
if (NS_SUCCEEDED(rv)) {
MOZ_ASSERT(read <= toRead,
@ -243,8 +224,6 @@ CacheFileInputStream::CloseWithStatusLocked(nsresult aStatus)
LOG(("CacheFileInputStream::CloseWithStatusLocked() [this=%p, "
"aStatus=0x%08x]", this, aStatus));
MOZ_ASSERT(!mInReadSegments);
if (mClosed) {
MOZ_ASSERT(!mCallback);
return NS_OK;
@ -271,7 +250,6 @@ CacheFileInputStream::AsyncWait(nsIInputStreamCallback *aCallback,
nsIEventTarget *aEventTarget)
{
CacheFileAutoLock lock(mFile);
MOZ_ASSERT(!mInReadSegments);
LOG(("CacheFileInputStream::AsyncWait() [this=%p, callback=%p, flags=%d, "
"requestedCount=%d, eventTarget=%p]", this, aCallback, aFlags,
@ -306,7 +284,6 @@ NS_IMETHODIMP
CacheFileInputStream::Seek(int32_t whence, int64_t offset)
{
CacheFileAutoLock lock(mFile);
MOZ_ASSERT(!mInReadSegments);
LOG(("CacheFileInputStream::Seek() [this=%p, whence=%d, offset=%lld]",
this, whence, offset));
@ -341,7 +318,6 @@ NS_IMETHODIMP
CacheFileInputStream::Tell(int64_t *_retval)
{
CacheFileAutoLock lock(mFile);
MOZ_ASSERT(!mInReadSegments);
if (mClosed) {
LOG(("CacheFileInputStream::Tell() - Stream is closed. [this=%p]", this));
@ -381,7 +357,6 @@ CacheFileInputStream::OnChunkAvailable(nsresult aResult, uint32_t aChunkIdx,
CacheFileChunk *aChunk)
{
CacheFileAutoLock lock(mFile);
MOZ_ASSERT(!mInReadSegments);
LOG(("CacheFileInputStream::OnChunkAvailable() [this=%p, result=0x%08x, "
"idx=%d, chunk=%p]", this, aResult, aChunkIdx, aChunk));
@ -432,7 +407,6 @@ nsresult
CacheFileInputStream::OnChunkUpdated(CacheFileChunk *aChunk)
{
CacheFileAutoLock lock(mFile);
MOZ_ASSERT(!mInReadSegments);
LOG(("CacheFileInputStream::OnChunkUpdated() [this=%p, idx=%d]",
this, aChunk->Index()));

View File

@ -60,7 +60,6 @@ private:
nsresult mStatus;
bool mWaitingForUpdate;
int64_t mListeningForChunk;
bool mInReadSegments;
nsCOMPtr<nsIInputStreamCallback> mCallback;
uint32_t mCallbackFlags;