| 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 573 |
| 574 void HttpNetworkTransaction::OnQuicBroken() { | 574 void HttpNetworkTransaction::OnQuicBroken() { |
| 575 net_error_details_.quic_broken = true; | 575 net_error_details_.quic_broken = true; |
| 576 } | 576 } |
| 577 | 577 |
| 578 void HttpNetworkTransaction::GetConnectionAttempts( | 578 void HttpNetworkTransaction::GetConnectionAttempts( |
| 579 ConnectionAttempts* out) const { | 579 ConnectionAttempts* out) const { |
| 580 *out = connection_attempts_; | 580 *out = connection_attempts_; |
| 581 } | 581 } |
| 582 | 582 |
| 583 void HttpNetworkTransaction::OnThrottleStateChanged() { | 583 void HttpNetworkTransaction::OnThrottleUnblocked( |
| 584 NetworkThrottleManager::Throttle* throttle) { |
| 584 // TODO(rdsmith): This DCHECK is dependent on the only transition | 585 // TODO(rdsmith): This DCHECK is dependent on the only transition |
| 585 // being from throttled->unthrottled. That is true right now, but may not | 586 // being from blocked->unblocked. That is true right now, but may not |
| 586 // be so in the future. | 587 // be so in the future. |
| 587 DCHECK_EQ(STATE_THROTTLE_COMPLETE, next_state_); | 588 DCHECK_EQ(STATE_THROTTLE_COMPLETE, next_state_); |
| 588 | 589 |
| 589 net_log_.EndEvent(NetLogEventType::HTTP_TRANSACTION_THROTTLED); | 590 net_log_.EndEvent(NetLogEventType::HTTP_TRANSACTION_THROTTLED); |
| 590 | 591 |
| 591 DoLoop(OK); | 592 DoLoop(OK); |
| 592 } | 593 } |
| 593 | 594 |
| 594 bool HttpNetworkTransaction::IsSecureRequest() const { | 595 bool HttpNetworkTransaction::IsSecureRequest() const { |
| 595 return request_->url.SchemeIsCryptographic(); | 596 return request_->url.SchemeIsCryptographic(); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 NOTREACHED() << "bad state"; | 775 NOTREACHED() << "bad state"; |
| 775 rv = ERR_FAILED; | 776 rv = ERR_FAILED; |
| 776 break; | 777 break; |
| 777 } | 778 } |
| 778 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 779 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
| 779 | 780 |
| 780 return rv; | 781 return rv; |
| 781 } | 782 } |
| 782 | 783 |
| 783 int HttpNetworkTransaction::DoThrottle() { | 784 int HttpNetworkTransaction::DoThrottle() { |
| 785 DCHECK(!throttle_); |
| 784 throttle_ = session_->throttler()->CreateThrottle( | 786 throttle_ = session_->throttler()->CreateThrottle( |
| 785 this, priority_, (request_->load_flags & LOAD_IGNORE_LIMITS) != 0); | 787 this, priority_, (request_->load_flags & LOAD_IGNORE_LIMITS) != 0); |
| 786 next_state_ = STATE_THROTTLE_COMPLETE; | 788 next_state_ = STATE_THROTTLE_COMPLETE; |
| 787 | 789 |
| 788 if (throttle_->IsThrottled()) { | 790 if (throttle_->IsBlocked()) { |
| 789 net_log_.BeginEvent(NetLogEventType::HTTP_TRANSACTION_THROTTLED); | 791 net_log_.BeginEvent(NetLogEventType::HTTP_TRANSACTION_THROTTLED); |
| 790 return ERR_IO_PENDING; | 792 return ERR_IO_PENDING; |
| 791 } | 793 } |
| 792 | 794 |
| 793 return OK; | 795 return OK; |
| 794 } | 796 } |
| 795 | 797 |
| 796 int HttpNetworkTransaction::DoThrottleComplete() { | 798 int HttpNetworkTransaction::DoThrottleComplete() { |
| 797 DCHECK(throttle_); | 799 DCHECK(throttle_); |
| 798 DCHECK(!throttle_->IsThrottled()); | 800 DCHECK(!throttle_->IsBlocked()); |
| 799 | 801 |
| 800 next_state_ = STATE_NOTIFY_BEFORE_CREATE_STREAM; | 802 next_state_ = STATE_NOTIFY_BEFORE_CREATE_STREAM; |
| 801 | 803 |
| 802 return OK; | 804 return OK; |
| 803 } | 805 } |
| 804 | 806 |
| 805 int HttpNetworkTransaction::DoNotifyBeforeCreateStream() { | 807 int HttpNetworkTransaction::DoNotifyBeforeCreateStream() { |
| 806 next_state_ = STATE_CREATE_STREAM; | 808 next_state_ = STATE_CREATE_STREAM; |
| 807 bool defer = false; | 809 bool defer = false; |
| 808 if (!before_network_start_callback_.is_null()) | 810 if (!before_network_start_callback_.is_null()) |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 DCHECK(stream_request_); | 1685 DCHECK(stream_request_); |
| 1684 | 1686 |
| 1685 // Since the transaction can restart with auth credentials, it may create a | 1687 // Since the transaction can restart with auth credentials, it may create a |
| 1686 // stream more than once. Accumulate all of the connection attempts across | 1688 // stream more than once. Accumulate all of the connection attempts across |
| 1687 // those streams by appending them to the vector: | 1689 // those streams by appending them to the vector: |
| 1688 for (const auto& attempt : stream_request_->connection_attempts()) | 1690 for (const auto& attempt : stream_request_->connection_attempts()) |
| 1689 connection_attempts_.push_back(attempt); | 1691 connection_attempts_.push_back(attempt); |
| 1690 } | 1692 } |
| 1691 | 1693 |
| 1692 } // namespace net | 1694 } // namespace net |
| OLD | NEW |