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