Backed out changeset 234c0b4ec7c9 (bug 922081)
authorEd Morley <emorley@mozilla.com>
Wed, 05 Mar 2014 17:24:58 +0000
changeset 190301 fc77956fe560365e4598d21fa521d03101e2b8cc
parent 190300 2ec9d9897a96e8370a6dfd7f3b045e5e1dca2d2b
child 190302 38462b96cd96e7e99a4dbdea8241468d4493c035
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs922081
milestone30.0a1
backs out234c0b4ec7c93c1237c9a272db00952690561b8e
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 234c0b4ec7c9 (bug 922081)
netwerk/cache2/CacheFileIOManager.cpp
netwerk/cache2/CacheObserver.cpp
netwerk/cache2/CacheObserver.h
--- a/netwerk/cache2/CacheFileIOManager.cpp
+++ b/netwerk/cache2/CacheFileIOManager.cpp
@@ -1203,21 +1203,19 @@ CacheFileIOManager::OnProfile()
     // thread, just go with it...
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   nsresult rv;
 
   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));
   }
 #endif
 
   if (!directory) {
     rv = NS_GetSpecialDirectory(NS_APP_CACHE_PARENT_DIR,
                                 getter_AddRefs(directory));
@@ -1226,23 +1224,21 @@ CacheFileIOManager::OnProfile()
   if (!directory) {
     rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR,
                                 getter_AddRefs(directory));
   }
 
   if (directory) {
     rv = directory->Append(NS_LITERAL_STRING("cache2"));
     NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  // All functions return a clone.
-  ioMan->mCacheDirectory.swap(directory);
-
-  if (ioMan->mCacheDirectory) {
-    CacheIndex::Init(ioMan->mCacheDirectory);
+
+    rv = directory->Clone(getter_AddRefs(ioMan->mCacheDirectory));
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    CacheIndex::Init(directory);
   }
 
   return NS_OK;
 }
 
 // static
 already_AddRefed<nsIEventTarget>
 CacheFileIOManager::IOTarget()
--- a/netwerk/cache2/CacheObserver.cpp
+++ b/netwerk/cache2/CacheObserver.cpp
@@ -54,17 +54,16 @@ uint32_t CacheObserver::sMaxDiskEntrySiz
 
 static uint32_t const kDefaultCompressionLevel = 1;
 uint32_t CacheObserver::sCompressionLevel = kDefaultCompressionLevel;
 
 NS_IMPL_ISUPPORTS2(CacheObserver,
                    nsIObserver,
                    nsISupportsWeakReference)
 
-// static
 nsresult
 CacheObserver::Init()
 {
   if (sSelf) {
     return NS_OK;
   }
 
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
@@ -82,17 +81,16 @@ CacheObserver::Init()
   obs->AddObserver(sSelf, "xpcom-shutdown", true);
   obs->AddObserver(sSelf, "last-pb-context-exited", true);
   obs->AddObserver(sSelf, "webapps-clear-data", true);
   obs->AddObserver(sSelf, "memory-pressure", true);
 
   return NS_OK;
 }
 
-// static
 nsresult
 CacheObserver::Shutdown()
 {
   if (!sSelf) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   NS_RELEASE(sSelf);
@@ -125,20 +123,16 @@ CacheObserver::AttachToPreferences()
     &sMaxMemoryEntrySize, "browser.cache.memory.max_entry_size", kDefaultMaxMemoryEntrySize);
   mozilla::Preferences::AddUintVarCache(
     &sMaxDiskEntrySize, "browser.cache.disk.max_entry_size", kDefaultMaxDiskEntrySize);
 
   // http://mxr.mozilla.org/mozilla-central/source/netwerk/cache/nsCacheEntryDescriptor.cpp#367
   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);
 
   if (sHalfLifeExperiment == 0) {
     // The experiment has not yet been initialized, do it now
     // Store the experiemnt value, since we need it not to change between
     // browser sessions.
     srand(time(NULL));
@@ -199,32 +193,16 @@ bool const CacheObserver::UseNewCache()
 
     case 1: // use the new cache backend
       return true;
   }
 
   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
 {
 public:
   nsresult Run(mozIApplicationClearPrivateDataParams* aParams);
 
 private:
--- a/netwerk/cache2/CacheObserver.h
+++ b/netwerk/cache2/CacheObserver.h
@@ -1,18 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef CacheObserver__h__
 #define CacheObserver__h__
 
 #include "nsIObserver.h"
-#include "nsIFile.h"
-#include "nsCOMPtr.h"
 #include "nsWeakReference.h"
 #include <algorithm>
 
 namespace mozilla {
 namespace net {
 
 class CacheObserver : public nsIObserver
                     , public nsSupportsWeakReference
@@ -41,17 +39,16 @@ class CacheObserver : public nsIObserver
   static uint32_t const MaxDiskEntrySize() // result in bytes.
     { return sMaxDiskEntrySize << 10; }
   static uint32_t const CompressionLevel()
     { return sCompressionLevel; }
   static uint32_t const HalfLifeSeconds()
     { 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);
 
 private:
   static CacheObserver* sSelf;
 
   void AttachToPreferences();
   void SchduleAutoDelete();
@@ -61,17 +58,14 @@ private:
   static bool sUseMemoryCache;
   static uint32_t sMemoryLimit;
   static uint32_t sDiskCacheCapacity;
   static uint32_t sMaxMemoryEntrySize;
   static uint32_t sMaxDiskEntrySize;
   static uint32_t sCompressionLevel;
   static uint32_t sHalfLifeHours;
   static int32_t sHalfLifeExperiment;
-
-  // Non static properties, accessible via sSelf
-  nsCOMPtr<nsIFile> mCacheParentDirectoryOverride;
 };
 
 } // net
 } // mozilla
 
 #endif