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

Unified Diff: content/test/net/url_request_abort_on_end_job.cc

Issue 1410643007: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move NotifyReadCompleted Created 5 years, 2 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: content/test/net/url_request_abort_on_end_job.cc
diff --git a/content/test/net/url_request_abort_on_end_job.cc b/content/test/net/url_request_abort_on_end_job.cc
index f7ff5a9dd84bf0f1e759e62211fddbbb74fb0035..872a5721acce4ff525fe5079970225d80edec3d9 100644
--- a/content/test/net/url_request_abort_on_end_job.cc
+++ b/content/test/net/url_request_abort_on_end_job.cc
@@ -111,20 +111,16 @@ void URLRequestAbortOnEndJob::Start() {
weak_factory_.GetWeakPtr()));
}
-bool URLRequestAbortOnEndJob::ReadRawData(net::IOBuffer* buf,
- const int max_bytes,
- int* bytes_read) {
+int URLRequestAbortOnEndJob::ReadRawData(net::IOBuffer* buf, int max_bytes) {
if (!sent_data_) {
- *bytes_read = std::min(size_t(max_bytes), sizeof(kPageContent));
- std::memcpy(buf->data(), kPageContent, *bytes_read);
+ max_bytes =
+ std::min(max_bytes, base::checked_cast<int>(sizeof(kPageContent)));
+ std::memcpy(buf->data(), kPageContent, max_bytes);
sent_data_ = true;
- return true;
+ return max_bytes;
}
- SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED,
- net::ERR_CONNECTION_ABORTED));
- *bytes_read = -1;
- return false;
+ return net::ERR_CONNECTION_ABORTED;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698