Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: trunk/src/net/url_request/url_request.cc

Issue 47563006: Revert 232802 "[Net] Assert that URLRequests with LOAD_IGNORE_LI..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 void URLRequest::GetCharset(string* charset) { 491 void URLRequest::GetCharset(string* charset) {
492 DCHECK(job_.get()); 492 DCHECK(job_.get());
493 job_->GetCharset(charset); 493 job_->GetCharset(charset);
494 } 494 }
495 495
496 int URLRequest::GetResponseCode() const { 496 int URLRequest::GetResponseCode() const {
497 DCHECK(job_.get()); 497 DCHECK(job_.get());
498 return job_->GetResponseCode(); 498 return job_->GetResponseCode();
499 } 499 }
500 500
501 void URLRequest::SetLoadFlags(int flags) {
502 if ((load_flags_ & LOAD_IGNORE_LIMITS) != (flags & LOAD_IGNORE_LIMITS)) {
503 DCHECK(!job_);
504 DCHECK(flags & LOAD_IGNORE_LIMITS);
505 DCHECK_EQ(priority_, MAXIMUM_PRIORITY);
506 }
507 load_flags_ = flags;
508
509 // This should be a no-op given the above DCHECKs, but do this
510 // anyway for release mode.
511 if ((load_flags_ & LOAD_IGNORE_LIMITS) != 0)
512 SetPriority(MAXIMUM_PRIORITY);
513 }
514
515 // static 501 // static
516 void URLRequest::SetDefaultCookiePolicyToBlock() { 502 void URLRequest::SetDefaultCookiePolicyToBlock() {
517 CHECK(!g_url_requests_started); 503 CHECK(!g_url_requests_started);
518 g_default_can_use_cookies = false; 504 g_default_can_use_cookies = false;
519 } 505 }
520 506
521 // static 507 // static
522 bool URLRequest::IsHandledProtocol(const std::string& scheme) { 508 bool URLRequest::IsHandledProtocol(const std::string& scheme) {
523 return URLRequestJobManager::GetInstance()->SupportsScheme(scheme); 509 return URLRequestJobManager::GetInstance()->SupportsScheme(scheme);
524 } 510 }
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 int64 expected_content_size = -1; 953 int64 expected_content_size = -1;
968 if (job_.get()) 954 if (job_.get())
969 expected_content_size = job_->expected_content_size(); 955 expected_content_size = job_->expected_content_size();
970 956
971 return expected_content_size; 957 return expected_content_size;
972 } 958 }
973 959
974 void URLRequest::SetPriority(RequestPriority priority) { 960 void URLRequest::SetPriority(RequestPriority priority) {
975 DCHECK_GE(priority, MINIMUM_PRIORITY); 961 DCHECK_GE(priority, MINIMUM_PRIORITY);
976 DCHECK_LE(priority, MAXIMUM_PRIORITY); 962 DCHECK_LE(priority, MAXIMUM_PRIORITY);
977
978 if ((load_flags_ & LOAD_IGNORE_LIMITS) && (priority != MAXIMUM_PRIORITY)) {
979 NOTREACHED();
980 // Maintain the invariant that requests with IGNORE_LIMITS set
981 // have MAXIMUM_PRIORITY for release mode.
982 return;
983 }
984
985 if (priority_ == priority) 963 if (priority_ == priority)
986 return; 964 return;
987 965
988 priority_ = priority; 966 priority_ = priority;
989 if (job_.get()) { 967 if (job_.get()) {
990 net_log_.AddEvent(NetLog::TYPE_URL_REQUEST_SET_PRIORITY, 968 net_log_.AddEvent(NetLog::TYPE_URL_REQUEST_SET_PRIORITY,
991 NetLog::IntegerCallback("priority", priority_)); 969 NetLog::IntegerCallback("priority", priority_));
992 job_->SetPriority(priority_); 970 job_->SetPriority(priority_);
993 } 971 }
994 } 972 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 new base::debug::StackTrace(NULL, 0); 1159 new base::debug::StackTrace(NULL, 0);
1182 *stack_trace_copy = stack_trace; 1160 *stack_trace_copy = stack_trace;
1183 stack_trace_.reset(stack_trace_copy); 1161 stack_trace_.reset(stack_trace_copy);
1184 } 1162 }
1185 1163
1186 const base::debug::StackTrace* URLRequest::stack_trace() const { 1164 const base::debug::StackTrace* URLRequest::stack_trace() const {
1187 return stack_trace_.get(); 1165 return stack_trace_.get();
1188 } 1166 }
1189 1167
1190 } // namespace net 1168 } // namespace net
OLDNEW
« no previous file with comments | « trunk/src/net/url_request/url_request.h ('k') | trunk/src/net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698