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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 586 |
587 void HttpNetworkTransaction::OnQuicBroken() { | 587 void HttpNetworkTransaction::OnQuicBroken() { |
588 net_error_details_.quic_broken = true; | 588 net_error_details_.quic_broken = true; |
589 } | 589 } |
590 | 590 |
591 void HttpNetworkTransaction::GetConnectionAttempts( | 591 void HttpNetworkTransaction::GetConnectionAttempts( |
592 ConnectionAttempts* out) const { | 592 ConnectionAttempts* out) const { |
593 *out = connection_attempts_; | 593 *out = connection_attempts_; |
594 } | 594 } |
595 | 595 |
596 void HttpNetworkTransaction::OnThrottleUnblocked( | 596 void HttpNetworkTransaction::OnThrottleStateChanged() { |
597 NetworkThrottleManager::Throttle* throttle) { | |
598 // TODO(rdsmith): This DCHECK is dependent on the only transition | 597 // TODO(rdsmith): This DCHECK is dependent on the only transition |
599 // being from blocked->unblocked. That is true right now, but may not | 598 // being from throttled->unthrottled. That is true right now, but may not |
600 // be so in the future. | 599 // be so in the future. |
601 DCHECK_EQ(STATE_THROTTLE_COMPLETE, next_state_); | 600 DCHECK_EQ(STATE_THROTTLE_COMPLETE, next_state_); |
602 | 601 |
603 net_log_.EndEvent(NetLogEventType::HTTP_TRANSACTION_THROTTLED); | 602 net_log_.EndEvent(NetLogEventType::HTTP_TRANSACTION_THROTTLED); |
604 | 603 |
605 DoLoop(OK); | 604 DoLoop(OK); |
606 } | 605 } |
607 | 606 |
608 bool HttpNetworkTransaction::IsSecureRequest() const { | 607 bool HttpNetworkTransaction::IsSecureRequest() const { |
609 return request_->url.SchemeIsCryptographic(); | 608 return request_->url.SchemeIsCryptographic(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 NOTREACHED() << "bad state"; | 791 NOTREACHED() << "bad state"; |
793 rv = ERR_FAILED; | 792 rv = ERR_FAILED; |
794 break; | 793 break; |
795 } | 794 } |
796 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 795 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
797 | 796 |
798 return rv; | 797 return rv; |
799 } | 798 } |
800 | 799 |
801 int HttpNetworkTransaction::DoThrottle() { | 800 int HttpNetworkTransaction::DoThrottle() { |
802 DCHECK(!throttle_); | |
803 throttle_ = session_->throttler()->CreateThrottle( | 801 throttle_ = session_->throttler()->CreateThrottle( |
804 this, priority_, (request_->load_flags & LOAD_IGNORE_LIMITS) != 0); | 802 this, priority_, (request_->load_flags & LOAD_IGNORE_LIMITS) != 0); |
805 next_state_ = STATE_THROTTLE_COMPLETE; | 803 next_state_ = STATE_THROTTLE_COMPLETE; |
806 | 804 |
807 if (throttle_->IsBlocked()) { | 805 if (throttle_->IsThrottled()) { |
808 net_log_.BeginEvent(NetLogEventType::HTTP_TRANSACTION_THROTTLED); | 806 net_log_.BeginEvent(NetLogEventType::HTTP_TRANSACTION_THROTTLED); |
809 return ERR_IO_PENDING; | 807 return ERR_IO_PENDING; |
810 } | 808 } |
811 | 809 |
812 return OK; | 810 return OK; |
813 } | 811 } |
814 | 812 |
815 int HttpNetworkTransaction::DoThrottleComplete() { | 813 int HttpNetworkTransaction::DoThrottleComplete() { |
816 DCHECK(throttle_); | 814 DCHECK(throttle_); |
817 DCHECK(!throttle_->IsBlocked()); | 815 DCHECK(!throttle_->IsThrottled()); |
818 | 816 |
819 next_state_ = STATE_NOTIFY_BEFORE_CREATE_STREAM; | 817 next_state_ = STATE_NOTIFY_BEFORE_CREATE_STREAM; |
820 | 818 |
821 return OK; | 819 return OK; |
822 } | 820 } |
823 | 821 |
824 int HttpNetworkTransaction::DoNotifyBeforeCreateStream() { | 822 int HttpNetworkTransaction::DoNotifyBeforeCreateStream() { |
825 next_state_ = STATE_CREATE_STREAM; | 823 next_state_ = STATE_CREATE_STREAM; |
826 bool defer = false; | 824 bool defer = false; |
827 if (!before_network_start_callback_.is_null()) | 825 if (!before_network_start_callback_.is_null()) |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 DCHECK(stream_request_); | 1700 DCHECK(stream_request_); |
1703 | 1701 |
1704 // Since the transaction can restart with auth credentials, it may create a | 1702 // Since the transaction can restart with auth credentials, it may create a |
1705 // stream more than once. Accumulate all of the connection attempts across | 1703 // stream more than once. Accumulate all of the connection attempts across |
1706 // those streams by appending them to the vector: | 1704 // those streams by appending them to the vector: |
1707 for (const auto& attempt : stream_request_->connection_attempts()) | 1705 for (const auto& attempt : stream_request_->connection_attempts()) |
1708 connection_attempts_.push_back(attempt); | 1706 connection_attempts_.push_back(attempt); |
1709 } | 1707 } |
1710 | 1708 |
1711 } // namespace net | 1709 } // namespace net |
OLD | NEW |