Bug 1276930 - Bypass HTTP cache data read right after shutdown, r=michal

--HG--
extra : rebase_source : c0f568a3642c74eaad7f901c52f6dd67c6281217
This commit is contained in:
Honza Bambas 2016-06-22 16:18:01 -07:00
Родитель 76f6cc7739
Коммит 1998cc0732
3 изменённых файлов: 12 добавлений и 2 удалений

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

@ -1818,6 +1818,11 @@ CacheFileIOManager::Read(CacheFileHandle *aHandle, int64_t aOffset,
LOG(("CacheFileIOManager::Read() [handle=%p, offset=%lld, count=%d, "
"listener=%p]", aHandle, aOffset, aCount, aCallback));
if (CacheObserver::ShuttingDown()) {
LOG((" no reads after shutdown"));
return NS_ERROR_NOT_INITIALIZED;
}
nsresult rv;
RefPtr<CacheFileIOManager> ioMan = gInstance;
@ -1844,6 +1849,11 @@ CacheFileIOManager::ReadInternal(CacheFileHandle *aHandle, int64_t aOffset,
nsresult rv;
if (CacheObserver::ShuttingDown()) {
LOG((" no reads after shutdown"));
return NS_ERROR_NOT_INITIALIZED;
}
if (!aHandle->mFileExists) {
NS_WARNING("Trying to read from non-existent file");
return NS_ERROR_NOT_AVAILABLE;

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

@ -97,7 +97,7 @@ bool CacheObserver::sHashStatsReported = kDefaultHashStatsReported;
static uint32_t const kDefaultMaxShutdownIOLag = 2; // seconds
Atomic<uint32_t, Relaxed> CacheObserver::sMaxShutdownIOLag(kDefaultMaxShutdownIOLag);
Atomic<PRIntervalTime, Relaxed> CacheObserver::sShutdownDemandedTime(PR_INTERVAL_NO_TIMEOUT);
Atomic<PRIntervalTime> CacheObserver::sShutdownDemandedTime(PR_INTERVAL_NO_TIMEOUT);
NS_IMPL_ISUPPORTS(CacheObserver,
nsIObserver,

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

@ -107,7 +107,7 @@ private:
static bool sCacheFSReported;
static bool sHashStatsReported;
static Atomic<uint32_t, Relaxed> sMaxShutdownIOLag;
static Atomic<PRIntervalTime, Relaxed> sShutdownDemandedTime;
static Atomic<PRIntervalTime> sShutdownDemandedTime;
// Non static properties, accessible via sSelf
nsCOMPtr<nsIFile> mCacheParentDirectoryOverride;