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

Unified Diff: net/url_request/url_request.cc

Issue 1563633002: Make URLRequestJob::SetStatus private. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix stuff Created 4 years, 11 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: net/url_request/url_request.cc
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 4d1a871d39eec390bfaee27f446f4f34ef510ddb..4c4bcfe7f6321e5f63bfe90f914defdc27c5e164 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -658,10 +658,14 @@ void URLRequest::StartJob(URLRequestJob* job) {
}
}
+ // Mark the request as pending, as Start() always completes asynchronously.
+ // Status is generally set by URLRequestJob itself, but Start() calls
+ // directly into the URLRequestJob subclass, so URLRequestJob can't set it
+ // here.
+ // TODO(mmenke): Make the URLRequest manage its own status.
+ status_ = URLRequestStatus::FromError(ERR_IO_PENDING);
+
// Don't allow errors to be sent from within Start().
Randy Smith (Not in Mondays) 2016/01/11 02:27:48 Do you understand this comment? It confuses me--I
mmenke 2016/01/11 06:17:11 I merged it with the above comment - yea, I think
- // TODO(brettw) this may cause NotifyDone to be sent synchronously,
- // we probably don't want this: they should be sent asynchronously so
- // the caller does not get reentered.
mmenke 2016/01/07 15:54:55 This comment is rather outdated - NotifyDone alway
Randy Smith (Not in Mondays) 2016/01/11 02:27:48 Acknowledged.
job_->Start();
}
@@ -855,9 +859,10 @@ void URLRequest::NotifyResponseStarted() {
}
void URLRequest::FollowDeferredRedirect() {
- CHECK(job_.get());
- CHECK(status_.is_success());
+ DCHECK(job_.get());
+ DCHECK(status_.is_success());
+ status_ = URLRequestStatus::FromError(ERR_IO_PENDING);
Randy Smith (Not in Mondays) 2016/01/11 02:27:48 I'm struggling with my conscience as to whether th
mmenke 2016/01/11 06:17:11 So, we don't really distinguish well between what
job_->FollowDeferredRedirect();
}
@@ -865,6 +870,7 @@ void URLRequest::SetAuth(const AuthCredentials& credentials) {
DCHECK(job_.get());
DCHECK(job_->NeedsAuth());
+ status_ = URLRequestStatus::FromError(ERR_IO_PENDING);
job_->SetAuth(credentials);
}
@@ -872,6 +878,7 @@ void URLRequest::CancelAuth() {
DCHECK(job_.get());
DCHECK(job_->NeedsAuth());
+ status_ = URLRequestStatus::FromError(ERR_IO_PENDING);
job_->CancelAuth();
}
@@ -879,12 +886,14 @@ void URLRequest::ContinueWithCertificate(X509Certificate* client_cert,
SSLPrivateKey* client_private_key) {
DCHECK(job_.get());
+ status_ = URLRequestStatus::FromError(ERR_IO_PENDING);
job_->ContinueWithCertificate(client_cert, client_private_key);
}
void URLRequest::ContinueDespiteLastError() {
DCHECK(job_.get());
+ status_ = URLRequestStatus::FromError(ERR_IO_PENDING);
job_->ContinueDespiteLastError();
}
@@ -1111,11 +1120,13 @@ void URLRequest::NotifyAuthRequiredComplete(
void URLRequest::NotifyCertificateRequested(
SSLCertRequestInfo* cert_request_info) {
+ status_ = URLRequestStatus();
delegate_->OnCertificateRequested(this, cert_request_info);
}
void URLRequest::NotifySSLCertificateError(const SSLInfo& ssl_info,
bool fatal) {
+ status_ = URLRequestStatus();
delegate_->OnSSLCertificateError(this, ssl_info, fatal);
}

Powered by Google App Engine
This is Rietveld 408576698