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

Unified Diff: net/url_request/url_request_ftp_job.cc

Issue 1467603002: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add done_reading_called_ to MockNetworkTransaction Created 5 years, 1 month 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/url_request/url_request_ftp_job.h ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_ftp_job.cc
diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc
index 3a088bd87c9f4ef5de66a333efb14f691d6254cd..e422d036597461d138b6e9bc06ae38c841e70962 100644
--- a/net/url_request/url_request_ftp_job.cc
+++ b/net/url_request/url_request_ftp_job.cc
@@ -239,7 +239,7 @@ void URLRequestFtpJob::OnStartCompleted(int result) {
HandleAuthNeededResponse();
return;
} else {
- NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
+ NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
}
}
@@ -251,15 +251,7 @@ void URLRequestFtpJob::OnStartCompletedAsync(int result) {
void URLRequestFtpJob::OnReadCompleted(int result) {
read_in_progress_ = false;
- if (result == 0) {
- NotifyDone(URLRequestStatus());
- } else if (result < 0) {
- NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
- } else {
- // Clear the IO_PENDING status
- SetStatus(URLRequestStatus());
- }
- NotifyReadComplete(result);
+ ReadRawDataComplete(result);
}
void URLRequestFtpJob::RestartTransactionWithAuth() {
@@ -352,14 +344,12 @@ UploadProgress URLRequestFtpJob::GetUploadProgress() const {
return UploadProgress();
}
-bool URLRequestFtpJob::ReadRawData(IOBuffer* buf,
- int buf_size,
- int* bytes_read) {
+int URLRequestFtpJob::ReadRawData(IOBuffer* buf, int buf_size) {
DCHECK_NE(buf_size, 0);
- DCHECK(bytes_read);
DCHECK(!read_in_progress_);
int rv;
+
if (proxy_info_.is_direct()) {
rv = ftp_transaction_->Read(buf, buf_size,
base::Bind(&URLRequestFtpJob::OnReadCompleted,
@@ -370,18 +360,9 @@ bool URLRequestFtpJob::ReadRawData(IOBuffer* buf,
base::Unretained(this)));
}
- if (rv >= 0) {
- *bytes_read = rv;
- return true;
- }
-
- if (rv == ERR_IO_PENDING) {
+ if (rv == ERR_IO_PENDING)
read_in_progress_ = true;
- SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
- } else {
- NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
- }
- return false;
+ return rv;
}
void URLRequestFtpJob::HandleAuthNeededResponse() {
« no previous file with comments | « net/url_request/url_request_ftp_job.h ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698