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

Side by Side Diff: storage/common/blob_storage/blob_storage_constants.h

Issue 2552153002: [BlobStorage] Enabling disk paging and direct storage. (Closed)
Patch Set: Added an early-exit clause so files don't get created unnecessarily Created 4 years 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 unified diff | Download patch
OLDNEW
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 "storage/common/storage_common_export.h" 12 #include "storage/common/storage_common_export.h"
13 13
14 namespace storage { 14 namespace storage {
15 15
16 constexpr size_t kDefaultIPCMemorySize = 250u * 1024;
17 constexpr size_t kDefaultSharedMemorySize = 10u * 1024 * 1024;
18 constexpr size_t kDefaultMaxBlobInMemorySpace = 500u * 1024 * 1024;
19 constexpr uint64_t kDefaultMaxBlobDiskSpace = 0ull;
20 constexpr uint64_t kDefaultMinPageFileSize = 5ull * 1024 * 1024;
21 constexpr uint64_t kDefaultMaxPageFileSize = 100ull * 1024 * 1024;
22
16 // All sizes are in bytes. 23 // All sizes are in bytes.
17 struct BlobStorageLimits { 24 struct STORAGE_COMMON_EXPORT BlobStorageLimits {
25 // Returns if the current configuration is valid.
26 bool IsValid() const;
27
18 size_t memory_limit_before_paging() const { 28 size_t memory_limit_before_paging() const {
19 return max_blob_in_memory_space - min_page_file_size; 29 return max_blob_in_memory_space - min_page_file_size;
20 } 30 }
21 31
32 // If disk space goes less than this we stop allocating more disk quota.
33 uint64_t min_available_disk_space() const {
34 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(
35 }
36
22 // This is the maximum amount of memory we can send in an IPC. 37 // This is the maximum amount of memory we can send in an IPC.
23 size_t max_ipc_memory_size = 250 * 1024; 38 size_t max_ipc_memory_size = kDefaultIPCMemorySize;
24 // This is the maximum size of a shared memory handle. 39 // This is the maximum size of a shared memory handle.
25 size_t max_shared_memory_size = 10 * 1024 * 1024; 40 size_t max_shared_memory_size = kDefaultSharedMemorySize;
26 41
27 // This is the maximum amount of memory we can use to store blobs. 42 // This is the maximum amount of memory we can use to store blobs.
28 size_t max_blob_in_memory_space = 500 * 1024 * 1024; 43 size_t max_blob_in_memory_space = kDefaultMaxBlobInMemorySpace;
29 44
30 // This is the maximum amount of disk space we can use. 45 // This is the maximum amount of disk space we can use.
31 // TODO(dmurph): Determine initial heuristic based on disk usage & arch. 46 // TODO(dmurph): Determine initial heuristic based on disk usage & arch.
32 uint64_t max_blob_disk_space = 0ull; 47 uint64_t max_blob_disk_space = kDefaultMaxBlobDiskSpace;
33 48
34 // This is the minimum file size we can use when paging blob items to disk. 49 // 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. 50 // We combine items until we reach at least this size.
36 uint64_t min_page_file_size = 5 * 1024 * 1024; 51 uint64_t min_page_file_size = kDefaultMinPageFileSize;
37 // This is the maximum file size we can create. 52 // This is the maximum file size we can create.
38 uint64_t max_file_size = 100 * 1024 * 1024; 53 uint64_t max_file_size = kDefaultMaxPageFileSize;
39 }; 54 };
40 55
41 enum class IPCBlobItemRequestStrategy { 56 enum class IPCBlobItemRequestStrategy {
42 UNKNOWN = 0, 57 UNKNOWN = 0,
43 IPC, 58 IPC,
44 SHARED_MEMORY, 59 SHARED_MEMORY,
45 FILE, 60 FILE,
46 LAST = FILE 61 LAST = FILE
47 }; 62 };
48 63
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 106
92 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status); 107 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status);
93 108
94 // Returns if the status is a bad enough error to flag the IPC as bad. This is 109 // Returns if the status is a bad enough error to flag the IPC as bad. This is
95 // only INVALID_CONSTRUCTION_ARGUMENTS. 110 // only INVALID_CONSTRUCTION_ARGUMENTS.
96 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); 111 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status);
97 112
98 } // namespace storage 113 } // namespace storage
99 114
100 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ 115 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698