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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 447 |
448 void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) { | 448 void URLRequest::set_referrer_policy(ReferrerPolicy referrer_policy) { |
449 DCHECK(!is_pending_); | 449 DCHECK(!is_pending_); |
450 referrer_policy_ = referrer_policy; | 450 referrer_policy_ = referrer_policy; |
451 } | 451 } |
452 | 452 |
453 void URLRequest::set_delegate(Delegate* delegate) { | 453 void URLRequest::set_delegate(Delegate* delegate) { |
454 delegate_ = delegate; | 454 delegate_ = delegate; |
455 } | 455 } |
456 | 456 |
| 457 bool URLRequest::CanThrottle() const { |
| 458 return !network_delegate_ || network_delegate_->CanThrottleRequest(*this); |
| 459 } |
| 460 |
457 void URLRequest::Start() { | 461 void URLRequest::Start() { |
458 DCHECK_EQ(network_delegate_, context_->network_delegate()); | 462 DCHECK_EQ(network_delegate_, context_->network_delegate()); |
459 | 463 |
460 g_url_requests_started = true; | 464 g_url_requests_started = true; |
461 response_info_.request_time = base::Time::Now(); | 465 response_info_.request_time = base::Time::Now(); |
462 | 466 |
463 load_timing_info_ = LoadTimingInfo(); | 467 load_timing_info_ = LoadTimingInfo(); |
464 load_timing_info_.request_start_time = response_info_.request_time; | 468 load_timing_info_.request_start_time = response_info_.request_time; |
465 load_timing_info_.request_start = base::TimeTicks::Now(); | 469 load_timing_info_.request_start = base::TimeTicks::Now(); |
466 | 470 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 --redirect_limit_; | 817 --redirect_limit_; |
814 | 818 |
815 Start(); | 819 Start(); |
816 return OK; | 820 return OK; |
817 } | 821 } |
818 | 822 |
819 const URLRequestContext* URLRequest::context() const { | 823 const URLRequestContext* URLRequest::context() const { |
820 return context_; | 824 return context_; |
821 } | 825 } |
822 | 826 |
| 827 NetworkDelegate* URLRequest::network_delegate() const { |
| 828 return network_delegate_; |
| 829 } |
| 830 |
823 int64 URLRequest::GetExpectedContentSize() const { | 831 int64 URLRequest::GetExpectedContentSize() const { |
824 int64 expected_content_size = -1; | 832 int64 expected_content_size = -1; |
825 if (job_) | 833 if (job_) |
826 expected_content_size = job_->expected_content_size(); | 834 expected_content_size = job_->expected_content_size(); |
827 | 835 |
828 return expected_content_size; | 836 return expected_content_size; |
829 } | 837 } |
830 | 838 |
831 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { | 839 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { |
832 const GURL& url = this->url(); | 840 const GURL& url = this->url(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 new base::debug::StackTrace(NULL, 0); | 1006 new base::debug::StackTrace(NULL, 0); |
999 *stack_trace_copy = stack_trace; | 1007 *stack_trace_copy = stack_trace; |
1000 stack_trace_.reset(stack_trace_copy); | 1008 stack_trace_.reset(stack_trace_copy); |
1001 } | 1009 } |
1002 | 1010 |
1003 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1011 const base::debug::StackTrace* URLRequest::stack_trace() const { |
1004 return stack_trace_.get(); | 1012 return stack_trace_.get(); |
1005 } | 1013 } |
1006 | 1014 |
1007 } // namespace net | 1015 } // namespace net |
OLD | NEW |