Chromium Code Reviews| 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 b94e886f3de7bc9685442035789a2833dac6ed64..477de327e8b23ca44bc93a0c0251427257d75623 100644 |
| --- a/storage/common/blob_storage/blob_storage_constants.h |
| +++ b/storage/common/blob_storage/blob_storage_constants.h |
| @@ -13,29 +13,44 @@ |
| namespace storage { |
| +constexpr size_t kDefaultIPCMemorySize = 250u * 1024; |
| +constexpr size_t kDefaultSharedMemorySize = 10u * 1024 * 1024; |
| +constexpr size_t kDefaultMaxBlobInMemorySpace = 500u * 1024 * 1024; |
| +constexpr uint64_t kDefaultMaxBlobDiskSpace = 0ull; |
| +constexpr uint64_t kDefaultMinPageFileSize = 5ull * 1024 * 1024; |
| +constexpr uint64_t kDefaultMaxPageFileSize = 100ull * 1024 * 1024; |
| + |
| // All sizes are in bytes. |
| -struct BlobStorageLimits { |
| +struct STORAGE_COMMON_EXPORT BlobStorageLimits { |
| + // Returns if the current configuration is valid. |
| + bool IsValid() const; |
| + |
| size_t memory_limit_before_paging() const { |
| return max_blob_in_memory_space - min_page_file_size; |
| } |
| + // If disk space goes less than this we stop allocating more disk quota. |
| + uint64_t min_available_disk_space() const { |
| + return 2ull * memory_limit_before_paging(); |
|
michaeln
2016/12/08 21:17:33
why is this number a function of the mem limit? un
dmurph
2016/12/20 02:21:36
It's basically because memory_limit_before_paging(
|
| + } |
| + |
| // This is the maximum amount of memory we can send in an IPC. |
| - size_t max_ipc_memory_size = 250 * 1024; |
| + size_t max_ipc_memory_size = kDefaultIPCMemorySize; |
| // This is the maximum size of a shared memory handle. |
| - size_t max_shared_memory_size = 10 * 1024 * 1024; |
| + size_t max_shared_memory_size = kDefaultSharedMemorySize; |
| // This is the maximum amount of memory we can use to store blobs. |
| - size_t max_blob_in_memory_space = 500 * 1024 * 1024; |
| + size_t max_blob_in_memory_space = kDefaultMaxBlobInMemorySpace; |
| // This is the maximum amount of disk space we can use. |
| // TODO(dmurph): Determine initial heuristic based on disk usage & arch. |
| - uint64_t max_blob_disk_space = 0ull; |
| + uint64_t max_blob_disk_space = kDefaultMaxBlobDiskSpace; |
| // This is the minimum file size we can use when paging blob items to disk. |
| // We combine items until we reach at least this size. |
| - uint64_t min_page_file_size = 5 * 1024 * 1024; |
| + uint64_t min_page_file_size = kDefaultMinPageFileSize; |
| // This is the maximum file size we can create. |
| - uint64_t max_file_size = 100 * 1024 * 1024; |
| + uint64_t max_file_size = kDefaultMaxPageFileSize; |
| }; |
| enum class IPCBlobItemRequestStrategy { |