Chromium Code Reviews| Index: chrome/browser/extensions/extension_storage_monitor.cc |
| diff --git a/chrome/browser/extensions/extension_storage_monitor.cc b/chrome/browser/extensions/extension_storage_monitor.cc |
| index 7294fbd4fc8a03d9da3bbb61cd4b0667e620df2b..81394f5609bafc272711c2f7fa52fbcef88191ab 100644 |
| --- a/chrome/browser/extensions/extension_storage_monitor.cc |
| +++ b/chrome/browser/extensions/extension_storage_monitor.cc |
| @@ -84,17 +84,16 @@ const Extension* GetExtensionById(content::BrowserContext* context, |
| extension_id, ExtensionRegistry::EVERYTHING); |
| } |
| -void LogTemporaryStorageUsage(int64_t usage, |
| - storage::QuotaStatusCode status, |
| - int64_t global_quota) { |
| - if (status == storage::kQuotaStatusOk) { |
| - int64_t per_app_quota = |
| - global_quota / storage::QuotaManager::kPerHostTemporaryPortion; |
| +void LogTemporaryStorageUsage( |
| + scoped_refptr<storage::QuotaManager> quota_manager, |
| + int64_t usage) { |
| + const storage::QuotaSettings& settings = quota_manager->settings(); |
| + if (settings.per_host_quota > 0) { |
|
Devlin
2016/11/23 17:04:13
nit: since we only use per_host_quota here, maybe
|
| // Note we use COUNTS_100 (instead of PERCENT) because this can potentially |
| // exceed 100%. |
| UMA_HISTOGRAM_COUNTS_100( |
| "Extensions.HostedAppUnlimitedStorageTemporaryStorageUsage", |
| - 100.0 * usage / per_app_quota); |
| + 100.0 * usage / settings.per_host_quota); |
| } |
| } |
| @@ -235,12 +234,9 @@ class StorageEventObserver |
| } else { |
| // We can't use the quota in the event because it assumes unlimited |
| // storage. |
| - BrowserThread::PostTask( |
| - BrowserThread::IO, |
| - FROM_HERE, |
| - base::Bind(&storage::QuotaManager::GetTemporaryGlobalQuota, |
| - state.quota_manager, |
| - base::Bind(&LogTemporaryStorageUsage, event.usage))); |
| + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| + base::Bind(&LogTemporaryStorageUsage, |
| + state.quota_manager, event.usage)); |
|
Devlin
2016/11/23 17:04:13
Is per_host_quota able to change between when the
michaeln
2016/12/06 00:35:54
the setting values can change over time, i think t
|
| } |
| } |