| Index: net/url_request/url_request.cc
|
| diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
|
| index 57e9fb83c8bea631440291bf2c3074f1a0166379..2d9a9a6221be8548f0a23551899487bad3578364 100644
|
| --- a/net/url_request/url_request.cc
|
| +++ b/net/url_request/url_request.cc
|
| @@ -216,7 +216,7 @@ URLRequest::URLRequest(const GURL& url,
|
| is_pending_(false),
|
| is_redirecting_(false),
|
| redirect_limit_(kMaxRedirects),
|
| - priority_(DEFAULT_PRIORITY),
|
| + base_priority_(DEFAULT_PRIORITY),
|
| identifier_(GenerateURLRequestIdentifier()),
|
| calling_delegate_(false),
|
| delegate_info_usage_(DELEGATE_INFO_DEBUG_ONLY),
|
| @@ -253,7 +253,7 @@ URLRequest::URLRequest(const GURL& url,
|
| is_pending_(false),
|
| is_redirecting_(false),
|
| redirect_limit_(kMaxRedirects),
|
| - priority_(DEFAULT_PRIORITY),
|
| + base_priority_(DEFAULT_PRIORITY),
|
| identifier_(GenerateURLRequestIdentifier()),
|
| calling_delegate_(false),
|
| delegate_info_usage_(DELEGATE_INFO_DEBUG_ONLY),
|
| @@ -535,6 +535,12 @@ int URLRequest::GetResponseCode() const {
|
| return job_->GetResponseCode();
|
| }
|
|
|
| +void URLRequest::SetLoadFlags(int flags) {
|
| + if ((load_flags_ & LOAD_IGNORE_LIMITS) != (flags & LOAD_IGNORE_LIMITS))
|
| + DCHECK(!job_);
|
| + load_flags_ = flags;
|
| +}
|
| +
|
| // static
|
| void URLRequest::SetDefaultCookiePolicyToBlock() {
|
| CHECK(!g_url_requests_started);
|
| @@ -682,12 +688,12 @@ void URLRequest::StartJob(URLRequestJob* job) {
|
| net_log_.BeginEvent(
|
| NetLog::TYPE_URL_REQUEST_START_JOB,
|
| base::Bind(&NetLogURLRequestStartCallback,
|
| - &url(), &method_, load_flags_, priority_,
|
| + &url(), &method_, load_flags_, GetPriority(),
|
| upload_data_stream_ ? upload_data_stream_->identifier() : -1));
|
|
|
| job_ = job;
|
| job_->SetExtraRequestHeaders(extra_request_headers_);
|
| - job_->SetPriority(priority_);
|
| + job_->SetPriority(GetPriority());
|
|
|
| if (upload_data_stream_.get())
|
| job_->SetUpload(upload_data_stream_.get());
|
| @@ -994,17 +1000,25 @@ int64 URLRequest::GetExpectedContentSize() const {
|
| return expected_content_size;
|
| }
|
|
|
| +RequestPriority URLRequest::GetPriority() const {
|
| + return (load_flags_ & LOAD_IGNORE_LIMITS) ? MAXIMUM_PRIORITY : base_priority_;
|
| +}
|
| +
|
| void URLRequest::SetPriority(RequestPriority priority) {
|
| DCHECK_GE(priority, MINIMUM_PRIORITY);
|
| DCHECK_LE(priority, MAXIMUM_PRIORITY);
|
| - if (priority_ == priority)
|
| +
|
| + RequestPriority old_priority = GetPriority();
|
| +
|
| + base_priority_ = priority;
|
| +
|
| + if (GetPriority() == old_priority)
|
| return;
|
|
|
| - priority_ = priority;
|
| if (job_.get()) {
|
| net_log_.AddEvent(NetLog::TYPE_URL_REQUEST_SET_PRIORITY,
|
| - NetLog::IntegerCallback("priority", priority_));
|
| - job_->SetPriority(priority_);
|
| + NetLog::IntegerCallback("priority", GetPriority()));
|
| + job_->SetPriority(GetPriority());
|
| }
|
| }
|
|
|
|
|