Chromium Code Reviews| Index: storage/browser/blob/view_blob_internals_job.cc |
| diff --git a/storage/browser/blob/view_blob_internals_job.cc b/storage/browser/blob/view_blob_internals_job.cc |
| index 095376b30e2314606e1fe33feeccdbd0bb5e8b03..74ac4490569c4a4b8c3dd2dba7775bce39aad6ab 100644 |
| --- a/storage/browser/blob/view_blob_internals_job.cc |
| +++ b/storage/browser/blob/view_blob_internals_job.cc |
| @@ -29,8 +29,10 @@ |
| #include "storage/browser/blob/blob_storage_context.h" |
| #include "storage/browser/blob/blob_storage_registry.h" |
| #include "storage/browser/blob/shareable_blob_data_item.h" |
| +#include "storage/common/blob_storage/blob_storage_constants.h" |
| namespace { |
| +using storage::BlobStatus; |
| const char kEmptyBlobStorageMessage[] = "No available blob data."; |
| const char kContentType[] = "Content Type: "; |
| @@ -45,6 +47,7 @@ const char kOffset[] = "Offset: "; |
| const char kLength[] = "Length: "; |
| const char kUUID[] = "Uuid: "; |
| const char kRefcount[] = "Refcount: "; |
| +const char kStatus[] = "Status: "; |
| void StartHTML(std::string* out) { |
| out->append( |
| @@ -62,6 +65,34 @@ void StartHTML(std::string* out) { |
| "</head><body>\n\n"); |
| } |
| +std::string StatusToString(BlobStatus status) { |
| + switch (status) { |
| + case BlobStatus::ERR_INVALID_CONSTRUCTION_ARGUMENTS: |
| + return "Illegal blob construction."; |
|
pwnall
2017/03/01 16:44:05
Can you also add the constant names here? It'll ma
dmurph
2017/03/01 20:36:57
sgtm - I made it a little shorter by removing the
|
| + case BlobStatus::ERR_OUT_OF_MEMORY: |
| + return "Not enough memory or disk space available for blob."; |
| + case BlobStatus::ERR_FILE_WRITE_FAILED: |
| + return "File operation filed"; |
| + case BlobStatus::ERR_SOURCE_DIED_IN_TRANSIT: |
| + return "Blob source died before transporting data to browser."; |
| + case BlobStatus::ERR_BLOB_DEREFERENCED_WHILE_BUILDING: |
| + return "Blob references removed while building."; |
| + case BlobStatus::ERR_REFERENCED_BLOB_BROKEN: |
| + return "Blob contains dependency blob that is broken."; |
| + case BlobStatus::DONE: |
| + return "Blob built with no errors."; |
| + case BlobStatus::PENDING_QUOTA: |
| + return "Blob construction is pending on memory or file quota."; |
| + case BlobStatus::PENDING_TRANSPORT: |
| + return "Blob construction is pending on data transport from renderer."; |
| + case BlobStatus::PENDING_INTERNALS: |
| + return "Blob construction is pending on dependency blobs to finish " |
| + "construction."; |
| + } |
| + NOTREACHED(); |
| + return "Invalid blob state."; |
| +} |
| + |
| void EndHTML(std::string* out) { |
| out->append("\n</body></html>"); |
| } |
| @@ -181,6 +212,7 @@ void ViewBlobInternalsJob::GenerateHTMLForBlobData( |
| StartHTMLList(out); |
| AddHTMLListItem(kRefcount, base::IntToString(refcount), out); |
| + AddHTMLListItem(kStatus, StatusToString(blob_data.status()), out); |
| if (!content_type.empty()) |
| AddHTMLListItem(kContentType, content_type, out); |
| if (!content_disposition.empty()) |