Bug 1268587 - Don't try to create cache2 dirs on and on when it once fails, r=honzab

This commit is contained in:
Michal Novotny 2016-08-09 20:17:04 +02:00
Родитель 288d758c6c
Коммит 31663f7edd
2 изменённых файлов: 8 добавлений и 1 удалений

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

@ -1099,6 +1099,7 @@ NS_IMPL_ISUPPORTS(CacheFileIOManager, nsITimerCallback)
CacheFileIOManager::CacheFileIOManager()
: mShuttingDown(false)
, mTreeCreated(false)
, mTreeCreationFailed(false)
, mOverLimitEvicting(false)
, mRemovingTrashDirs(false)
{
@ -3710,12 +3711,16 @@ CacheFileIOManager::CreateCacheTree()
MOZ_ASSERT(mIOThread->IsCurrentThread());
MOZ_ASSERT(!mTreeCreated);
if (!mCacheDirectory) {
if (!mCacheDirectory || mTreeCreationFailed) {
return NS_ERROR_FILE_INVALID_PATH;
}
nsresult rv;
// Set the flag here and clear it again below when the tree is created
// successfully.
mTreeCreationFailed = true;
// ensure parent directory exists
nsCOMPtr<nsIFile> parentDir;
rv = mCacheDirectory->GetParent(getter_AddRefs(parentDir));
@ -3736,6 +3741,7 @@ CacheFileIOManager::CreateCacheTree()
NS_ENSURE_SUCCESS(rv, rv);
mTreeCreated = true;
mTreeCreationFailed = false;
if (!mContextEvictor) {
RefPtr<CacheFileContextEvictor> contextEvictor;

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

@ -458,6 +458,7 @@ private:
nsCOMPtr<nsIFile> mCacheProfilelessDirectory;
#endif
bool mTreeCreated;
bool mTreeCreationFailed;
CacheFileHandles mHandles;
nsTArray<CacheFileHandle *> mHandlesByLastUsed;
nsTArray<CacheFileHandle *> mSpecialHandles;