mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1662012 - Remove filesystem reporting from the cache, r=valentin,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D88740
This commit is contained in:
parent
ddc8978d1f
commit
f67509ab41
@ -3822,44 +3822,6 @@ nsresult CacheFileIOManager::CreateCacheTree() {
|
||||
|
||||
StartRemovingTrash();
|
||||
|
||||
if (!CacheObserver::CacheFSReported()) {
|
||||
uint32_t fsType = 4; // Other OS
|
||||
|
||||
#ifdef XP_WIN
|
||||
nsAutoString target;
|
||||
nsresult rv = mCacheDirectory->GetTarget(target);
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
wchar_t volume_path[MAX_PATH + 1] = {0};
|
||||
if (!::GetVolumePathNameW(target.get(), volume_path,
|
||||
mozilla::ArrayLength(volume_path))) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
wchar_t fsName[6] = {0};
|
||||
if (!::GetVolumeInformationW(volume_path, nullptr, 0, nullptr, nullptr,
|
||||
nullptr, fsName,
|
||||
mozilla::ArrayLength(fsName))) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (wcscmp(fsName, L"NTFS") == 0) {
|
||||
fsType = 0;
|
||||
} else if (wcscmp(fsName, L"FAT32") == 0) {
|
||||
fsType = 1;
|
||||
} else if (wcscmp(fsName, L"FAT") == 0) {
|
||||
fsType = 2;
|
||||
} else {
|
||||
fsType = 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
Telemetry::Accumulate(Telemetry::NETWORK_CACHE_FS_TYPE, fsType);
|
||||
CacheObserver::SetCacheFSReported();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,6 @@ int32_t CacheObserver::sAutoMemoryCacheCapacity = -1;
|
||||
// GetDiskSpaceAvailable() always fails.
|
||||
Atomic<uint32_t, Relaxed> CacheObserver::sSmartDiskCacheCapacity(1024 * 1024);
|
||||
|
||||
static bool kDefaultCacheFSReported = false;
|
||||
bool CacheObserver::sCacheFSReported = kDefaultCacheFSReported;
|
||||
|
||||
Atomic<PRIntervalTime> CacheObserver::sShutdownDemandedTime(
|
||||
PR_INTERVAL_NO_TIMEOUT);
|
||||
|
||||
@ -137,29 +134,6 @@ uint32_t CacheObserver::DiskCacheCapacity() {
|
||||
: StaticPrefs::browser_cache_disk_capacity();
|
||||
}
|
||||
|
||||
// static
|
||||
void CacheObserver::SetCacheFSReported() {
|
||||
sCacheFSReported = true;
|
||||
|
||||
if (!sSelf) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
sSelf->StoreCacheFSReported();
|
||||
} else {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NewRunnableMethod("net::CacheObserver::StoreCacheFSReported",
|
||||
sSelf.get(), &CacheObserver::StoreCacheFSReported);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
}
|
||||
|
||||
void CacheObserver::StoreCacheFSReported() {
|
||||
mozilla::Preferences::SetInt("browser.cache.disk.filesystem_reported",
|
||||
sCacheFSReported);
|
||||
}
|
||||
|
||||
// static
|
||||
void CacheObserver::ParentDirOverride(nsIFile** aDir) {
|
||||
if (NS_WARN_IF(!aDir)) return;
|
||||
|
@ -75,8 +75,6 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
|
||||
return StaticPrefs::privacy_sanitize_sanitizeOnShutdown() &&
|
||||
StaticPrefs::privacy_clearOnShutdown_cache();
|
||||
}
|
||||
static bool CacheFSReported() { return sCacheFSReported; }
|
||||
static void SetCacheFSReported();
|
||||
static void ParentDirOverride(nsIFile** aDir);
|
||||
|
||||
static bool EntryIsTooBig(int64_t aSize, bool aUsingDisk);
|
||||
@ -93,13 +91,11 @@ class CacheObserver : public nsIObserver, public nsSupportsWeakReference {
|
||||
private:
|
||||
static StaticRefPtr<CacheObserver> sSelf;
|
||||
|
||||
void StoreCacheFSReported();
|
||||
void AttachToPreferences();
|
||||
|
||||
static int32_t sAutoMemoryCacheCapacity;
|
||||
static Atomic<uint32_t, Relaxed> sSmartDiskCacheCapacity;
|
||||
static float sHalfLifeHours;
|
||||
static bool sCacheFSReported;
|
||||
static Atomic<PRIntervalTime> sShutdownDemandedTime;
|
||||
|
||||
// Non static properties, accessible via sSelf
|
||||
|
@ -11275,14 +11275,6 @@
|
||||
"n_values": 7,
|
||||
"description": "Final status of the CacheFileInputStream (0=ok, 1=other error, 2=out of memory, 3=disk full, 4=file corrupted, 5=file not found, 6=binding aborted)"
|
||||
},
|
||||
"NETWORK_CACHE_FS_TYPE": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec"],
|
||||
"expires_in_version": "42",
|
||||
"kind": "enumerated",
|
||||
"n_values": 5,
|
||||
"description": "Type of FS that the cache is stored on (0=NTFS (Win), 1=FAT32 (Win), 2=FAT (Win), 3=other FS (Win), 4=other OS)"
|
||||
},
|
||||
"NETWORK_CACHE_SIZE_FULL_FAT": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"products": ["firefox", "fennec"],
|
||||
|
@ -221,7 +221,6 @@
|
||||
"MOZ_SQLITE_WEBAPPS_WRITE_B",
|
||||
"MOZ_SQLITE_WEBAPPS_WRITE_MAIN_THREAD_MS",
|
||||
"MOZ_SQLITE_WEBAPPS_WRITE_MS",
|
||||
"NETWORK_CACHE_FS_TYPE",
|
||||
"NETWORK_CACHE_HIT_MISS_STAT_PER_CACHE_SIZE",
|
||||
"NETWORK_CACHE_HIT_RATE_PER_CACHE_SIZE",
|
||||
"NETWORK_CACHE_METADATA_FIRST_READ_TIME_MS",
|
||||
@ -687,7 +686,6 @@
|
||||
"MOZ_SQLITE_WEBAPPS_WRITE_MS",
|
||||
"MOZ_STORAGE_ASYNC_REQUESTS_MS",
|
||||
"MOZ_STORAGE_ASYNC_REQUESTS_SUCCESS",
|
||||
"NETWORK_CACHE_FS_TYPE",
|
||||
"NETWORK_CACHE_HIT_MISS_STAT_PER_CACHE_SIZE",
|
||||
"NETWORK_CACHE_HIT_RATE_PER_CACHE_SIZE",
|
||||
"NETWORK_CACHE_METADATA_FIRST_READ_TIME_MS",
|
||||
|
Loading…
Reference in New Issue
Block a user