Chromium Code Reviews| Index: storage/browser/blob/blob_reader.cc |
| diff --git a/storage/browser/blob/blob_reader.cc b/storage/browser/blob/blob_reader.cc |
| index 9ac92c0fbad19a86ebffbfeb40fbc90eba6239f2..8aee2cfa8ad65a5b1a3255c37b6ba392380e76b0 100644 |
| --- a/storage/browser/blob/blob_reader.cc |
| +++ b/storage/browser/blob/blob_reader.cc |
| @@ -39,6 +39,25 @@ bool IsFileType(DataElement::Type type) { |
| return false; |
| } |
| } |
| + |
| +int TransformBlobErrorToNetError(IPCBlobCreationCancelCode reason) { |
|
kinuko
2016/04/05 09:42:35
nit: ditto, ConvertBlobError?
dmurph
2016/04/05 18:15:23
Done.
|
| + switch (reason) { |
| + case IPCBlobCreationCancelCode::UNKNOWN: |
| + return net::ERR_FAILED; |
| + case IPCBlobCreationCancelCode::OUT_OF_MEMORY: |
| + return net::ERR_OUT_OF_MEMORY; |
| + case IPCBlobCreationCancelCode::FILE_WRITE_FAILED: |
| + return net::ERR_FILE_NO_SPACE; |
| + case IPCBlobCreationCancelCode::SOURCE_DIED_IN_TRANSIT: |
| + return net::ERR_UNEXPECTED; |
| + case IPCBlobCreationCancelCode::BLOB_DEREFERENCED_WHILE_BUILDING: |
| + return net::ERR_UNEXPECTED; |
| + case IPCBlobCreationCancelCode::REFERENCED_BLOB_BROKEN: |
| + return net::ERR_INVALID_HANDLE; |
| + } |
| + NOTREACHED(); |
| + return net::ERR_FAILED; |
| +} |
| } // namespace |
| BlobReader::FileStreamReaderProvider::~FileStreamReaderProvider() {} |
| @@ -185,9 +204,10 @@ BlobReader::Status BlobReader::ReportError(int net_error) { |
| } |
| void BlobReader::AsyncCalculateSize(const net::CompletionCallback& done, |
| - bool async_succeeded) { |
| + bool async_succeeded, |
| + IPCBlobCreationCancelCode reason) { |
| if (!async_succeeded) { |
| - InvalidateCallbacksAndDone(net::ERR_FAILED, done); |
| + InvalidateCallbacksAndDone(TransformBlobErrorToNetError(reason), done); |
| return; |
| } |
| DCHECK(!blob_handle_->IsBroken()) << "Callback should have returned false."; |