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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // This is the maximum amount of memory we can send in an IPC. | 22 // This is the maximum amount of memory we can send in an IPC. |
23 size_t max_ipc_memory_size = 250 * 1024; | 23 size_t max_ipc_memory_size = 250 * 1024; |
24 // This is the maximum size of a shared memory handle. | 24 // This is the maximum size of a shared memory handle. |
25 size_t max_shared_memory_size = 10 * 1024 * 1024; | 25 size_t max_shared_memory_size = 10 * 1024 * 1024; |
26 | 26 |
27 // This is the maximum amount of memory we can use to store blobs. | 27 // This is the maximum amount of memory we can use to store blobs. |
28 size_t max_blob_in_memory_space = 500 * 1024 * 1024; | 28 size_t max_blob_in_memory_space = 500 * 1024 * 1024; |
29 | 29 |
30 // This is the maximum amount of disk space we can use. | 30 // This is the maximum amount of disk space we can use. |
31 // TODO(dmurph): Consider storage size of the device. | 31 // TODO(dmurph): Determine initial heuristic based on disk usage & arch. |
32 uint64_t max_blob_disk_space = 5ull * 1024 * 1024 * 1024; | 32 uint64_t max_blob_disk_space = 0ull; |
33 | 33 |
34 // This is the minimum file size we can use when paging blob items to disk. | 34 // This is the minimum file size we can use when paging blob items to disk. |
35 // We combine items until we reach at least this size. | 35 // We combine items until we reach at least this size. |
36 uint64_t min_page_file_size = 5 * 1024 * 1024; | 36 uint64_t min_page_file_size = 5 * 1024 * 1024; |
37 // This is the maximum file size we can create. | 37 // This is the maximum file size we can create. |
38 uint64_t max_file_size = 100 * 1024 * 1024; | 38 uint64_t max_file_size = 100 * 1024 * 1024; |
39 }; | 39 }; |
40 | 40 |
41 enum class IPCBlobItemRequestStrategy { | 41 enum class IPCBlobItemRequestStrategy { |
42 UNKNOWN = 0, | 42 UNKNOWN = 0, |
(...skipping 23 matching lines...) Expand all Loading... |
66 ERR_BLOB_DEREFERENCED_WHILE_BUILDING = 4, | 66 ERR_BLOB_DEREFERENCED_WHILE_BUILDING = 4, |
67 // A blob that we referenced during construction is broken, or a browser-side | 67 // A blob that we referenced during construction is broken, or a browser-side |
68 // builder tries to build a blob with a blob reference that isn't finished | 68 // builder tries to build a blob with a blob reference that isn't finished |
69 // constructing. | 69 // constructing. |
70 ERR_REFERENCED_BLOB_BROKEN = 5, | 70 ERR_REFERENCED_BLOB_BROKEN = 5, |
71 LAST_ERROR = ERR_REFERENCED_BLOB_BROKEN, | 71 LAST_ERROR = ERR_REFERENCED_BLOB_BROKEN, |
72 | 72 |
73 // Blob state section: | 73 // Blob state section: |
74 // The blob has finished. | 74 // The blob has finished. |
75 DONE = 200, | 75 DONE = 200, |
76 // The system is pending on quota being granted, the transport layer | 76 // Waiting for memory or file quota for the to-be transported data. |
77 // populating pending data, and/or copying data from dependent blobs. See | |
78 // BlobEntry::BuildingState determine which of these are happening, as they | |
79 // all can happen concurrently. | |
80 PENDING_QUOTA = 201, | 77 PENDING_QUOTA = 201, |
| 78 // Waiting for data to be transported (quota has been granted). |
81 PENDING_TRANSPORT = 202, | 79 PENDING_TRANSPORT = 202, |
| 80 // Waiting for any operations involving dependent blobs after transport data |
| 81 // has been populated. See BlobEntry::BuildingState for more info. |
| 82 // TODO(dmurph): Change to PENDING_REFERENCED_BLOBS (crbug.com/670398). |
82 PENDING_INTERNALS = 203, | 83 PENDING_INTERNALS = 203, |
83 LAST = PENDING_INTERNALS | 84 LAST = PENDING_INTERNALS |
84 }; | 85 }; |
85 | 86 |
86 using BlobStatusCallback = base::Callback<void(BlobStatus)>; | 87 using BlobStatusCallback = base::Callback<void(BlobStatus)>; |
87 | 88 |
88 // Returns if the status is an error code. | 89 // Returns if the status is an error code. |
89 STORAGE_COMMON_EXPORT bool BlobStatusIsError(BlobStatus status); | 90 STORAGE_COMMON_EXPORT bool BlobStatusIsError(BlobStatus status); |
90 | 91 |
91 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status); | 92 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status); |
92 | 93 |
93 // Returns if the status is a bad enough error to flag the IPC as bad. This is | 94 // Returns if the status is a bad enough error to flag the IPC as bad. This is |
94 // only INVALID_CONSTRUCTION_ARGUMENTS. | 95 // only INVALID_CONSTRUCTION_ARGUMENTS. |
95 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); | 96 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); |
96 | 97 |
97 } // namespace storage | 98 } // namespace storage |
98 | 99 |
99 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ | 100 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ |
OLD | NEW |