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

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

Issue 12328072: Remove some calls to URLRequestContext::network_delegate(). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 7 years, 10 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
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()->network_delegate() || 156 request.CanThrottle() && GetBackoffEntry()->ShouldRejectRequest()) {
erikwright (departed) 2013/02/25 15:07:23 I don't think this is right. Either we can just no
157 request.context()->network_delegate()->CanThrottleRequest(request)) &&
158 GetBackoffEntry()->ShouldRejectRequest()) {
159 int num_failures = GetBackoffEntry()->failure_count(); 157 int num_failures = GetBackoffEntry()->failure_count();
160 int release_after_ms = 158 int release_after_ms =
161 GetBackoffEntry()->GetTimeUntilRelease().InMilliseconds(); 159 GetBackoffEntry()->GetTimeUntilRelease().InMilliseconds();
162 160
163 net_log_.AddEvent( 161 net_log_.AddEvent(
164 NetLog::TYPE_THROTTLING_REJECTED_REQUEST, 162 NetLog::TYPE_THROTTLING_REJECTED_REQUEST,
165 base::Bind(&NetLogRejectedRequestCallback, 163 base::Bind(&NetLogRejectedRequestCallback,
166 &url_id_, num_failures, release_after_ms)); 164 &url_id_, num_failures, release_after_ms));
167 165
168 reject_request = true; 166 reject_request = true;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() { 310 BackoffEntry* URLRequestThrottlerEntry::GetBackoffEntry() {
313 return &backoff_entry_; 311 return &backoff_entry_;
314 } 312 }
315 313
316 // static 314 // static
317 bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) { 315 bool URLRequestThrottlerEntry::ExplicitUserRequest(const int load_flags) {
318 return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0; 316 return (load_flags & LOAD_MAYBE_USER_GESTURE) != 0;
319 } 317 }
320 318
321 } // namespace net 319 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698