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