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