| 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_fetcher_core.h" | 5 #include "net/url_request/url_fetcher_core.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 request_->CancelWithError(error); | 661 request_->CancelWithError(error); |
| 662 ReleaseRequest(); | 662 ReleaseRequest(); |
| 663 } | 663 } |
| 664 | 664 |
| 665 // Set the error manually. | 665 // Set the error manually. |
| 666 // Normally, calling URLRequest::CancelWithError() results in calling | 666 // Normally, calling URLRequest::CancelWithError() results in calling |
| 667 // OnReadCompleted() with bytes_read = -1 via an asynchronous task posted by | 667 // OnReadCompleted() with bytes_read = -1 via an asynchronous task posted by |
| 668 // URLRequestJob::NotifyDone(). But, because the request was released | 668 // URLRequestJob::NotifyDone(). But, because the request was released |
| 669 // immediately after being canceled, the request could not call | 669 // immediately after being canceled, the request could not call |
| 670 // OnReadCompleted() which overwrites |status_| with the error status. | 670 // OnReadCompleted() which overwrites |status_| with the error status. |
| 671 status_.set_status(URLRequestStatus::CANCELED); | 671 status_ = URLRequestStatus(URLRequestStatus::CANCELED, error); |
| 672 status_.set_error(error); | |
| 673 | 672 |
| 674 // Release the reference to the request context. There could be multiple | 673 // Release the reference to the request context. There could be multiple |
| 675 // references to URLFetcher::Core at this point so it may take a while to | 674 // references to URLFetcher::Core at this point so it may take a while to |
| 676 // delete the object, but we cannot delay the destruction of the request | 675 // delete the object, but we cannot delay the destruction of the request |
| 677 // context. | 676 // context. |
| 678 request_context_getter_ = NULL; | 677 request_context_getter_ = NULL; |
| 679 first_party_for_cookies_ = GURL(); | 678 first_party_for_cookies_ = GURL(); |
| 680 url_request_data_key_ = NULL; | 679 url_request_data_key_ = NULL; |
| 681 url_request_create_data_callback_.Reset(); | 680 url_request_create_data_callback_.Reset(); |
| 682 was_cancelled_ = true; | 681 was_cancelled_ = true; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 } | 929 } |
| 931 | 930 |
| 932 void URLFetcherCore::AssertHasNoUploadData() const { | 931 void URLFetcherCore::AssertHasNoUploadData() const { |
| 933 DCHECK(!upload_content_set_); | 932 DCHECK(!upload_content_set_); |
| 934 DCHECK(upload_content_.empty()); | 933 DCHECK(upload_content_.empty()); |
| 935 DCHECK(upload_file_path_.empty()); | 934 DCHECK(upload_file_path_.empty()); |
| 936 DCHECK(upload_stream_factory_.is_null()); | 935 DCHECK(upload_stream_factory_.is_null()); |
| 937 } | 936 } |
| 938 | 937 |
| 939 } // namespace net | 938 } // namespace net |
| OLD | NEW |