| 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/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 if (transaction_.get()) { | 300 if (transaction_.get()) { |
| 301 rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_); | 301 rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_); |
| 302 auth_credentials_ = AuthCredentials(); | 302 auth_credentials_ = AuthCredentials(); |
| 303 } else { | 303 } else { |
| 304 DCHECK(request_->context()); | 304 DCHECK(request_->context()); |
| 305 DCHECK(request_->context()->http_transaction_factory()); | 305 DCHECK(request_->context()->http_transaction_factory()); |
| 306 | 306 |
| 307 rv = request_->context()->http_transaction_factory()->CreateTransaction( | 307 rv = request_->context()->http_transaction_factory()->CreateTransaction( |
| 308 &transaction_); | 308 &transaction_); |
| 309 if (rv == OK) { | 309 if (rv == OK) { |
| 310 // TODO(joi): The hard-coded check for "chrome-extension" is | 310 if (!throttling_entry_ || |
| 311 // temporary (as of 2012/3/21), intended only to make sure this | 311 !throttling_entry_->ShouldRejectRequest(*request_)) { |
| 312 // change (to throttle only requests originating from | |
| 313 // extensions) gets into M19. Right after the M19 branch point, | |
| 314 // I will sort this out in a more architecturally-sound way. | |
| 315 URLRequestThrottlerManager* manager = | |
| 316 request_->context()->throttler_manager(); | |
| 317 DCHECK(!manager || throttling_entry_); | |
| 318 if (!manager || | |
| 319 !manager->enforce_throttling() || | |
| 320 request_->first_party_for_cookies().scheme() != "chrome-extension" || | |
| 321 !throttling_entry_->ShouldRejectRequest(request_info_.load_flags)) { | |
| 322 rv = transaction_->Start( | 312 rv = transaction_->Start( |
| 323 &request_info_, start_callback_, request_->net_log()); | 313 &request_info_, start_callback_, request_->net_log()); |
| 324 start_time_ = base::TimeTicks::Now(); | 314 start_time_ = base::TimeTicks::Now(); |
| 325 } else { | 315 } else { |
| 326 // Special error code for the exponential back-off module. | 316 // Special error code for the exponential back-off module. |
| 327 rv = ERR_TEMPORARILY_THROTTLED; | 317 rv = ERR_TEMPORARILY_THROTTLED; |
| 328 } | 318 } |
| 329 } | 319 } |
| 330 } | 320 } |
| 331 | 321 |
| (...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 return override_response_headers_.get() ? | 1387 return override_response_headers_.get() ? |
| 1398 override_response_headers_ : | 1388 override_response_headers_ : |
| 1399 transaction_->GetResponseInfo()->headers; | 1389 transaction_->GetResponseInfo()->headers; |
| 1400 } | 1390 } |
| 1401 | 1391 |
| 1402 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1392 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1403 awaiting_callback_ = false; | 1393 awaiting_callback_ = false; |
| 1404 } | 1394 } |
| 1405 | 1395 |
| 1406 } // namespace net | 1396 } // namespace net |
| OLD | NEW |