| 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_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 void URLRequestHttpJob::DoneWithRequest(CompletionCause reason) { | 1580 void URLRequestHttpJob::DoneWithRequest(CompletionCause reason) { |
| 1581 if (done_) | 1581 if (done_) |
| 1582 return; | 1582 return; |
| 1583 done_ = true; | 1583 done_ = true; |
| 1584 | 1584 |
| 1585 // Notify NetworkQualityEstimator. | 1585 // Notify NetworkQualityEstimator. |
| 1586 if (request()) { | 1586 if (request()) { |
| 1587 NetworkQualityEstimator* network_quality_estimator = | 1587 NetworkQualityEstimator* network_quality_estimator = |
| 1588 request()->context()->network_quality_estimator(); | 1588 request()->context()->network_quality_estimator(); |
| 1589 if (network_quality_estimator) | 1589 if (network_quality_estimator) |
| 1590 network_quality_estimator->NotifyRequestCompleted(*request()); | 1590 network_quality_estimator->NotifyRequestCompleted( |
| 1591 *request(), request_->status().error()); |
| 1591 } | 1592 } |
| 1592 | 1593 |
| 1593 RecordPerfHistograms(reason); | 1594 RecordPerfHistograms(reason); |
| 1594 if (request_) | 1595 if (request_) |
| 1595 request_->set_received_response_content_length(prefilter_bytes_read()); | 1596 request_->set_received_response_content_length(prefilter_bytes_read()); |
| 1596 } | 1597 } |
| 1597 | 1598 |
| 1598 HttpResponseHeaders* URLRequestHttpJob::GetResponseHeaders() const { | 1599 HttpResponseHeaders* URLRequestHttpJob::GetResponseHeaders() const { |
| 1599 DCHECK(transaction_.get()); | 1600 DCHECK(transaction_.get()); |
| 1600 DCHECK(transaction_->GetResponseInfo()); | 1601 DCHECK(transaction_->GetResponseInfo()); |
| 1601 return override_response_headers_.get() ? | 1602 return override_response_headers_.get() ? |
| 1602 override_response_headers_.get() : | 1603 override_response_headers_.get() : |
| 1603 transaction_->GetResponseInfo()->headers.get(); | 1604 transaction_->GetResponseInfo()->headers.get(); |
| 1604 } | 1605 } |
| 1605 | 1606 |
| 1606 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1607 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1607 awaiting_callback_ = false; | 1608 awaiting_callback_ = false; |
| 1608 | 1609 |
| 1609 // Notify NetworkQualityEstimator. | 1610 // Notify NetworkQualityEstimator. |
| 1610 if (request()) { | 1611 if (request()) { |
| 1611 NetworkQualityEstimator* network_quality_estimator = | 1612 NetworkQualityEstimator* network_quality_estimator = |
| 1612 request()->context()->network_quality_estimator(); | 1613 request()->context()->network_quality_estimator(); |
| 1613 if (network_quality_estimator) | 1614 if (network_quality_estimator) |
| 1614 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1615 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1615 } | 1616 } |
| 1616 } | 1617 } |
| 1617 | 1618 |
| 1618 } // namespace net | 1619 } // namespace net |
| OLD | NEW |