| 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.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) { | 478 void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) { |
| 479 DCHECK(!is_pending_); | 479 DCHECK(!is_pending_); |
| 480 referrer_policy_ = referrer_policy; | 480 referrer_policy_ = referrer_policy; |
| 481 } | 481 } |
| 482 | 482 |
| 483 void URLRequest::set_delegate(Delegate* delegate) { | 483 void URLRequest::set_delegate(Delegate* delegate) { |
| 484 delegate_ = delegate; | 484 delegate_ = delegate; |
| 485 } | 485 } |
| 486 | 486 |
| 487 void URLRequest::set_lofi_state(LoFiState lofi_state) { |
| 488 lofi_state_ = lofi_state; |
| 489 } |
| 490 |
| 487 void URLRequest::Start() { | 491 void URLRequest::Start() { |
| 488 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456327 is fixed. | 492 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456327 is fixed. |
| 489 tracked_objects::ScopedTracker tracking_profile( | 493 tracked_objects::ScopedTracker tracking_profile( |
| 490 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::Start")); | 494 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::Start")); |
| 491 | 495 |
| 492 // Some values can be NULL, but the job factory must not be. | 496 // Some values can be NULL, but the job factory must not be. |
| 493 DCHECK(context_->job_factory()); | 497 DCHECK(context_->job_factory()); |
| 494 | 498 |
| 495 // Anything that sets |blocked_by_| before start should have cleaned up after | 499 // Anything that sets |blocked_by_| before start should have cleaned up after |
| 496 // itself. | 500 // itself. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 redirect_limit_(kMaxRedirects), | 554 redirect_limit_(kMaxRedirects), |
| 551 priority_(priority), | 555 priority_(priority), |
| 552 identifier_(GenerateURLRequestIdentifier()), | 556 identifier_(GenerateURLRequestIdentifier()), |
| 553 calling_delegate_(false), | 557 calling_delegate_(false), |
| 554 use_blocked_by_as_load_param_(false), | 558 use_blocked_by_as_load_param_(false), |
| 555 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, | 559 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, |
| 556 base::Unretained(this))), | 560 base::Unretained(this))), |
| 557 has_notified_completion_(false), | 561 has_notified_completion_(false), |
| 558 received_response_content_length_(0), | 562 received_response_content_length_(0), |
| 559 creation_time_(base::TimeTicks::Now()), | 563 creation_time_(base::TimeTicks::Now()), |
| 560 notified_before_network_start_(false) { | 564 notified_before_network_start_(false), |
| 565 lofi_state_(LOFI_DEFAULT) { |
| 561 // Sanity check out environment. | 566 // Sanity check out environment. |
| 562 DCHECK(base::MessageLoop::current()) | 567 DCHECK(base::MessageLoop::current()) |
| 563 << "The current base::MessageLoop must exist"; | 568 << "The current base::MessageLoop must exist"; |
| 564 | 569 |
| 565 context->url_requests()->insert(this); | 570 context->url_requests()->insert(this); |
| 566 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); | 571 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); |
| 567 } | 572 } |
| 568 | 573 |
| 569 void URLRequest::BeforeRequestComplete(int error) { | 574 void URLRequest::BeforeRequestComplete(int error) { |
| 570 DCHECK(!job_.get()); | 575 DCHECK(!job_.get()); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 } | 1191 } |
| 1187 | 1192 |
| 1188 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { | 1193 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { |
| 1189 if (job_) | 1194 if (job_) |
| 1190 job_->GetConnectionAttempts(out); | 1195 job_->GetConnectionAttempts(out); |
| 1191 else | 1196 else |
| 1192 out->clear(); | 1197 out->clear(); |
| 1193 } | 1198 } |
| 1194 | 1199 |
| 1195 } // namespace net | 1200 } // namespace net |
| OLD | NEW |