Chromium Code Reviews| Index: net/http/http_network_transaction.cc |
| diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc |
| index 120436443e4128f972a61b6982c5d308275e4459..906a30a479b0a40c0e093e348ad19145ad352d1d 100644 |
| --- a/net/http/http_network_transaction.cc |
| +++ b/net/http/http_network_transaction.cc |
| @@ -120,7 +120,8 @@ HttpNetworkTransaction::HttpNetworkTransaction(RequestPriority priority, |
| next_state_(STATE_NONE), |
| establishing_tunnel_(false), |
| websocket_handshake_stream_base_create_helper_(NULL), |
| - net_error_details_() { |
| + net_error_details_(), |
| + throttle_(session->throttler()->CreateThrottle(priority)) { |
|
mmenke
2016/04/18 14:57:55
Also, making this part of the HttpNetworkSession s
mmenke
2016/04/18 14:57:55
BUG: Needs load_flags & LOAD_IGNORE_LIMITS as an
Randy Smith (Not in Mondays)
2016/04/19 11:37:05
Hmmm. I'm not sure I see a lot of good alternativ
Randy Smith (Not in Mondays)
2016/04/19 11:37:05
Acknowledged.
mmenke
2016/04/19 13:52:10
I'll think a bit about it - this may be the best p
Randy Smith (Not in Mondays)
2016/04/20 21:57:38
Done.
|
| session->ssl_config_service()->GetSSLConfig(&server_ssl_config_); |
| session->GetAlpnProtos(&server_ssl_config_.alpn_protos); |
| session->GetNpnProtos(&server_ssl_config_.npn_protos); |
| @@ -605,6 +606,15 @@ void HttpNetworkTransaction::GetConnectionAttempts( |
| *out = connection_attempts_; |
| } |
| +void HttpNetworkTransaction::OnThrottleStateChanged() { |
| + // TODO(rdsmith): This DCHECK is dependent on the throttle state |
| + // initializing as throttled only transition from throttled->unthrottled. |
| + // That is true right now, but may not be so in the future. |
| + DCHECK_EQ(STATE_NOTIFY_BEFORE_CREATE_STREAM, next_state_); |
|
mmenke
2016/04/18 14:57:55
This seems fragile to me, as it requires a transac
Randy Smith (Not in Mondays)
2016/04/19 11:37:05
So I agree in the abstract, and am happy to change
mmenke
2016/04/19 13:52:10
It was actually more a comment about the correctne
Randy Smith (Not in Mondays)
2016/04/20 21:57:38
Done.
|
| + |
| + DoLoop(OK); |
| +} |
| + |
| bool HttpNetworkTransaction::IsSecureRequest() const { |
| return request_->url.SchemeIsCryptographic(); |
| } |
| @@ -787,6 +797,11 @@ int HttpNetworkTransaction::DoLoop(int result) { |
| } |
| int HttpNetworkTransaction::DoNotifyBeforeCreateStream() { |
| + // If this transaction is currently throttled, the throttler will notify |
| + // when it is unthrottled through OnThrottleStateChanged(). |
| + if (throttle_->throttled()) |
| + return ERR_IO_PENDING; |
| + |
| next_state_ = STATE_CREATE_STREAM; |
| bool defer = false; |
| if (!before_network_start_callback_.is_null()) |