diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-22 20:10:23 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-02-22 20:10:23 -0500 |
commit | bdad2357a1f0d2aca7f1106f3195d1fd929dc1d1 (patch) | |
tree | 2166aa86e8378b6973e9ebc95b748ad9c632abb1 /netwerk/cache2 | |
parent | 881c1e5f180c537b003b891dce7d7f114800ff3e (diff) | |
download | UXP-bdad2357a1f0d2aca7f1106f3195d1fd929dc1d1.tar UXP-bdad2357a1f0d2aca7f1106f3195d1fd929dc1d1.tar.gz UXP-bdad2357a1f0d2aca7f1106f3195d1fd929dc1d1.tar.lz UXP-bdad2357a1f0d2aca7f1106f3195d1fd929dc1d1.tar.xz UXP-bdad2357a1f0d2aca7f1106f3195d1fd929dc1d1.zip |
Issue #1053 - Remove android support from netwerk
Diffstat (limited to 'netwerk/cache2')
-rw-r--r-- | netwerk/cache2/CacheFileIOManager.cpp | 70 | ||||
-rw-r--r-- | netwerk/cache2/CacheFileIOManager.h | 10 | ||||
-rw-r--r-- | netwerk/cache2/CacheStorageService.cpp | 13 |
3 files changed, 0 insertions, 93 deletions
diff --git a/netwerk/cache2/CacheFileIOManager.cpp b/netwerk/cache2/CacheFileIOManager.cpp index 25e621d12..845ad7314 100644 --- a/netwerk/cache2/CacheFileIOManager.cpp +++ b/netwerk/cache2/CacheFileIOManager.cpp @@ -49,11 +49,7 @@ namespace net { #define kRemoveTrashStartDelay 60000 // in milliseconds #define kSmartSizeUpdateInterval 60000 // in milliseconds -#ifdef ANDROID -const uint32_t kMaxCacheSizeKB = 200*1024; // 200 MB -#else const uint32_t kMaxCacheSizeKB = 350*1024; // 350 MB -#endif bool CacheFileHandle::DispatchRelease() @@ -1280,37 +1276,6 @@ CacheFileIOManager::OnProfile() CacheObserver::ParentDirOverride(getter_AddRefs(directory)); -#if defined(MOZ_WIDGET_ANDROID) - nsCOMPtr<nsIFile> profilelessDirectory; - char* cachePath = getenv("CACHE_DIRECTORY"); - if (!directory && cachePath && *cachePath) { - rv = NS_NewNativeLocalFile(nsDependentCString(cachePath), - true, getter_AddRefs(directory)); - if (NS_SUCCEEDED(rv)) { - // Save this directory as the profileless path. - rv = directory->Clone(getter_AddRefs(profilelessDirectory)); - NS_ENSURE_SUCCESS(rv, rv); - - // Add profile leaf name to the directory name to distinguish - // multiple profiles Fennec supports. - nsCOMPtr<nsIFile> profD; - rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, - getter_AddRefs(profD)); - - nsAutoCString leafName; - if (NS_SUCCEEDED(rv)) { - rv = profD->GetNativeLeafName(leafName); - } - if (NS_SUCCEEDED(rv)) { - rv = directory->AppendNative(leafName); - } - if (NS_FAILED(rv)) { - directory = nullptr; - } - } - } -#endif - if (!directory) { rv = NS_GetSpecialDirectory(NS_APP_CACHE_PARENT_DIR, getter_AddRefs(directory)); @@ -1329,15 +1294,6 @@ CacheFileIOManager::OnProfile() // All functions return a clone. ioMan->mCacheDirectory.swap(directory); -#if defined(MOZ_WIDGET_ANDROID) - if (profilelessDirectory) { - rv = profilelessDirectory->Append(NS_LITERAL_STRING("cache2")); - NS_ENSURE_SUCCESS(rv, rv); - } - - ioMan->mCacheProfilelessDirectory.swap(profilelessDirectory); -#endif - if (ioMan->mCacheDirectory) { CacheIndex::Init(ioMan->mCacheDirectory); } @@ -2391,23 +2347,6 @@ void CacheFileIOManager::GetCacheDirectory(nsIFile** result) ioMan->mCacheDirectory->Clone(result); } -#if defined(MOZ_WIDGET_ANDROID) - -// static -void CacheFileIOManager::GetProfilelessCacheDirectory(nsIFile** result) -{ - *result = nullptr; - - RefPtr<CacheFileIOManager> ioMan = gInstance; - if (!ioMan || !ioMan->mCacheProfilelessDirectory) { - return; - } - - ioMan->mCacheProfilelessDirectory->Clone(result); -} - -#endif - // static nsresult CacheFileIOManager::GetEntryInfo(const SHA1Sum::Hash *aHash, @@ -4019,17 +3958,8 @@ SmartCacheSize(const uint32_t availKB) 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/cache2/CacheFileIOManager.h b/netwerk/cache2/CacheFileIOManager.h index 5ac812da5..8a51b5a0e 100644 --- a/netwerk/cache2/CacheFileIOManager.h +++ b/netwerk/cache2/CacheFileIOManager.h @@ -346,9 +346,6 @@ public: }; static void GetCacheDirectory(nsIFile** result); -#if defined(MOZ_WIDGET_ANDROID) - static void GetProfilelessCacheDirectory(nsIFile** result); -#endif // Calls synchronously OnEntryInfo for an entry with the given hash. // Tries to find an existing entry in the service hashtables first, if not @@ -459,13 +456,6 @@ private: bool mShuttingDown; RefPtr<CacheIOThread> mIOThread; nsCOMPtr<nsIFile> mCacheDirectory; -#if defined(MOZ_WIDGET_ANDROID) - // On Android we add the active profile directory name between the path - // and the 'cache2' leaf name. However, to delete any leftover data from - // times before we were doing it, we still need to access the directory - // w/o the profile name in the path. Here it is stored. - nsCOMPtr<nsIFile> mCacheProfilelessDirectory; -#endif bool mTreeCreated; bool mTreeCreationFailed; CacheFileHandles mHandles; diff --git a/netwerk/cache2/CacheStorageService.cpp b/netwerk/cache2/CacheStorageService.cpp index 3ee1e15cd..a27b082c4 100644 --- a/netwerk/cache2/CacheStorageService.cpp +++ b/netwerk/cache2/CacheStorageService.cpp @@ -569,17 +569,11 @@ private: { nsCacheService::GetDiskCacheDirectory(getter_AddRefs(mCache1Dir)); CacheFileIOManager::GetCacheDirectory(getter_AddRefs(mCache2Dir)); -#if defined(MOZ_WIDGET_ANDROID) - CacheFileIOManager::GetProfilelessCacheDirectory(getter_AddRefs(mCache2Profileless)); -#endif } virtual ~CleaupCacheDirectoriesRunnable() {} uint32_t mVersion, mActive; nsCOMPtr<nsIFile> mCache1Dir, mCache2Dir; -#if defined(MOZ_WIDGET_ANDROID) - nsCOMPtr<nsIFile> mCache2Profileless; -#endif }; // static @@ -613,13 +607,6 @@ NS_IMETHODIMP CleaupCacheDirectoriesRunnable::Run() if (mCache2Dir) { nsDeleteDir::RemoveOldTrashes(mCache2Dir); } -#if defined(MOZ_WIDGET_ANDROID) - if (mCache2Profileless) { - nsDeleteDir::RemoveOldTrashes(mCache2Profileless); - // Always delete the profileless cache on Android - nsDeleteDir::DeleteDir(mCache2Profileless, true, 30000); - } -#endif // Delete the non-active version cache data right now if (mVersion == mActive) { |