[go: nahoru, domu]

Quota: Rename from HostQuota to StorageKeyQuota

Quota limits have been changed to be enforced per StorageKey
instead of Host since crbug/1321895. This change updates
QuotaSettings to rename members to reflect the current reality.

Bug: 1321895
Change-Id: Id80c423217b109e0e85eaca3cfd710b08cfbef02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4044030
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Rayan Kanso <rayankans@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1077553}
diff --git a/storage/browser/quota/quota_settings.cc b/storage/browser/quota/quota_settings.cc
index 3bdedf8..51f43cb 100644
--- a/storage/browser/quota/quota_settings.cc
+++ b/storage/browser/quota/quota_settings.cc
@@ -26,7 +26,7 @@
 
 const int64_t kMBytes = 1024 * 1024;
 const int kRandomizedPercentage = 10;
-const double kDefaultPerHostRatio = 0.75;
+const double kDefaultPerStorageKeyRatio = 0.75;
 const double kIncognitoQuotaRatioLowerBound = 0.15;
 const double kIncognitoQuotaRatioUpperBound = 0.2;
 
@@ -47,8 +47,8 @@
   QuotaSettings settings;
   settings.pool_size =
       static_cast<int64_t>(physical_memory_amount * incognito_pool_size_ratio);
-  settings.per_host_quota = settings.pool_size / 3;
-  settings.session_only_per_host_quota = settings.per_host_quota;
+  settings.per_storage_key_quota = settings.pool_size / 3;
+  settings.session_only_per_storage_key_quota = settings.per_storage_key_quota;
   settings.refresh_interval = base::TimeDelta::Max();
   return settings;
 }
@@ -110,13 +110,14 @@
   const double kMustRemainAvailableRatio =
       features::kMustRemainAvailableRatio.Get();
 
-  // The fraction of the temporary pool that can be utilized by a single host.
-  const double kPerHostTemporaryRatio = kDefaultPerHostRatio;
+  // The fraction of the temporary pool that can be utilized by a single
+  // StorageKey.
+  const double kPerStorageKeyTemporaryRatio = kDefaultPerStorageKeyRatio;
 
   // SessionOnly (or ephemeral) origins are allotted a fraction of what
   // normal origins are provided, and the amount is capped to a hard limit.
-  const double kSessionOnlyHostQuotaRatio = 0.1;  // 10%
-  const int64_t kMaxSessionOnlyHostQuota = 300 * kMBytes;
+  const double kSessionOnlyStorageKeyQuotaRatio = 0.1;  // 10%
+  const int64_t kMaxSessionOnlyStorageKeyQuota = 300 * kMBytes;
 
   QuotaSettings settings;
 
@@ -141,11 +142,11 @@
   settings.must_remain_available =
       std::min(kMustRemainAvailableFixed,
                static_cast<int64_t>(total * kMustRemainAvailableRatio));
-  settings.per_host_quota = pool_size * kPerHostTemporaryRatio;
-  settings.session_only_per_host_quota = std::min(
-      RandomizeByPercent(kMaxSessionOnlyHostQuota, kRandomizedPercentage),
-      static_cast<int64_t>(settings.per_host_quota *
-                           kSessionOnlyHostQuotaRatio));
+  settings.per_storage_key_quota = pool_size * kPerStorageKeyTemporaryRatio;
+  settings.session_only_per_storage_key_quota = std::min(
+      RandomizeByPercent(kMaxSessionOnlyStorageKeyQuota, kRandomizedPercentage),
+      static_cast<int64_t>(settings.per_storage_key_quota *
+                           kSessionOnlyStorageKeyQuotaRatio));
   settings.refresh_interval = base::Seconds(60);
   return settings;
 }