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

Unified Diff: net/url_request/url_request.cc

Issue 51683002: [Net] Assert that URLRequests with LOAD_IGNORE_LIMITS have MAXIMUM_PRIORITY (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request.cc
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index dae9d0e5339f860eb066eea982ef63061636968e..2e4ec57e986a888f25c0eb4c0cc637fb01a69707 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -498,6 +498,20 @@ int URLRequest::GetResponseCode() const {
return job_->GetResponseCode();
}
+void URLRequest::SetLoadFlags(int flags) {
+ if ((load_flags_ & LOAD_IGNORE_LIMITS) != (flags & LOAD_IGNORE_LIMITS)) {
+ DCHECK(!job_);
+ DCHECK(flags & LOAD_IGNORE_LIMITS);
+ DCHECK_EQ(priority_, MAXIMUM_PRIORITY);
+ }
+ load_flags_ = flags;
+
+ // This should be a no-op given the above DCHECKs, but do this
+ // anyway for release mode.
+ if ((load_flags_ & LOAD_IGNORE_LIMITS) != 0)
+ SetPriority(MAXIMUM_PRIORITY);
+}
+
// static
void URLRequest::SetDefaultCookiePolicyToBlock() {
CHECK(!g_url_requests_started);
@@ -960,6 +974,14 @@ int64 URLRequest::GetExpectedContentSize() const {
void URLRequest::SetPriority(RequestPriority priority) {
DCHECK_GE(priority, MINIMUM_PRIORITY);
DCHECK_LE(priority, MAXIMUM_PRIORITY);
+
+ if ((load_flags_ & LOAD_IGNORE_LIMITS) && (priority != MAXIMUM_PRIORITY)) {
+ NOTREACHED();
+ // Maintain the invariant that requests with IGNORE_LIMITS set
+ // have MAXIMUM_PRIORITY for release mode.
+ return;
+ }
+
if (priority_ == priority)
return;
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698