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

Unified Diff: net/base/elements_upload_data_stream.cc

Issue 2077353002: [TEST ONLY] Run tests for 2030353002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: upload read error Created 4 years, 6 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
« no previous file with comments | « net/base/elements_upload_data_stream.h ('k') | net/base/elements_upload_data_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/elements_upload_data_stream.cc
diff --git a/net/base/elements_upload_data_stream.cc b/net/base/elements_upload_data_stream.cc
index bca7d4e7aab0ac1dc2b5d5c019100a8bdff23660..e1b6418439f2443334b7f474c5ed9ff948b0d027 100644
--- a/net/base/elements_upload_data_stream.cc
+++ b/net/base/elements_upload_data_stream.cc
@@ -20,7 +20,7 @@ ElementsUploadDataStream::ElementsUploadDataStream(
: UploadDataStream(false, identifier),
element_readers_(std::move(element_readers)),
element_index_(0),
- read_failed_(false),
+ read_failed_(OK),
weak_ptr_factory_(this) {}
ElementsUploadDataStream::~ElementsUploadDataStream() {
@@ -61,7 +61,7 @@ ElementsUploadDataStream::GetElementReaders() const {
void ElementsUploadDataStream::ResetInternal() {
weak_ptr_factory_.InvalidateWeakPtrs();
- read_failed_ = false;
+ read_failed_ = OK;
element_index_ = 0;
}
@@ -125,16 +125,8 @@ int ElementsUploadDataStream::ReadElements(
ProcessReadResult(buf, result);
}
- if (read_failed_) {
- // If an error occured during read operation, then pad with zero.
- // Otherwise the server will hang waiting for the rest of the data.
- int num_bytes_to_fill =
- static_cast<int>(std::min(static_cast<uint64_t>(buf->BytesRemaining()),
- size() - position() - buf->BytesConsumed()));
- DCHECK_GE(num_bytes_to_fill, 0);
- memset(buf->data(), 0, num_bytes_to_fill);
- buf->DidConsume(num_bytes_to_fill);
- }
+ if (read_failed_ != OK)
+ return read_failed_;
return buf->BytesConsumed();
}
@@ -158,7 +150,7 @@ void ElementsUploadDataStream::ProcessReadResult(
if (result >= 0) {
buf->DidConsume(result);
} else {
- read_failed_ = true;
+ read_failed_ = result;
}
}
« no previous file with comments | « net/base/elements_upload_data_stream.h ('k') | net/base/elements_upload_data_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698