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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_service.cc

Issue 10882063: Captive portal service: Don't use a retry delay after getting a new result. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | « no previous file | chrome/browser/captive_portal/captive_portal_service_unittest.cc » ('j') | 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 "chrome/browser/captive_portal/captive_portal_service.h" 5 #include "chrome/browser/captive_portal/captive_portal_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 if (last_check_time_.is_null() || new_result != last_detection_result_) { 255 if (last_check_time_.is_null() || new_result != last_detection_result_) {
256 first_check_time_with_same_result_ = now; 256 first_check_time_with_same_result_ = now;
257 num_checks_with_same_result_ = 1; 257 num_checks_with_same_result_ = 1;
258 258
259 // Reset the backoff entry both to update the default time and clear 259 // Reset the backoff entry both to update the default time and clear
260 // previous failures. 260 // previous failures.
261 ResetBackoffEntry(new_result); 261 ResetBackoffEntry(new_result);
262 262
263 backoff_entry_->SetCustomReleaseTime(now + retry_after_delta); 263 backoff_entry_->SetCustomReleaseTime(now + retry_after_delta);
264 backoff_entry_->InformOfRequest(true); 264 // The BackoffEntry is not informed of this request, so there's no delay
265 // before the next request. This allows for faster login when a captive
266 // portal is first detected. It can also help when moving between captive
267 // portals.
265 } else { 268 } else {
266 DCHECK_LE(1, num_checks_with_same_result_); 269 DCHECK_LE(1, num_checks_with_same_result_);
267 ++num_checks_with_same_result_; 270 ++num_checks_with_same_result_;
268 271
269 // Requests that have the same Result as the last one are considered 272 // Requests that have the same Result as the last one are considered
270 // "failures", to trigger backoff. 273 // "failures", to trigger backoff.
274 backoff_entry_->SetCustomReleaseTime(now + retry_after_delta);
271 backoff_entry_->InformOfRequest(false); 275 backoff_entry_->InformOfRequest(false);
272 } 276 }
273 277
274 last_check_time_ = now; 278 last_check_time_ = now;
275 279
276 OnResult(new_result); 280 OnResult(new_result);
277 } 281 }
278 282
279 void CaptivePortalService::Observe( 283 void CaptivePortalService::Observe(
280 int type, 284 int type,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 419
416 bool CaptivePortalService::FetchingURL() const { 420 bool CaptivePortalService::FetchingURL() const {
417 return url_fetcher_.get() != NULL; 421 return url_fetcher_.get() != NULL;
418 } 422 }
419 423
420 bool CaptivePortalService::TimerRunning() const { 424 bool CaptivePortalService::TimerRunning() const {
421 return check_captive_portal_timer_.IsRunning(); 425 return check_captive_portal_timer_.IsRunning();
422 } 426 }
423 427
424 } // namespace captive_portal 428 } // namespace captive_portal
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/captive_portal/captive_portal_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698