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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 // This should only be called on a started request. | 511 // This should only be called on a started request. |
512 if (!is_pending_ || !job_ || job_->has_response_started()) { | 512 if (!is_pending_ || !job_ || job_->has_response_started()) { |
513 NOTREACHED(); | 513 NOTREACHED(); |
514 return; | 514 return; |
515 } | 515 } |
516 DoCancel(error, ssl_info); | 516 DoCancel(error, ssl_info); |
517 } | 517 } |
518 | 518 |
519 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) { | 519 void URLRequest::DoCancel(int error, const SSLInfo& ssl_info) { |
520 DCHECK(error < 0); | 520 DCHECK(error < 0); |
521 | |
darin (slow to review)
2012/08/10 18:03:02
nit: gratuitous change
mkosiba (inactive)
2012/08/29 15:53:01
Done.
| |
522 // If the URL request already has an error status, then canceling is a no-op. | 521 // If the URL request already has an error status, then canceling is a no-op. |
523 // Plus, we don't want to change the error status once it has been set. | 522 // Plus, we don't want to change the error status once it has been set. |
524 if (status_.is_success()) { | 523 if (status_.is_success()) { |
525 status_.set_status(URLRequestStatus::CANCELED); | 524 status_.set_status(URLRequestStatus::CANCELED); |
526 status_.set_error(error); | 525 status_.set_error(error); |
527 response_info_.ssl_info = ssl_info; | 526 response_info_.ssl_info = ssl_info; |
528 | 527 |
529 // If the request hasn't already been completed, log a cancellation event. | 528 // If the request hasn't already been completed, log a cancellation event. |
530 if (!has_notified_completion_) { | 529 if (!has_notified_completion_) { |
531 // Don't log an error code on ERR_ABORTED, since that's redundant. | 530 // Don't log an error code on ERR_ABORTED, since that's redundant. |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
915 new base::debug::StackTrace(NULL, 0); | 914 new base::debug::StackTrace(NULL, 0); |
916 *stack_trace_copy = stack_trace; | 915 *stack_trace_copy = stack_trace; |
917 stack_trace_.reset(stack_trace_copy); | 916 stack_trace_.reset(stack_trace_copy); |
918 } | 917 } |
919 | 918 |
920 const base::debug::StackTrace* URLRequest::stack_trace() const { | 919 const base::debug::StackTrace* URLRequest::stack_trace() const { |
921 return stack_trace_.get(); | 920 return stack_trace_.get(); |
922 } | 921 } |
923 | 922 |
924 } // namespace net | 923 } // namespace net |
OLD | NEW |