| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ | 5 #ifndef STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ |
| 6 #define STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ | 6 #define STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "build/build_config.h" |
| 12 #include "storage/common/storage_common_export.h" | 13 #include "storage/common/storage_common_export.h" |
| 13 | 14 |
| 14 namespace storage { | 15 namespace storage { |
| 15 | 16 |
| 16 constexpr size_t kDefaultIPCMemorySize = 250u * 1024; | 17 constexpr size_t kDefaultIPCMemorySize = 250u * 1024; |
| 17 constexpr size_t kDefaultSharedMemorySize = 10u * 1024 * 1024; | 18 constexpr size_t kDefaultSharedMemorySize = 10u * 1024 * 1024; |
| 18 constexpr size_t kDefaultMaxBlobInMemorySpace = 500u * 1024 * 1024; | 19 constexpr size_t kDefaultMaxBlobInMemorySpace = 500u * 1024 * 1024; |
| 19 constexpr uint64_t kDefaultMaxBlobDiskSpace = 0ull; | 20 constexpr uint64_t kDefaultMaxBlobDiskSpace = 0ull; |
| 21 constexpr uint64_t kDefaultMaxPageFileSize = 100ull * 1024 * 1024; |
| 22 |
| 23 #if defined(OS_ANDROID) |
| 24 // On minimal Android maximum in-memory space can be as low as 5MB. |
| 25 constexpr uint64_t kDefaultMinPageFileSize = 5ull * 1024 * 1024 / 2; |
| 26 #else |
| 20 constexpr uint64_t kDefaultMinPageFileSize = 5ull * 1024 * 1024; | 27 constexpr uint64_t kDefaultMinPageFileSize = 5ull * 1024 * 1024; |
| 21 constexpr uint64_t kDefaultMaxPageFileSize = 100ull * 1024 * 1024; | 28 #endif |
| 22 | 29 |
| 23 // All sizes are in bytes. | 30 // All sizes are in bytes. |
| 24 struct STORAGE_COMMON_EXPORT BlobStorageLimits { | 31 struct STORAGE_COMMON_EXPORT BlobStorageLimits { |
| 25 // Returns if the current configuration is valid. | 32 // Returns if the current configuration is valid. |
| 26 bool IsValid() const; | 33 bool IsValid() const; |
| 27 | 34 |
| 28 size_t memory_limit_before_paging() const { | 35 size_t memory_limit_before_paging() const { |
| 29 return max_blob_in_memory_space - min_page_file_size; | 36 return max_blob_in_memory_space - min_page_file_size; |
| 30 } | 37 } |
| 31 | 38 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 118 |
| 112 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status); | 119 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status); |
| 113 | 120 |
| 114 // Returns if the status is a bad enough error to flag the IPC as bad. This is | 121 // Returns if the status is a bad enough error to flag the IPC as bad. This is |
| 115 // only INVALID_CONSTRUCTION_ARGUMENTS. | 122 // only INVALID_CONSTRUCTION_ARGUMENTS. |
| 116 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); | 123 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); |
| 117 | 124 |
| 118 } // namespace storage | 125 } // namespace storage |
| 119 | 126 |
| 120 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ | 127 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ |
| OLD | NEW |