OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/notifier/registration_manager.h" | 5 #include "chrome/browser/sync/notifier/registration_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 (status->last_registration_request - | 185 (status->last_registration_request - |
186 status->last_registration_attempt) + | 186 status->last_registration_attempt) + |
187 status->next_delay; | 187 status->next_delay; |
188 base::TimeDelta delay = | 188 base::TimeDelta delay = |
189 (status->delay <= base::TimeDelta()) ? | 189 (status->delay <= base::TimeDelta()) ? |
190 base::TimeDelta() : status->delay; | 190 base::TimeDelta() : status->delay; |
191 VLOG(2) << "Registering " | 191 VLOG(2) << "Registering " |
192 << syncable::ModelTypeToString(model_type) << " in " | 192 << syncable::ModelTypeToString(model_type) << " in " |
193 << delay.InMilliseconds() << " ms"; | 193 << delay.InMilliseconds() << " ms"; |
194 status->registration_timer.Stop(); | 194 status->registration_timer.Stop(); |
195 status->registration_timer.Start(FROM_HERE, | 195 status->registration_timer.Start( |
196 delay, status, &RegistrationManager::RegistrationStatus::DoRegister); | 196 delay, status, &RegistrationManager::RegistrationStatus::DoRegister); |
197 double next_delay_seconds = | 197 double next_delay_seconds = |
198 CalculateBackoff(static_cast<double>(status->next_delay.InSeconds()), | 198 CalculateBackoff(static_cast<double>(status->next_delay.InSeconds()), |
199 kInitialRegistrationDelaySeconds, | 199 kInitialRegistrationDelaySeconds, |
200 kMinRegistrationDelaySeconds, | 200 kMinRegistrationDelaySeconds, |
201 kMaxRegistrationDelaySeconds, | 201 kMaxRegistrationDelaySeconds, |
202 kRegistrationDelayExponent, | 202 kRegistrationDelayExponent, |
203 GetJitter(), | 203 GetJitter(), |
204 kRegistrationDelayMaxJitter); | 204 kRegistrationDelayMaxJitter); |
205 status->next_delay = | 205 status->next_delay = |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 bool RegistrationManager::IsTypeRegistered( | 244 bool RegistrationManager::IsTypeRegistered( |
245 syncable::ModelType model_type) const { | 245 syncable::ModelType model_type) const { |
246 DCHECK(non_thread_safe_.CalledOnValidThread()); | 246 DCHECK(non_thread_safe_.CalledOnValidThread()); |
247 return registration_statuses_[model_type].state == | 247 return registration_statuses_[model_type].state == |
248 invalidation::InvalidationListener::REGISTERED; | 248 invalidation::InvalidationListener::REGISTERED; |
249 } | 249 } |
250 | 250 |
251 } // namespace sync_notifier | 251 } // namespace sync_notifier |
OLD | NEW |