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

Unified Diff: storage/common/blob_storage/blob_storage_constants.h

Issue 2055053003: [BlobAsync] Disk support for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Combined BlobSlice & BlobFlattener files, more comments, a little cleanup. Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
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..699317715ea1bb10f14ada705041251ff61f4123 100644
--- a/storage/common/blob_storage/blob_storage_constants.h
+++ b/storage/common/blob_storage/blob_storage_constants.h
@@ -8,17 +8,21 @@
#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 size_t kBlobStorageMaxBlobMemorySize =
- kBlobStorageMaxMemoryUsage - kBlobStorageMinFileSizeBytes;
+const uint64_t kBlobStorageMinFileSizeBytes = 5 * 1024 * 1024;
pwnall 2016/08/17 22:01:55 I would like to see what the constants mean withou
+const size_t kBlobStorageMaxBlobMemorySpace = 495 * 1024 * 1024;
+const uint64_t kBlobStorageInFlightSpace = kBlobStorageMinFileSizeBytes;
+const uint64_t kBlobStorageMaxDiskSpace = 5ull * 1024 * 1024 * 1024; // 5 gigs.
enum class IPCBlobItemRequestStrategy {
UNKNOWN = 0,
@@ -28,27 +32,53 @@ 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,
- OUT_OF_MEMORY = 1,
+// 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. This is considered a bad ipc.
+ ERR_INVALID_CONSTRUCTION_ARGUMENTS = 0,
+ // We don't have enough memory for the blob.
+ ERR_OUT_OF_MEMORY = 1,
// We couldn't create or write to a file. File system error, like a full disk.
- FILE_WRITE_FAILED = 2,
+ ERR_FILE_WRITE_FAILED = 2,
// The renderer was destroyed while data was in transit.
- SOURCE_DIED_IN_TRANSIT = 3,
+ ERR_SOURCE_DIED_IN_TRANSIT = 3,
// The renderer destructed the blob before it was done transferring, and there
// were no outstanding references (no one is waiting to read) to keep the
// blob alive.
- BLOB_DEREFERENCED_WHILE_BUILDING = 4,
+ ERR_BLOB_DEREFERENCED_WHILE_BUILDING = 4,
// A blob that we referenced during construction is broken, or a browser-side
// builder tries to build a blob with a blob reference that isn't finished
// constructing.
- REFERENCED_BLOB_BROKEN = 5,
- LAST = REFERENCED_BLOB_BROKEN
+ ERR_REFERENCED_BLOB_BROKEN = 5,
+ LAST_ERROR = ERR_REFERENCED_BLOB_BROKEN,
+
+ // Blob state section:
+ // The blob is finished constructing.
pwnall 2016/08/17 22:01:55 Nit: "blob has finished"
dmurph 2016/09/20 19:53:26 Done.
+ DONE = 200,
+ // The system is pending on quota being granted, the transport layer
+ // populating pending data, and/or copying data from dependent blobs. See
+ // InternalBlobData::BuildingState determine which of these are happening, as
+ // they all can happen concurrently.
+ PENDING = 201,
+ LAST = PENDING
};
+using BlobStatusCallback = base::Callback<void(BlobStatus)>;
+
+// Returns if the status is an error code.
+STORAGE_COMMON_EXPORT bool BlobStatusIsError(BlobStatus status);
michaeln 2016/08/15 22:44:44 can this be inlined?
dmurph 2016/09/20 19:53:26 Done.
+
+// Returns if the status is a bad enough error to flag the IPC as bad. This is
+// only INVALID_CONSTRUCTION_ARGUMENTS.
+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_

Powered by Google App Engine
This is Rietveld 408576698