зеркало из https://github.com/mozilla/pjs.git
Setting release timeout inside lock -- avoiding race condition.
This commit is contained in:
Родитель
18bb6a33dd
Коммит
a867fdff6f
|
@ -178,7 +178,6 @@ nsrefcnt nsJAR::Release(void)
|
|||
return 0;
|
||||
}
|
||||
else if (1 == count && mCache) {
|
||||
mReleaseTime = PR_IntervalNow();
|
||||
nsresult rv = mCache->ReleaseZip(this);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to release zip file");
|
||||
}
|
||||
|
@ -1238,6 +1237,8 @@ nsZipReaderCache::ReleaseZip(nsJAR* zip)
|
|||
nsresult rv;
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
zip->SetReleaseTime();
|
||||
|
||||
mFreeCount++;
|
||||
if (mZips.Count() <= mCacheSize)
|
||||
return NS_OK;
|
||||
|
|
|
@ -89,6 +89,14 @@ class nsJAR : public nsIZipReader
|
|||
else
|
||||
return PR_INTERVAL_NO_TIMEOUT;
|
||||
}
|
||||
|
||||
void SetReleaseTime() {
|
||||
mReleaseTime = PR_IntervalNow();
|
||||
}
|
||||
|
||||
void ClearReleaseTime() {
|
||||
mReleaseTime = PR_INTERVAL_NO_TIMEOUT;
|
||||
}
|
||||
|
||||
void SetZipReaderCache(nsZipReaderCache* cache) {
|
||||
mCache = cache;
|
||||
|
|
Загрузка…
Ссылка в новой задаче