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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 DCHECK(!job_); | 519 DCHECK(!job_); |
520 | 520 |
521 net_log_.BeginEvent( | 521 net_log_.BeginEvent( |
522 NetLog::TYPE_URL_REQUEST_START_JOB, | 522 NetLog::TYPE_URL_REQUEST_START_JOB, |
523 base::Bind(&NetLogURLRequestStartCallback, | 523 base::Bind(&NetLogURLRequestStartCallback, |
524 &url(), &method_, load_flags_, priority_, | 524 &url(), &method_, load_flags_, priority_, |
525 upload_data_stream_ ? upload_data_stream_->identifier() : -1)); | 525 upload_data_stream_ ? upload_data_stream_->identifier() : -1)); |
526 | 526 |
527 job_ = job; | 527 job_ = job; |
528 job_->SetExtraRequestHeaders(extra_request_headers_); | 528 job_->SetExtraRequestHeaders(extra_request_headers_); |
| 529 job_->SetPriority(priority_); |
529 | 530 |
530 if (upload_data_stream_.get()) | 531 if (upload_data_stream_.get()) |
531 job_->SetUpload(upload_data_stream_.get()); | 532 job_->SetUpload(upload_data_stream_.get()); |
532 | 533 |
533 is_pending_ = true; | 534 is_pending_ = true; |
534 is_redirecting_ = false; | 535 is_redirecting_ = false; |
535 | 536 |
536 response_info_.was_cached = false; | 537 response_info_.was_cached = false; |
537 | 538 |
538 // Don't allow errors to be sent from within Start(). | 539 // Don't allow errors to be sent from within Start(). |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 } | 822 } |
822 | 823 |
823 int64 URLRequest::GetExpectedContentSize() const { | 824 int64 URLRequest::GetExpectedContentSize() const { |
824 int64 expected_content_size = -1; | 825 int64 expected_content_size = -1; |
825 if (job_) | 826 if (job_) |
826 expected_content_size = job_->expected_content_size(); | 827 expected_content_size = job_->expected_content_size(); |
827 | 828 |
828 return expected_content_size; | 829 return expected_content_size; |
829 } | 830 } |
830 | 831 |
| 832 void URLRequest::SetPriority(RequestPriority priority) { |
| 833 DCHECK_GE(priority, MINIMUM_PRIORITY); |
| 834 DCHECK_LT(priority, NUM_PRIORITIES); |
| 835 if (priority_ == priority) |
| 836 return; |
| 837 |
| 838 priority_ = priority; |
| 839 if (job_) { |
| 840 net_log_.AddEvent(NetLog::TYPE_URL_REQUEST_SET_PRIORITY, |
| 841 NetLog::IntegerCallback("priority", priority_)); |
| 842 job_->SetPriority(priority_); |
| 843 } |
| 844 } |
| 845 |
831 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { | 846 bool URLRequest::GetHSTSRedirect(GURL* redirect_url) const { |
832 const GURL& url = this->url(); | 847 const GURL& url = this->url(); |
833 if (!url.SchemeIs("http")) | 848 if (!url.SchemeIs("http")) |
834 return false; | 849 return false; |
835 TransportSecurityState::DomainState domain_state; | 850 TransportSecurityState::DomainState domain_state; |
836 if (context()->transport_security_state() && | 851 if (context()->transport_security_state() && |
837 context()->transport_security_state()->GetDomainState( | 852 context()->transport_security_state()->GetDomainState( |
838 url.host(), | 853 url.host(), |
839 SSLConfigService::IsSNIAvailable(context()->ssl_config_service()), | 854 SSLConfigService::IsSNIAvailable(context()->ssl_config_service()), |
840 &domain_state) && | 855 &domain_state) && |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 new base::debug::StackTrace(NULL, 0); | 1013 new base::debug::StackTrace(NULL, 0); |
999 *stack_trace_copy = stack_trace; | 1014 *stack_trace_copy = stack_trace; |
1000 stack_trace_.reset(stack_trace_copy); | 1015 stack_trace_.reset(stack_trace_copy); |
1001 } | 1016 } |
1002 | 1017 |
1003 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1018 const base::debug::StackTrace* URLRequest::stack_trace() const { |
1004 return stack_trace_.get(); | 1019 return stack_trace_.get(); |
1005 } | 1020 } |
1006 | 1021 |
1007 } // namespace net | 1022 } // namespace net |
OLD | NEW |