| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 169 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
| 170 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), | 170 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), |
| 171 ALLOW_THIS_IN_INITIALIZER_LIST(start_callback_( | 171 ALLOW_THIS_IN_INITIALIZER_LIST(start_callback_( |
| 172 base::Bind(&URLRequestHttpJob::OnStartCompleted, | 172 base::Bind(&URLRequestHttpJob::OnStartCompleted, |
| 173 base::Unretained(this)))), | 173 base::Unretained(this)))), |
| 174 ALLOW_THIS_IN_INITIALIZER_LIST(notify_before_headers_sent_callback_( | 174 ALLOW_THIS_IN_INITIALIZER_LIST(notify_before_headers_sent_callback_( |
| 175 base::Bind(&URLRequestHttpJob::NotifyBeforeSendHeadersCallback, | 175 base::Bind(&URLRequestHttpJob::NotifyBeforeSendHeadersCallback, |
| 176 base::Unretained(this)))), | 176 base::Unretained(this)))), |
| 177 read_in_progress_(false), | 177 read_in_progress_(false), |
| 178 transaction_(NULL), | 178 transaction_(NULL), |
| 179 throttling_entry_(URLRequestThrottlerManager::GetInstance()-> | 179 throttling_entry_(request->context()->throttler_manager()-> |
| 180 RegisterRequestUrl(request->url())), | 180 RegisterRequestUrl(request->url())), |
| 181 sdch_dictionary_advertised_(false), | 181 sdch_dictionary_advertised_(false), |
| 182 sdch_test_activated_(false), | 182 sdch_test_activated_(false), |
| 183 sdch_test_control_(false), | 183 sdch_test_control_(false), |
| 184 is_cached_content_(false), | 184 is_cached_content_(false), |
| 185 request_creation_time_(), | 185 request_creation_time_(), |
| 186 packet_timing_enabled_(false), | 186 packet_timing_enabled_(false), |
| 187 done_(false), | 187 done_(false), |
| 188 bytes_observed_in_packets_(0), | 188 bytes_observed_in_packets_(0), |
| 189 request_time_snapshot_(), | 189 request_time_snapshot_(), |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 DCHECK(request_->context()->http_transaction_factory()); | 318 DCHECK(request_->context()->http_transaction_factory()); |
| 319 | 319 |
| 320 rv = request_->context()->http_transaction_factory()->CreateTransaction( | 320 rv = request_->context()->http_transaction_factory()->CreateTransaction( |
| 321 &transaction_); | 321 &transaction_); |
| 322 if (rv == OK) { | 322 if (rv == OK) { |
| 323 // TODO(joi): The hard-coded check for "chrome-extension" is | 323 // TODO(joi): The hard-coded check for "chrome-extension" is |
| 324 // temporary (as of 2012/3/21), intended only to make sure this | 324 // temporary (as of 2012/3/21), intended only to make sure this |
| 325 // change (to throttle only requests originating from | 325 // change (to throttle only requests originating from |
| 326 // extensions) gets into M19. Right after the M19 branch point, | 326 // extensions) gets into M19. Right after the M19 branch point, |
| 327 // I will sort this out in a more architecturally-sound way. | 327 // I will sort this out in a more architecturally-sound way. |
| 328 if (!URLRequestThrottlerManager::GetInstance()->enforce_throttling() || | 328 if (!request_->context()->throttler_manager()->enforce_throttling() || |
| 329 request_->first_party_for_cookies().scheme() != "chrome-extension" || | 329 request_->first_party_for_cookies().scheme() != "chrome-extension" || |
| 330 !throttling_entry_->ShouldRejectRequest(request_info_.load_flags)) { | 330 !throttling_entry_->ShouldRejectRequest(request_info_.load_flags)) { |
| 331 rv = transaction_->Start( | 331 rv = transaction_->Start( |
| 332 &request_info_, start_callback_, request_->net_log()); | 332 &request_info_, start_callback_, request_->net_log()); |
| 333 start_time_ = base::TimeTicks::Now(); | 333 start_time_ = base::TimeTicks::Now(); |
| 334 } else { | 334 } else { |
| 335 // Special error code for the exponential back-off module. | 335 // Special error code for the exponential back-off module. |
| 336 rv = ERR_TEMPORARILY_THROTTLED; | 336 rv = ERR_TEMPORARILY_THROTTLED; |
| 337 } | 337 } |
| 338 // Make sure the context is alive for the duration of the | 338 // Make sure the context is alive for the duration of the |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 return override_response_headers_.get() ? | 1416 return override_response_headers_.get() ? |
| 1417 override_response_headers_ : | 1417 override_response_headers_ : |
| 1418 transaction_->GetResponseInfo()->headers; | 1418 transaction_->GetResponseInfo()->headers; |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1421 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1422 awaiting_callback_ = false; | 1422 awaiting_callback_ = false; |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 } // namespace net | 1425 } // namespace net |
| OLD | NEW |