diff options
Diffstat (limited to 'netwerk/cache')
-rw-r--r-- | netwerk/cache/nsCacheService.cpp | 15 | ||||
-rw-r--r-- | netwerk/cache/nsDeleteDir.cpp | 30 |
2 files changed, 4 insertions, 41 deletions
diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index 4b08614b8..b2d488ea6 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -107,13 +107,9 @@ static const char * prefList[] = { // Cache sizes, in KB const int32_t DEFAULT_CACHE_SIZE = 250 * 1024; // 250 MB -#ifdef ANDROID -const int32_t MAX_CACHE_SIZE = 200 * 1024; // 200 MB -const int32_t OLD_MAX_CACHE_SIZE = 200 * 1024; // 200 MB -#else const int32_t MAX_CACHE_SIZE = 350 * 1024; // 350 MB const int32_t OLD_MAX_CACHE_SIZE = 1024 * 1024; // 1 GB -#endif + // Default cache size was 50 MB for many years until FF 4: const int32_t PRE_GECKO_2_0_DEFAULT_CACHE_SIZE = 50 * 1024; @@ -593,17 +589,8 @@ SmartCacheSize(const uint32_t availKB, bool shouldUseOldMaxSmartSize) avail10MBs = 50; } -#ifdef ANDROID - // On Android, smaller/older devices may have very little storage and - // device owners may be sensitive to storage footprint: Use a smaller - // percentage of available space and a smaller minimum. - - // 20% of space up to 500 MB (10 MB min) - sz10MBs += std::max<uint32_t>(1, static_cast<uint32_t>(avail10MBs * .2)); -#else // 40% of space up to 500 MB (50 MB min) sz10MBs += std::max<uint32_t>(5, static_cast<uint32_t>(avail10MBs * .4)); -#endif return std::min<uint32_t>(maxSize, sz10MBs * 10 * 1024); } diff --git a/netwerk/cache/nsDeleteDir.cpp b/netwerk/cache/nsDeleteDir.cpp index 8c4edf812..b081a12eb 100644 --- a/netwerk/cache/nsDeleteDir.cpp +++ b/netwerk/cache/nsDeleteDir.cpp @@ -235,18 +235,11 @@ nsDeleteDir::DeleteDir(nsIFile *dirIn, bool moveToTrash, uint32_t delay) if (!leaf.Length()) return NS_ERROR_FAILURE; -#if defined(MOZ_WIDGET_ANDROID) - nsCOMPtr<nsIFile> parent; - rv = trash->GetParent(getter_AddRefs(parent)); - if (NS_FAILED(rv)) - return rv; - rv = dir->MoveToNative(parent, leaf); -#else // Important: must rename directory w/o changing parent directory: else on // NTFS we'll wait (with cache lock) while nsIFile's ACL reset walks file // tree: was hanging GUI for *minutes* on large cache dirs. rv = dir->MoveToNative(nullptr, leaf); -#endif + if (NS_FAILED(rv)) return rv; } else { @@ -269,21 +262,6 @@ nsresult nsDeleteDir::GetTrashDir(nsIFile *target, nsCOMPtr<nsIFile> *result) { nsresult rv; -#if defined(MOZ_WIDGET_ANDROID) - // Try to use the app cache folder for cache trash on Android - char* cachePath = getenv("CACHE_DIRECTORY"); - if (cachePath) { - rv = NS_NewNativeLocalFile(nsDependentCString(cachePath), - true, getter_AddRefs(*result)); - if (NS_FAILED(rv)) - return rv; - - // Add a sub folder with the cache folder name - nsAutoCString leaf; - rv = target->GetNativeLeafName(leaf); - (*result)->AppendNative(leaf); - } else -#endif { rv = target->Clone(getter_AddRefs(*result)); } @@ -318,11 +296,9 @@ nsDeleteDir::RemoveOldTrashes(nsIFile *cacheDir) return rv; nsCOMPtr<nsIFile> parent; -#if defined(MOZ_WIDGET_ANDROID) - rv = trash->GetParent(getter_AddRefs(parent)); -#else + rv = cacheDir->GetParent(getter_AddRefs(parent)); -#endif + if (NS_FAILED(rv)) return rv; |