Backed out changeset 234c0b4ec7c9 (bug 922081)

This commit is contained in:
Ed Morley 2014-03-05 17:24:58 +00:00
parent bf4bf677f4
commit cabdf9fb49
3 changed files with 4 additions and 36 deletions

View File

@ -1208,11 +1208,9 @@ CacheFileIOManager::OnProfile()
nsCOMPtr<nsIFile> directory;
CacheObserver::ParentDirOverride(getter_AddRefs(directory));
#if defined(MOZ_WIDGET_ANDROID)
char* cachePath = getenv("CACHE_DIRECTORY");
if (!directory && cachePath && *cachePath) {
if (cachePath && *cachePath) {
rv = NS_NewNativeLocalFile(nsDependentCString(cachePath),
true, getter_AddRefs(directory));
}
@ -1231,13 +1229,11 @@ CacheFileIOManager::OnProfile()
if (directory) {
rv = directory->Append(NS_LITERAL_STRING("cache2"));
NS_ENSURE_SUCCESS(rv, rv);
}
// All functions return a clone.
ioMan->mCacheDirectory.swap(directory);
rv = directory->Clone(getter_AddRefs(ioMan->mCacheDirectory));
NS_ENSURE_SUCCESS(rv, rv);
if (ioMan->mCacheDirectory) {
CacheIndex::Init(ioMan->mCacheDirectory);
CacheIndex::Init(directory);
}
return NS_OK;

View File

@ -59,7 +59,6 @@ NS_IMPL_ISUPPORTS2(CacheObserver,
nsIObserver,
nsISupportsWeakReference)
// static
nsresult
CacheObserver::Init()
{
@ -87,7 +86,6 @@ CacheObserver::Init()
return NS_OK;
}
// static
nsresult
CacheObserver::Shutdown()
{
@ -130,10 +128,6 @@ CacheObserver::AttachToPreferences()
mozilla::Preferences::AddUintVarCache(
&sCompressionLevel, "browser.cache.compression_level", kDefaultCompressionLevel);
mozilla::Preferences::GetComplex(
"browser.cache.disk.parent_directory", NS_GET_IID(nsIFile),
getter_AddRefs(mCacheParentDirectoryOverride));
sHalfLifeExperiment = mozilla::Preferences::GetInt(
"browser.cache.frecency_experiment", kDefaultHalfLifeExperiment);
@ -204,22 +198,6 @@ bool const CacheObserver::UseNewCache()
return true;
}
// static
void CacheObserver::ParentDirOverride(nsIFile** aDir)
{
if (NS_WARN_IF(!aDir))
return;
*aDir = nullptr;
if (!sSelf)
return;
if (!sSelf->mCacheParentDirectoryOverride)
return;
sSelf->mCacheParentDirectoryOverride->Clone(aDir);
}
namespace { // anon
class CacheStorageEvictHelper

View File

@ -6,8 +6,6 @@
#define CacheObserver__h__
#include "nsIObserver.h"
#include "nsIFile.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include <algorithm>
@ -46,7 +44,6 @@ class CacheObserver : public nsIObserver
{ return sHalfLifeHours * 60 * 60; }
static int32_t const HalfLifeExperiment()
{ return sHalfLifeExperiment; }
static void ParentDirOverride(nsIFile ** aDir);
static bool const EntryIsTooBig(int64_t aSize, bool aUsingDisk);
@ -66,9 +63,6 @@ private:
static uint32_t sCompressionLevel;
static uint32_t sHalfLifeHours;
static int32_t sHalfLifeExperiment;
// Non static properties, accessible via sSelf
nsCOMPtr<nsIFile> mCacheParentDirectoryOverride;
};
} // net