summaryrefslogtreecommitdiffstats
path: root/netwerk/cache2
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-22 20:10:23 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:52:18 +0200
commit92edec6f587ae6b86c9b27947113997972ce0c1a (patch)
tree246706f86a7e5e3e086cf9ac83f7bdcec0055cee /netwerk/cache2
parent2dea4edfd7cf9a760149da220e60dddb2b0b0d09 (diff)
downloadUXP-92edec6f587ae6b86c9b27947113997972ce0c1a.tar
UXP-92edec6f587ae6b86c9b27947113997972ce0c1a.tar.gz
UXP-92edec6f587ae6b86c9b27947113997972ce0c1a.tar.lz
UXP-92edec6f587ae6b86c9b27947113997972ce0c1a.tar.xz
UXP-92edec6f587ae6b86c9b27947113997972ce0c1a.zip
Issue #1053 - Remove android support from netwerk
Diffstat (limited to 'netwerk/cache2')
-rw-r--r--netwerk/cache2/CacheFileIOManager.cpp70
-rw-r--r--netwerk/cache2/CacheFileIOManager.h10
-rw-r--r--netwerk/cache2/CacheStorageService.cpp13
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) {