Index: net/http/http_network_transaction.cc |
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc |
index 9917c69f04b81d4326bccfbca4bce66f6f9f7b8a..d732e49afc7241043e2905eb5178f9f70601d837 100644 |
--- a/net/http/http_network_transaction.cc |
+++ b/net/http/http_network_transaction.cc |
@@ -604,6 +604,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_); |
+ |
+ DoLoop(OK); |
+} |
+ |
bool HttpNetworkTransaction::IsSecureRequest() const { |
return request_->url.SchemeIsCryptographic(); |
} |
@@ -674,6 +683,9 @@ int HttpNetworkTransaction::DoLoop(int result) { |
State state = next_state_; |
next_state_ = STATE_NONE; |
switch (state) { |
+ case STATE_THROTTLE: |
+ DCHECK_EQ(OK, rv); |
+ rv = DoThrottle(); |
case STATE_NOTIFY_BEFORE_CREATE_STREAM: |
DCHECK_EQ(OK, rv); |
rv = DoNotifyBeforeCreateStream(); |
@@ -785,6 +797,21 @@ int HttpNetworkTransaction::DoLoop(int result) { |
return rv; |
} |
+int HttpNetworkTransaction::DoThrottle() { |
+ throttle_ = session_->throttler()->CreateThrottle( |
+ priority_, request_->load_flags & LOAD_IGNORE_LIMITS); |
mmenke
2016/04/29 16:57:28
The implicit conversion of "request_->load_flags &
mmenke
2016/04/29 16:57:28
One ownership suggestion: We could make the throt
Randy Smith (Not in Mondays)
2016/05/08 00:46:30
So I'm inclined against that given the current app
Randy Smith (Not in Mondays)
2016/05/08 00:46:31
Heh. Only on windows. Even more confusing, this
mmenke
2016/05/09 17:37:48
So it's one thing to do "if (x & FLAG)" - that tak
mmenke
2016/05/09 17:37:48
Do you think it's that implementing needed behavio
mmenke
2016/05/09 18:21:21
Hrm...thinking a bit more on this, I really like t
mmenke
2016/05/09 20:49:41
Erm...Hope you managed to understand that, but tha
Randy Smith (Not in Mondays)
2016/05/09 22:12:54
No, actually, my current plan is very much to do m
Randy Smith (Not in Mondays)
2016/05/09 22:12:54
Yeah, this :-}. I'm not really worried about sync
mmenke
2016/05/11 18:12:38
I'm not concerned about the changes to how THROTTL
|
+ |
+ // If this transaction is currently throttled, the throttler will notify |
+ // when it is unthrottled through OnThrottleStateChanged(). |
+ if (throttle_->throttled()) { |
+ next_state_ = STATE_THROTTLE; |
+ return ERR_IO_PENDING; |
+ } |
+ |
+ next_state_ = STATE_NOTIFY_BEFORE_CREATE_STREAM; |
+ return OK; |
+} |
+ |
int HttpNetworkTransaction::DoNotifyBeforeCreateStream() { |
next_state_ = STATE_CREATE_STREAM; |
bool defer = false; |