diff options
author | michaeln <michaeln@chromium.org> | 2015-12-16 19:53:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-17 03:55:06 +0000 |
commit | e853d6d7a5a4f4d37822e1fe465ff6871e2cccaf (patch) | |
tree | b3c3722fd4c2b6651e84ab74bc26c08ab9fc2be7 /storage | |
parent | ad8e6061bda13cf37537cd6f426e736db7f27bef (diff) | |
download | chromium_src-e853d6d7a5a4f4d37822e1fe465ff6871e2cccaf.zip chromium_src-e853d6d7a5a4f4d37822e1fe465ff6871e2cccaf.tar.gz chromium_src-e853d6d7a5a4f4d37822e1fe465ff6871e2cccaf.tar.bz2 |
Add 3 new quota related histograms.
Quota.AvailableDiskSpace
Amount of free disk space for the profile directory.
Quota.GlobalTemporaryQuota
The size of the global temporary storage pool.
Quota.TotalDiskSpace
Total disk space for the profile directory.
Review URL: https://codereview.chromium.org/1527103003
Cr-Commit-Position: refs/heads/master@{#365730}
Diffstat (limited to 'storage')
-rw-r--r-- | storage/browser/quota/quota_manager.cc | 36 | ||||
-rw-r--r-- | storage/browser/quota/quota_manager.h | 2 |
2 files changed, 24 insertions, 14 deletions
diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc index a2238b2..f8558f2 100644 --- a/storage/browser/quota/quota_manager.cc +++ b/storage/browser/quota/quota_manager.cc @@ -239,18 +239,6 @@ bool UpdateModifiedTimeOnDBThread(const GURL& origin, return database->SetOriginLastModifiedTime(origin, type, modified_time); } -int64_t CallSystemGetAmountOfFreeDiskSpace(const base::FilePath& profile_path) { - // crbug.com/349708 - TRACE_EVENT0("io", "CallSystemGetAmountOfFreeDiskSpace"); - - // Ensure the profile path exists. - if (!base::CreateDirectory(profile_path)) { - LOG(WARNING) << "Create directory failed for path" << profile_path.value(); - return 0; - } - return base::SysInfo::AmountOfFreeDiskSpace(profile_path); -} - int64_t CalculateTemporaryGlobalQuota(int64_t global_limited_usage, int64_t available_space) { DCHECK_GE(global_limited_usage, 0); @@ -262,7 +250,9 @@ int64_t CalculateTemporaryGlobalQuota(int64_t global_limited_usage, // but make sure we'll have no overflow. avail_space += global_limited_usage; } - return avail_space * kTemporaryQuotaRatioToAvail; + int64_t pool_size = avail_space * kTemporaryQuotaRatioToAvail; + UMA_HISTOGRAM_MBYTES("Quota.GlobalTemporaryPoolSize", pool_size); + return pool_size; } void DispatchTemporaryGlobalQuotaCallback( @@ -894,7 +884,7 @@ QuotaManager::QuotaManager( temporary_quota_override_(-1), desired_available_space_(-1), special_storage_policy_(special_storage_policy), - get_disk_space_fn_(&CallSystemGetAmountOfFreeDiskSpace), + get_disk_space_fn_(&QuotaManager::CallSystemGetAmountOfFreeDiskSpace), storage_monitor_(new StorageMonitor(this)), weak_factory_(this) {} @@ -1770,6 +1760,24 @@ void QuotaManager::PostTaskAndReplyWithResultForDBThread( } //static +int64_t QuotaManager::CallSystemGetAmountOfFreeDiskSpace( + const base::FilePath& profile_path) { + // crbug.com/349708 + TRACE_EVENT0("io", "CallSystemGetAmountOfFreeDiskSpace"); + if (!base::CreateDirectory(profile_path)) { + LOG(WARNING) << "Create directory failed for path" << profile_path.value(); + return 0; + } + uint64_t available, total; + if (!QuotaManager::GetVolumeInfo(profile_path, &available, &total)) { + return 0; + } + UMA_HISTOGRAM_MBYTES("Quota.AvailableDiskSpace", available); + UMA_HISTOGRAM_MBYTES("Quota.TotalDiskSpace", total); + return static_cast<int64_t>(available); +} + +//static bool QuotaManager::GetVolumeInfo(const base::FilePath& path, uint64_t* available_space, uint64_t* total_size) { diff --git a/storage/browser/quota/quota_manager.h b/storage/browser/quota/quota_manager.h index 225b3f7..27c7dee 100644 --- a/storage/browser/quota/quota_manager.h +++ b/storage/browser/quota/quota_manager.h @@ -441,6 +441,8 @@ class STORAGE_EXPORT QuotaManager const base::Callback<bool(QuotaDatabase*)>& task, const base::Callback<void(bool)>& reply); + static int64_t CallSystemGetAmountOfFreeDiskSpace( + const base::FilePath& profile_path); static bool GetVolumeInfo(const base::FilePath& path, uint64_t* available_space, uint64_t* total_size); |