OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/password_manager/core/browser/affiliation_fetch_throttler.h
" | 5 #include "components/password_manager/core/browser/affiliation_fetch_throttler.h
" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
11 #include "base/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "base/time/tick_clock.h" | 12 #include "base/time/tick_clock.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "components/password_manager/core/browser/affiliation_fetch_throttler_d
elegate.h" | 14 #include "components/password_manager/core/browser/affiliation_fetch_throttler_d
elegate.h" |
15 | 15 |
16 namespace password_manager { | 16 namespace password_manager { |
17 | 17 |
18 // static | 18 // static |
19 const net::BackoffEntry::Policy AffiliationFetchThrottler::kBackoffPolicy = { | 19 const net::BackoffEntry::Policy AffiliationFetchThrottler::kBackoffPolicy = { |
20 // Number of initial errors (in sequence) to ignore before going into | 20 // Number of initial errors (in sequence) to ignore before going into |
21 // exponential backoff. | 21 // exponential backoff. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 (1 - base::RandDouble() * kBackoffPolicy.jitter_factor); | 134 (1 - base::RandDouble() * kBackoffPolicy.jitter_factor); |
135 exponential_backoff_->SetCustomReleaseTime(std::max( | 135 exponential_backoff_->SetCustomReleaseTime(std::max( |
136 exponential_backoff_->GetReleaseTime(), | 136 exponential_backoff_->GetReleaseTime(), |
137 tick_clock_->NowTicks() + base::TimeDelta::FromMillisecondsD(grace_ms))); | 137 tick_clock_->NowTicks() + base::TimeDelta::FromMillisecondsD(grace_ms))); |
138 | 138 |
139 if (state_ == FETCH_NEEDED) | 139 if (state_ == FETCH_NEEDED) |
140 EnsureCallbackIsScheduled(); | 140 EnsureCallbackIsScheduled(); |
141 } | 141 } |
142 | 142 |
143 } // namespace password_manager | 143 } // namespace password_manager |
OLD | NEW |