| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 | 484 |
| 485 void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) { | 485 void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) { |
| 486 DCHECK(!is_pending_); | 486 DCHECK(!is_pending_); |
| 487 referrer_policy_ = referrer_policy; | 487 referrer_policy_ = referrer_policy; |
| 488 } | 488 } |
| 489 | 489 |
| 490 void URLRequest::set_delegate(Delegate* delegate) { | 490 void URLRequest::set_delegate(Delegate* delegate) { |
| 491 delegate_ = delegate; | 491 delegate_ = delegate; |
| 492 } | 492 } |
| 493 | 493 |
| 494 void URLRequest::set_lofi_state(LoFiState lofi_state) { |
| 495 lofi_state_ = lofi_state; |
| 496 } |
| 497 |
| 494 void URLRequest::Start() { | 498 void URLRequest::Start() { |
| 495 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456327 is fixed. | 499 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456327 is fixed. |
| 496 tracked_objects::ScopedTracker tracking_profile( | 500 tracked_objects::ScopedTracker tracking_profile( |
| 497 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::Start")); | 501 FROM_HERE_WITH_EXPLICIT_FUNCTION("456327 URLRequest::Start")); |
| 498 | 502 |
| 499 // Some values can be NULL, but the job factory must not be. | 503 // Some values can be NULL, but the job factory must not be. |
| 500 DCHECK(context_->job_factory()); | 504 DCHECK(context_->job_factory()); |
| 501 | 505 |
| 502 // Anything that sets |blocked_by_| before start should have cleaned up after | 506 // Anything that sets |blocked_by_| before start should have cleaned up after |
| 503 // itself. | 507 // itself. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 redirect_limit_(kMaxRedirects), | 561 redirect_limit_(kMaxRedirects), |
| 558 priority_(priority), | 562 priority_(priority), |
| 559 identifier_(GenerateURLRequestIdentifier()), | 563 identifier_(GenerateURLRequestIdentifier()), |
| 560 calling_delegate_(false), | 564 calling_delegate_(false), |
| 561 use_blocked_by_as_load_param_(false), | 565 use_blocked_by_as_load_param_(false), |
| 562 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, | 566 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, |
| 563 base::Unretained(this))), | 567 base::Unretained(this))), |
| 564 has_notified_completion_(false), | 568 has_notified_completion_(false), |
| 565 received_response_content_length_(0), | 569 received_response_content_length_(0), |
| 566 creation_time_(base::TimeTicks::Now()), | 570 creation_time_(base::TimeTicks::Now()), |
| 567 notified_before_network_start_(false) { | 571 notified_before_network_start_(false), |
| 572 lofi_state_(LOFI_DEFAULT) { |
| 568 // Sanity check out environment. | 573 // Sanity check out environment. |
| 569 DCHECK(base::MessageLoop::current()) | 574 DCHECK(base::MessageLoop::current()) |
| 570 << "The current base::MessageLoop must exist"; | 575 << "The current base::MessageLoop must exist"; |
| 571 | 576 |
| 572 context->url_requests()->insert(this); | 577 context->url_requests()->insert(this); |
| 573 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); | 578 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); |
| 574 } | 579 } |
| 575 | 580 |
| 576 void URLRequest::BeforeRequestComplete(int error) { | 581 void URLRequest::BeforeRequestComplete(int error) { |
| 577 DCHECK(!job_.get()); | 582 DCHECK(!job_.get()); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 } | 1198 } |
| 1194 | 1199 |
| 1195 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { | 1200 void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { |
| 1196 if (job_) | 1201 if (job_) |
| 1197 job_->GetConnectionAttempts(out); | 1202 job_->GetConnectionAttempts(out); |
| 1198 else | 1203 else |
| 1199 out->clear(); | 1204 out->clear(); |
| 1200 } | 1205 } |
| 1201 | 1206 |
| 1202 } // namespace net | 1207 } // namespace net |
| OLD | NEW |