| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 enum class IPCBlobItemRequestStrategy { | 50 enum class IPCBlobItemRequestStrategy { |
| 51 UNKNOWN = 0, | 51 UNKNOWN = 0, |
| 52 IPC, | 52 IPC, |
| 53 SHARED_MEMORY, | 53 SHARED_MEMORY, |
| 54 FILE, | 54 FILE, |
| 55 LAST = FILE | 55 LAST = FILE |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // These items cannot be reordered or renumbered because they're recorded to | |
| 59 // UMA. New items must be added immediately before LAST, and LAST must be set to | |
| 60 // the the last item. | |
| 61 // DEPRECATED, please use BlobStatus instead. | |
| 62 enum class IPCBlobCreationCancelCode { | |
| 63 UNKNOWN = 0, | |
| 64 OUT_OF_MEMORY = 1, | |
| 65 // We couldn't create or write to a file. File system error, like a full disk. | |
| 66 FILE_WRITE_FAILED = 2, | |
| 67 // The renderer was destroyed while data was in transit. | |
| 68 SOURCE_DIED_IN_TRANSIT = 3, | |
| 69 // The renderer destructed the blob before it was done transferring, and there | |
| 70 // were no outstanding references (no one is waiting to read) to keep the | |
| 71 // blob alive. | |
| 72 BLOB_DEREFERENCED_WHILE_BUILDING = 4, | |
| 73 // A blob that we referenced during construction is broken, or a browser-side | |
| 74 // builder tries to build a blob with a blob reference that isn't finished | |
| 75 // constructing. | |
| 76 REFERENCED_BLOB_BROKEN = 5, | |
| 77 LAST = REFERENCED_BLOB_BROKEN | |
| 78 }; | |
| 79 | |
| 80 // This is the enum to rule them all in the blob system. | 58 // This is the enum to rule them all in the blob system. |
| 81 // These values are used in UMA metrics, so they should not be changed. Please | 59 // These values are used in UMA metrics, so they should not be changed. Please |
| 82 // update LAST_ERROR if you add an error condition and LAST if you add new | 60 // update LAST_ERROR if you add an error condition and LAST if you add new |
| 83 // state. | 61 // state. |
| 84 enum class BlobStatus { | 62 enum class BlobStatus { |
| 85 // Error case section: | 63 // Error case section: |
| 86 // The construction arguments are invalid. This is considered a bad ipc. | 64 // The construction arguments are invalid. This is considered a bad ipc. |
| 87 ERR_INVALID_CONSTRUCTION_ARGUMENTS = 0, | 65 ERR_INVALID_CONSTRUCTION_ARGUMENTS = 0, |
| 88 // We don't have enough memory for the blob. | 66 // We don't have enough memory for the blob. |
| 89 ERR_OUT_OF_MEMORY = 1, | 67 ERR_OUT_OF_MEMORY = 1, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 ERR_REFERENCED_BLOB_BROKEN = 5, | 79 ERR_REFERENCED_BLOB_BROKEN = 5, |
| 102 LAST_ERROR = ERR_REFERENCED_BLOB_BROKEN, | 80 LAST_ERROR = ERR_REFERENCED_BLOB_BROKEN, |
| 103 | 81 |
| 104 // Blob state section: | 82 // Blob state section: |
| 105 // The blob has finished. | 83 // The blob has finished. |
| 106 DONE = 200, | 84 DONE = 200, |
| 107 // The system is pending on quota being granted, the transport layer | 85 // The system is pending on quota being granted, the transport layer |
| 108 // populating pending data, and/or copying data from dependent blobs. See | 86 // populating pending data, and/or copying data from dependent blobs. See |
| 109 // InternalBlobData::BuildingState determine which of these are happening, as | 87 // InternalBlobData::BuildingState determine which of these are happening, as |
| 110 // they all can happen concurrently. | 88 // they all can happen concurrently. |
| 111 PENDING = 201, | 89 PENDING_QUOTA = 201, |
| 112 LAST = PENDING | 90 PENDING_TRANSPORT = 202, |
| 91 PENDING_INTERNALS = 203, |
| 92 LAST = PENDING_INTERNALS |
| 113 }; | 93 }; |
| 114 | 94 |
| 115 using BlobStatusCallback = base::Callback<void(BlobStatus)>; | 95 using BlobStatusCallback = base::Callback<void(BlobStatus)>; |
| 116 | 96 |
| 117 // Returns if the status is an error code. | 97 // Returns if the status is an error code. |
| 118 STORAGE_COMMON_EXPORT bool BlobStatusIsError(BlobStatus status); | 98 STORAGE_COMMON_EXPORT bool BlobStatusIsError(BlobStatus status); |
| 119 | 99 |
| 100 STORAGE_COMMON_EXPORT bool BlobStatusIsPending(BlobStatus status); |
| 101 |
| 120 // Returns if the status is a bad enough error to flag the IPC as bad. This is | 102 // Returns if the status is a bad enough error to flag the IPC as bad. This is |
| 121 // only INVALID_CONSTRUCTION_ARGUMENTS. | 103 // only INVALID_CONSTRUCTION_ARGUMENTS. |
| 122 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); | 104 STORAGE_COMMON_EXPORT bool BlobStatusIsBadIPC(BlobStatus status); |
| 123 | 105 |
| 124 } // namespace storage | 106 } // namespace storage |
| 125 | 107 |
| 126 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ | 108 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_STORAGE_CONSTANTS_H_ |
| OLD | NEW |