Bug 1729717 - Remove unused CleanupCacheDirectories r=necko-reviewers,dragana

This was used previously when switching between cache backend versions.

Differential Revision: https://phabricator.services.mozilla.com/D124922
This commit is contained in:
Valentin Gosu 2021-09-13 09:12:34 +00:00
Родитель 0cfb9cd634
Коммит fc6cd46e34
3 изменённых файлов: 0 добавлений и 75 удалений

Просмотреть файл

@ -208,11 +208,6 @@ CacheObserver::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK;
}
if (!strcmp(aTopic, "browser-delayed-startup-finished")) {
CacheStorageService::CleaupCacheDirectories();
return NS_OK;
}
if (!strcmp(aTopic, "profile-change-net-teardown") ||
!strcmp(aTopic, "profile-before-change") ||
!strcmp(aTopic, "xpcom-shutdown")) {

Просмотреть файл

@ -553,72 +553,6 @@ void CacheStorageService::DropPrivateBrowsingEntries() {
}
}
namespace {
class CleaupCacheDirectoriesRunnable : public Runnable {
public:
NS_DECL_NSIRUNNABLE
static bool Post();
private:
CleaupCacheDirectoriesRunnable()
: Runnable("net::CleaupCacheDirectoriesRunnable") {
CacheFileIOManager::GetCacheDirectory(getter_AddRefs(mCache2Dir));
#if defined(MOZ_WIDGET_ANDROID)
CacheFileIOManager::GetProfilelessCacheDirectory(
getter_AddRefs(mCache2Profileless));
#endif
}
virtual ~CleaupCacheDirectoriesRunnable() = default;
nsCOMPtr<nsIFile> mCache1Dir, mCache2Dir;
#if defined(MOZ_WIDGET_ANDROID)
nsCOMPtr<nsIFile> mCache2Profileless;
#endif
};
// static
bool CleaupCacheDirectoriesRunnable::Post() {
// TODO: initialize nsDeleteDir
return true;
}
NS_IMETHODIMP CleaupCacheDirectoriesRunnable::Run() {
MOZ_ASSERT(!NS_IsMainThread());
if (mCache1Dir) {
nsDeleteDir::RemoveOldTrashes(mCache1Dir);
}
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
if (mCache1Dir) {
nsDeleteDir::DeleteDir(mCache1Dir, true, 30000);
}
return NS_OK;
}
} // namespace
// static
void CacheStorageService::CleaupCacheDirectories() {
// Make sure we schedule just once in case CleaupCacheDirectories gets called
// multiple times from some reason.
static bool runOnce = CleaupCacheDirectoriesRunnable::Post();
if (!runOnce) {
NS_WARNING("Could not start cache trashes cleanup");
}
}
// Helper methods
// static

Просмотреть файл

@ -90,10 +90,6 @@ class CacheStorageService final : public nsICacheStorageService,
void Shutdown();
void DropPrivateBrowsingEntries();
// Takes care of deleting any pending trashes for both cache1 and cache2
// as well as old cache directory.
static void CleaupCacheDirectories();
static CacheStorageService* Self() { return sSelf; }
static nsISupports* SelfISupports() {
return static_cast<nsICacheStorageService*>(Self());