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

Unified Diff: net/url_request/url_request_job.cc

Issue 1271593002: Fix cancellation of a pair of URLRequestJob subclasses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes Created 5 years, 4 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_job.cc
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index 14c5c8f00adb08a0eb5d8bf2909d6187c6c7f18a..8d0b23a01f3a20e48a7fb33cc65198f57923952d 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -378,7 +378,9 @@ void URLRequestJob::NotifyHeadersComplete() {
if (has_handled_response_)
return;
mmenke 2015/08/03 21:01:20 These three checks seem aimed at papering over bug
davidben 2015/08/05 18:56:39 Clearly we should unrefcount URLRequestJob. :-) Th
mmenke 2015/08/05 20:00:24 I agree with removing refcounting, but that wouldn
- DCHECK(!request_->status().is_io_pending());
+ // This should not be called on error, and the job type should have cleared
+ // IO_PENDING state before calling this method.
+ DCHECK(request_->status().is_success());
// Initialize to the current time, and let the subclass optionally override
// the time stamps if it has that information. The default request_time is
@@ -761,8 +763,12 @@ const URLRequestStatus URLRequestJob::GetStatus() {
}
void URLRequestJob::SetStatus(const URLRequestStatus &status) {
- if (request_)
+ if (request_) {
+ // A URLRequestJob should not replace a failed or cancelled status.
+ DCHECK(request_->status().is_success() ||
+ request_->status().is_io_pending());
mmenke 2015/08/03 21:01:20 Want to change the added DCHECKs to CHECKs (Partic
davidben 2015/08/05 18:56:39 SGTM.
request_->set_status(status);
+ }
}
void URLRequestJob::SetProxyServer(const HostPortPair& proxy_server) {

Powered by Google App Engine
This is Rietveld 408576698