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

Unified Diff: storage/common/blob_storage/blob_storage_constants.h

Issue 2857283002: Add memory pressure listener to Blob storage (Closed)
Patch Set: Rename constant, use base::Uma function and add base attribute. Created 3 years, 7 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
« no previous file with comments | « storage/browser/blob/blob_memory_controller_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/common/blob_storage/blob_storage_constants.h
diff --git a/storage/common/blob_storage/blob_storage_constants.h b/storage/common/blob_storage/blob_storage_constants.h
index f51b012bc07c7b9570688eb9d516b4dd557b4516..4a4e207a9cdf02e04239fa79764a8347eed86c11 100644
--- a/storage/common/blob_storage/blob_storage_constants.h
+++ b/storage/common/blob_storage/blob_storage_constants.h
@@ -23,8 +23,10 @@ constexpr uint64_t kDefaultMaxPageFileSize = 100ull * 1024 * 1024;
#if defined(OS_ANDROID)
// On minimal Android maximum in-memory space can be as low as 5MB.
constexpr uint64_t kDefaultMinPageFileSize = 5ull * 1024 * 1024 / 2;
+const float kDefaultMaxBlobInMemorySpaceUnderPressureRatio = 0.02f;
#else
constexpr uint64_t kDefaultMinPageFileSize = 5ull * 1024 * 1024;
+const float kDefaultMaxBlobInMemorySpaceUnderPressureRatio = 0.002f;
#endif
// All sizes are in bytes.
@@ -52,6 +54,12 @@ struct STORAGE_COMMON_EXPORT BlobStorageLimits {
// This is the maximum amount of memory we can use to store blobs.
size_t max_blob_in_memory_space = kDefaultMaxBlobInMemorySpace;
+ // The ratio applied to |max_blob_in_memory_space| to reduce memory usage
+ // under memory pressure. Note: Under pressure we modify the
+ // |min_page_file_size| to ensure we can evict items until we get below the
+ // reduced memory limit.
+ float max_blob_in_memory_space_under_pressure_ratio =
+ kDefaultMaxBlobInMemorySpaceUnderPressureRatio;
// This is the maximum amount of disk space we can use.
uint64_t desired_max_disk_space = kDefaultMaxBlobDiskSpace;
« no previous file with comments | « storage/browser/blob/blob_memory_controller_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698