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

Side by Side Diff: net/url_request/url_request_throttler_entry.cc

Issue 10830124: Removed checks that verify URLRequest has a Context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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
« no previous file with comments | « net/url_request/url_request_job_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_throttler_entry.h" 5 #include "net/url_request/url_request_throttler_entry.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 void URLRequestThrottlerEntry::DetachManager() { 148 void URLRequestThrottlerEntry::DetachManager() {
149 manager_ = NULL; 149 manager_ = NULL;
150 } 150 }
151 151
152 bool URLRequestThrottlerEntry::ShouldRejectRequest( 152 bool URLRequestThrottlerEntry::ShouldRejectRequest(
153 const URLRequest& request) const { 153 const URLRequest& request) const {
154 bool reject_request = false; 154 bool reject_request = false;
155 if (!is_backoff_disabled_ && !ExplicitUserRequest(request.load_flags()) && 155 if (!is_backoff_disabled_ && !ExplicitUserRequest(request.load_flags()) &&
156 (!request.context() || !request.context()->network_delegate() || 156 (!request.context()->network_delegate() ||
157 request.context()->network_delegate()->CanThrottleRequest(request)) && 157 request.context()->network_delegate()->CanThrottleRequest(request)) &&
158 GetBackoffEntry()->ShouldRejectRequest()) { 158 GetBackoffEntry()->ShouldRejectRequest()) {
159 int num_failures = GetBackoffEntry()->failure_count(); 159 int num_failures = GetBackoffEntry()->failure_count();
160 int release_after_ms = 160 int release_after_ms =
161 GetBackoffEntry()->GetTimeUntilRelease().InMilliseconds(); 161 GetBackoffEntry()->GetTimeUntilRelease().InMilliseconds();
162 162
163 net_log_.AddEvent( 163 net_log_.AddEvent(
164 NetLog::TYPE_THROTTLING_REJECTED_REQUEST, 164 NetLog::TYPE_THROTTLING_REJECTED_REQUEST,
165 base::Bind(&NetLogRejectedRequestCallback, 165 base::Bind(&NetLogRejectedRequestCallback,
166 &url_id_, num_failures, release_after_ms)); 166 &url_id_, num_failures, release_after_ms));
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() { 312 BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() {
313 return &backoff_entry_; 313 return &backoff_entry_;
314 } 314 }
315 315
316 // static 316 // static
317 bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) { 317 bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) {
318 return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0; 318 return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0;
319 } 319 }
320 320
321 } // namespace net 321 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698