const int QuotaManager::kPerHostTemporaryPortion = 5; // 20%
+// Cap size for per-host persistent quota determined by the histogram.
+// This is a bit lax value because the histogram says nothing about per-host
+// persistent storage usage and we determined by global persistent storage
+// usage that is less than 10GB for almost all users.
+const int64 QuotaManager::kPerHostPersistentQuotaLimit = 10 * 1024 * kMBytes;
+
const char QuotaManager::kDatabaseName[] = "QuotaManager";
// Preserve kMinimumPreserveForSystem disk space for system book-keeping
}
if (db_disabled_) {
- if (callback.is_null())
+ if (!callback.is_null())
callback.Run(kQuotaErrorInvalidAccess, -1);
return;
}
callback.Run(kQuotaErrorNotSupported, 0);
return;
}
+
if (new_quota < 0) {
callback.Run(kQuotaErrorInvalidModification, -1);
return;
}
+ if (kPerHostPersistentQuotaLimit < new_quota) {
+ // Cap the requested size at the per-host quota limit.
+ new_quota = kPerHostPersistentQuotaLimit;
+ }
+
if (db_disabled_) {
callback.Run(kQuotaErrorInvalidAccess, -1);
return;