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

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

Issue 2552153002: [BlobStorage] Enabling disk paging and direct storage. (Closed)
Patch Set: 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
22 // This is the maximum amount of memory we can send in an IPC. 32 // This is the maximum amount of memory we can send in an IPC.
23 size_t max_ipc_memory_size = 250 * 1024; 33 size_t max_ipc_memory_size = kDefaultIPCMemorySize;
24 // This is the maximum size of a shared memory handle. 34 // This is the maximum size of a shared memory handle.
25 size_t max_shared_memory_size = 10 * 1024 * 1024; 35 size_t max_shared_memory_size = kDefaultSharedMemorySize;
26 36
27 // This is the maximum amount of memory we can use to store blobs. 37 // This is the maximum amount of memory we can use to store blobs.
28 size_t max_blob_in_memory_space = 500 * 1024 * 1024; 38 size_t max_blob_in_memory_space = kDefaultMaxBlobInMemorySpace;
29 39
30 // This is the maximum amount of disk space we can use. 40 // This is the maximum amount of disk space we can use.
31 // TODO(dmurph): Determine initial heuristic based on disk usage & arch. 41 // TODO(dmurph): Determine initial heuristic based on disk usage & arch.
32 uint64_t max_blob_disk_space = 0ull; 42 uint64_t max_blob_disk_space = kDefaultMaxBlobDiskSpace;
33 43
34 // This is the minimum file size we can use when paging blob items to disk. 44 // 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. 45 // We combine items until we reach at least this size.
36 uint64_t min_page_file_size = 5 * 1024 * 1024; 46 uint64_t min_page_file_size = kDefaultMinPageFileSize;
37 // This is the maximum file size we can create. 47 // This is the maximum file size we can create.
38 uint64_t max_file_size = 100 * 1024 * 1024; 48 uint64_t max_file_size = kDefaultMaxPageFileSize;
39 }; 49 };
40 50
41 enum class IPCBlobItemRequestStrategy { 51 enum class IPCBlobItemRequestStrategy {
42 UNKNOWN = 0, 52 UNKNOWN = 0,
43 IPC, 53 IPC,
44 SHARED_MEMORY, 54 SHARED_MEMORY,
45 FILE, 55 FILE,
46 LAST = FILE 56 LAST = FILE
47 }; 57 };
48 58
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 101
92 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status); 102 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status);
93 103
94 // Returns if the status is a bad enough error to flag the IPC as bad. This is 104 // Returns if the status is a bad enough error to flag the IPC as bad. This is
95 // only INVALID_CONSTRUCTION_ARGUMENTS. 105 // only INVALID_CONSTRUCTION_ARGUMENTS.
96 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); 106 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status);
97 107
98 } // namespace storage 108 } // namespace storage
99 109
100 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ 110 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698