Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2972)

Unified Diff: chrome/browser/extensions/extension_storage_monitor.cc

Issue 1782053004: Change how the quota system computes the total poolsize for temporary storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
// 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));
}
}

Powered by Google App Engine
This is Rietveld 408576698