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 0fc10c583cee8031d3b8159adb45d87d2caf99b7..64cc7dd651c89a695fcf353d715796be015fc5b6 100644 | 
| --- a/storage/common/blob_storage/blob_storage_constants.h | 
| +++ b/storage/common/blob_storage/blob_storage_constants.h | 
| @@ -8,17 +8,23 @@ | 
| #include <stddef.h> | 
| #include <stdint.h> | 
| +#include "base/callback_forward.h" | 
| +#include "storage/common/storage_common_export.h" | 
| + | 
| namespace storage { | 
| // TODO(michaeln): use base::SysInfo::AmountOfPhysicalMemoryMB() in some | 
| // way to come up with a better limit. | 
| const int64_t kBlobStorageMaxMemoryUsage = 500 * 1024 * 1024; // Half a gig. | 
| + | 
| const size_t kBlobStorageIPCThresholdBytes = 250 * 1024; | 
| const size_t kBlobStorageMaxSharedMemoryBytes = 10 * 1024 * 1024; | 
| const uint64_t kBlobStorageMaxFileSizeBytes = 100 * 1024 * 1024; | 
| -const uint64_t kBlobStorageMinFileSizeBytes = 1 * 1024 * 1024; | 
| +const uint64_t kBlobStorageMinFileSizeBytes = 5 * 1024 * 1024; | 
| const size_t kBlobStorageMaxBlobMemorySize = | 
| kBlobStorageMaxMemoryUsage - kBlobStorageMinFileSizeBytes; | 
| +const uint64_t kBlobStorageInFlightMemory = kBlobStorageMinFileSizeBytes; | 
| +const uint64_t kBlobStorageMaxDiskSpace = 5ull * 1024 * 1024 * 1024; // 5 gigs. | 
| 
 
kinuko
2016/07/17 16:15:47
Bytes, Size, Space, or just Memory-- the terms use
 
dmurph
2016/07/19 02:26:28
I'll use Bytes and Space. Space is for quotas, Byt
 
 | 
| enum class IPCBlobItemRequestStrategy { | 
| UNKNOWN = 0, | 
| @@ -28,11 +34,15 @@ enum class IPCBlobItemRequestStrategy { | 
| LAST = FILE | 
| }; | 
| -// These items cannot be reordered or renumbered because they're recorded to | 
| -// UMA. New items must be added immediately before LAST, and LAST must be set to | 
| -// the the last item. | 
| -enum class IPCBlobCreationCancelCode { | 
| - UNKNOWN = 0, | 
| +// This is the enum to rule them all in the blob system. | 
| +// These values are used in UMA metrics, so they should not be changed. Please | 
| +// update LAST_ERROR if you add an error condition and LAST if you add new | 
| +// state. | 
| +enum class BlobStatus { | 
| + // Error case section: | 
| + // The construction arguments are invalid. | 
| + INVALID_CONSTRUCTION_ARGUMENTS = 0, | 
| + // We don't have enough memory for the blob. | 
| OUT_OF_MEMORY = 1, | 
| // We couldn't create or write to a file. File system error, like a full disk. | 
| FILE_WRITE_FAILED = 2, | 
| @@ -46,9 +56,30 @@ enum class IPCBlobCreationCancelCode { | 
| // builder tries to build a blob with a blob reference that isn't finished | 
| // constructing. | 
| REFERENCED_BLOB_BROKEN = 5, | 
| 
 
kinuko
2016/07/17 16:15:47
I'm a bit concerned about using the same enum for
 
dmurph
2016/07/19 02:26:28
Done.
 
 | 
| - LAST = REFERENCED_BLOB_BROKEN | 
| + LAST_ERROR = REFERENCED_BLOB_BROKEN, | 
| + | 
| + // Blob state section: | 
| + // The blob is finished constructing. | 
| + DONE = 200, | 
| + // The system is pending on memory quota from the BlobMemoryController. | 
| + PENDING_MEMORY_QUOTA = 201, | 
| + // The system is pending on the transport layer populating data and/or copies | 
| + // from other blobs. | 
| + PENDING_DATA_POPULATION = 202, | 
| + LAST = PENDING_DATA_POPULATION | 
| }; | 
| +using BlobStatusCallback = base::Callback<void(BlobStatus)>; | 
| + | 
| +// Returns if the status is an error code. | 
| +STORAGE_COMMON_EXPORT bool BlobStatusIsError(BlobStatus status); | 
| + | 
| +// Returns if the status is a bad enough error to flag the IPC as bad. | 
| +STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); | 
| + | 
| +// Returns if the status is 'PENDING'. | 
| +STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status); | 
| + | 
| } // namespace storage | 
| #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ |