Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/url_request/url_request.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 void URLRequest::CancelWithSSLError(int error, const SSLInfo& ssl_info) { | 506 void URLRequest::CancelWithSSLError(int error, const SSLInfo& ssl_info) { |
| 507 // This should only be called on a started request. | 507 // This should only be called on a started request. |
| 508 if (!is_pending_ || !job_ || job_->has_response_started()) { | 508 if (!is_pending_ || !job_ || job_->has_response_started()) { |
| 509 NOTREACHED(); | 509 NOTREACHED(); |
| 510 return; | 510 return; |
| 511 } | 511 } |
| 512 DoCancel(error, ssl_info); | 512 DoCancel(error, ssl_info); |
| 513 } | 513 } |
| 514 | 514 |
| 515 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) { | 515 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) { |
| 516 DCHECK(error < 0); | |
|
darin (slow to review)
2012/07/11 18:12:43
It feels wrong to allow non-negative (non-error) r
| |
| 517 | |
| 518 // If the URL request already has an error status, then canceling is a no-op. | 516 // If the URL request already has an error status, then canceling is a no-op. |
| 519 // Plus, we don't want to change the error status once it has been set. | 517 // Plus, we don't want to change the error status once it has been set. |
| 520 if (status_.is_success()) { | 518 if (status_.is_success()) { |
| 521 status_.set_status(URLRequestStatus::CANCELED); | 519 status_.set_status(URLRequestStatus::CANCELED); |
| 522 status_.set_error(error); | 520 status_.set_error(error); |
| 523 response_info_.ssl_info = ssl_info; | 521 response_info_.ssl_info = ssl_info; |
| 524 } | 522 } |
| 525 | 523 |
| 526 if (is_pending_ && job_) | 524 if (is_pending_ && job_) |
| 527 job_->Kill(); | 525 job_->Kill(); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 new base::debug::StackTrace(NULL, 0); | 902 new base::debug::StackTrace(NULL, 0); |
| 905 *stack_trace_copy = stack_trace; | 903 *stack_trace_copy = stack_trace; |
| 906 stack_trace_.reset(stack_trace_copy); | 904 stack_trace_.reset(stack_trace_copy); |
| 907 } | 905 } |
| 908 | 906 |
| 909 const base::debug::StackTrace* URLRequest::stack_trace() const { | 907 const base::debug::StackTrace* URLRequest::stack_trace() const { |
| 910 return stack_trace_.get(); | 908 return stack_trace_.get(); |
| 911 } | 909 } |
| 912 | 910 |
| 913 } // namespace net | 911 } // namespace net |
| OLD | NEW |